📄 cos.lsp
字号:
(defun dcos()
(graphscr)
(command "limits" '(0 0) '(12 9)
"zoom" "a")
(initget 1)
(setq p1 (getpoint "\n start:"))
(initget 1)
(setq p2 (getpoint p1 "\n end:"))
(setq x1 (car p1)
y1 (cadr p1)
x 0
l '()
end (- (car p2) x1)
)
(setq a (getreal "\n a=") )
(setq b (getreal "\n b=") )
(setq c (getreal "\n c=") )
(command "pline" (polar p1 pi 1)
(polar p2 0 2) "")
(command "pline" (polar p1 (/ pi 2) (* 1.5 a))
(polar p1 (* 1.5 pi ) (* 1.5 a)) "")
(while (< x end)
(setq y (+ (* a (cos (+ (* b x) c))) y1)
px (list (+ x x1) y)
l (cons px l)
x (+ x 0.05)
)
)
(command "pline")
(foreach p l (command p))
(command "")
(redraw)
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -