马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- (defun fplot (expr steps xpi ypi / xn yn zn tlist plist _plot)
- (defun _plot (l / i j)
- (setq i 0)
- (command "_3dmesh" (length l) (length (car l)))
- (repeat (length l)
- (setq j 0)
- (repeat (length (car l))
- (command (nth j (nth i l)))
- (setq j (1+ j))
- )
- (setq i (1+ i))
- )
- ) ; **********************
- (setvar "blipmode" 0)
- (setvar "cmdecho" 0)
- (setq plist nil)
- (setq xn 0.0
- yn 0.0
- )
- (repeat (* xpi steps)
- (setq tlist nil)
- (setq yn 0.0)
- (repeat (* ypi steps)
- (setq zn ((eval expr) xn
- yn
- )
- )
- (setq tlist (append
- tlist
- (list (list xn yn zn))
- )
- )
- (setq yn (+ yn (/ pi steps)))
- )
- (setq plist (append
- plist
- (list tlist)
- )
- )
- (setq xn (+ xn (/ pi steps)))
- )
- (_plot plist)
- )
-
E.g
- (fplot '(lambda(x y / )(*(cos x)(cos y))) 10 10 10)
复制代码
- (fplot
- '(lambda(x y / )
- (max -0.5(min 0.5(*(cos x)(cos y))))
- )
- )
复制代码
- (fplot
- '(lambda(x y / )
- (/(*(+(cos x)x)(+(cos y)y))50.0)
- )
- )
复制代码
- (fplot '(lambda(x y / )(cos(* x y))) 20 3 3)
复制代码
|