用LISP程序画函数曲线

(1)抛物线y=Ax2(2)阿基米德螺线r=aθ... (1) 抛物线y=Ax2
(2) 阿基米德螺线r=aθ
展开
 我来答 举报
shuiyunlanyi
2010-05-29 · TA获得超过212个赞
知道小有建树答主
回答量:143
采纳率:0%
帮助的人:137万
展开全部
3. (defun c:pwx ()
(setq pt1 (getpoint"\nThe first point, please"))
(setq pt2 (getpoint"\nThe second point,please"))
(setq pt3 (getpoint"\nThe third point,please"))
(setq n (getdist "\nSegment number"))

(setq f (open "pwx.inp" "w"))
(print (car pt1) f)
(print (cadr pt1) f)
(print (car pt2) f)
(print (cadr pt2) f)
(print (car pt3) f)
(print (cadr pt3) f)
(print fdx f)
(close f)
(command "shell" "pwx")

(setq f (open "pwx.dat" "r"))
(setq a (atof (read-line f)))
(setq b (atof (read-line f)))
(setq c (atof (read-line f)))
(close f)
(setq dx (- (car pt3) (car pt1)))
;(setq n (fix (/ (+ (abs dx) 0.5) fdx)))

(setq ddx (/ dx n))
(command "pline" pt1)
(setq i 1)
(while (<= i n)
(setq x (+ (car pt1) (* ddx i)))
(setq y (+ (* a x x) (* b x) c))
(setq pt (list x y))
(command pt)
(setq i (1+ i))

(command "")
)
(defun break (message / loop)
(princ message) (setq loop t)
(while loop (princ "\n>:")
(setq query (read-line)) (if (/= query "")
(princ (eal (read query))) (setq loop nil)
) (princ)
)

用LISP程序画阿基米德螺线的程序如下:

AJMD.LSP
(defun func (hansu / p x0 y0 s e d v p1 p2)
(initget 1)
(setq sp (getpoint "\n输入中心点: "))
(setq x0 (car sp))
(setq y0 (cadr sp))
(setq s (getreal "\n起始角度(弧度值)<0>:"))
(if (not s) (setq s 0.0))
(setq e (getreal "\n终端角度(弧度值)<2pi>:"))
(if (not e) (setq e (* 2 pi)))
(setq d (getreal "\n步长(弧度值)<0.1>:"))
(if (not d) (setq d 0.1))
(setq r (getreal "\n半径(mm)<20.0>:"))
(if (not r) (setq r 20.0))
(setq v s p1 (hansu v))
(while (< v (+ e 0.001))
(setq v (+ v d) p2 (hansu v))
(command "line" p1 p2 "")
(setq p1 p2)
)
)

(defun ajmd (b / x y)
(setq x (+ x0 (* r b (cos b))) y (+ y0 (* r b (sin b))))
(list x y)
)
(defun c:ajmd()
(func ajmd)
(redraw)
(princ)
)
东莞大凡
2024-08-07 广告
在东莞市大凡光学科技有限公司,我们利用Halcon软件处理机器视觉项目时,会用到自定义标定板以满足特定需求。Halcon支持用户根据实际应用场景自定义标定板形状与标记点。这不仅可以灵活应对不同工作环境,还能提高标定精度。通过调整圆点数量、间... 点击进入详情页
本回答由东莞大凡提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式