From da9eca6122bc925f7f0e1322b07a66fbed10731c Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 29 Jun 2011 07:08:33 -0700 Subject: [PATCH] trying to get math right --- 3bb-1.lisp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/3bb-1.lisp b/3bb-1.lisp index 435ec04..ac710f8 100644 --- a/3bb-1.lisp +++ b/3bb-1.lisp @@ -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)