我要用VISUAL LISP 编写一个运动模拟。要有速度的概念。

来源:百度知道 编辑:UC知道 时间:2024/05/21 19:39:28
怎么让我的运动的物体。运动有慢有快。。比如我的一个绕一点转动的杆。角速度的大小,如何可以体现出来。。杆的位置可以确定。可是速度呢。
怎么和 程序运行时间结合?

角速度大小以运动物体移动的快慢体现出来。
而运动物体的坐标可以表示为
x = r.cos(a)
y = r.sin(a)

其中a=角速度*t
控制a同程序运行时间t的变化关系即可控制xy转动的速度。

不清楚你要做什么,最好说明清楚。LISP没有时间函数,以下是我自己写的delay函数,可以参考一下,用来做游戏还是可以的。

;延时函数,globle_last_Time是全局函数,第一次运行时先reset_Time一下
(defun reset_Time ( / )
(setq globle_last_Time (getSecond))
)

(defun getSecond ( / time)
(setq time (* 10000 (getvar "CDATE"))
time (* 100 (- time (fix time)))
)
)

(defun delay1 (second / this_time )
(while (> (+ second globle_last_Time) (setq this_time (getSecond))))
(setq globle_last_Time this_time)
)

(defun delay(second / )
(reset_Time)
(delay1 second)
(princ "延时second秒")
(princ)
)

很NB的算法,数学,物理都不好,没办法。。。。