trying to get math right
This commit is contained in:
parent
4e25d91ce5
commit
da9eca6122
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue