trying to get math right

This commit is contained in:
Dan Ballard 2011-06-29 07:08:33 -07:00
parent 4e25d91ce5
commit da9eca6122
1 changed files with 6 additions and 1 deletions

View File

@ -24,7 +24,12 @@
(defparameter *t1* '( (-0.5 -0.5 0) (0 0.5 0) (0.5 -0.5 0)))
(defun rotate-vertex (v time)
(list (+ (first v) (/ (sin time) 2)) (+ (second v) (/ (cos time) 2)) (third v)))
(let* ((x (first v))
(y (second v))
(theta (atan (if (eql 0 x) 1000000 (/ y x))))
(hyp (sqrt (+ (* x x) (* y y)))))
(list (/ (cos (+ theta time)) hyp) (/ (sin (+ theta time)) hyp) (third v))))
; (list (+ (first v) (/ (sin time) 2)) (+ (second v) (/ (cos time) 2)) (third v)))
(defun rotate-triangle (tri time)
(list (rotate-vertex (first tri) time)