From 75e3aea0eaf04a0d39252fef434c0d5efcd2c929 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 26 Jun 2012 22:20:02 -0700 Subject: [PATCH] made roate-* now can take a vector --- engine.lisp | 2 +- math.lisp | 14 +++++++------- model.lisp | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/engine.lisp b/engine.lisp index 2089659..605850f 100644 --- a/engine.lisp +++ b/engine.lisp @@ -81,7 +81,7 @@ (make-thruster-vertices (transform-points (translate-points *3pyramid-points* (vector 0 0 0.5)) (vector 4 1 1.01)) ;'( (0.0 0.5 0.0) (-2.0 -0.5 0.0) (2.0 -0.5 0.0) (0.0 0.0 0.0)) - (transform-points (translate-points (rotate-points *3pyramid-points* (make-rotation-matrix (vector 0 0 0))) (vector 0 0 0.5)) (vector 4 1 1.5)) + (transform-points (translate-points (rotate-points *3pyramid-points* (vector 0 0 0)) (vector 0 0 0.5)) (vector 4 1 1.5)) ; '( (0.0 0.5 0.0) (-2.0 -0.5 0.0) (2.0 -0.5 0.0) (0.0 0.0 1.5)) 2)) ; '((0.0 0.5 0.0) (-2.0 -0.5 0.0) (2.0 -0.5 0.0) diff --git a/math.lisp b/math.lisp index a9e6dff..9d7a314 100644 --- a/math.lisp +++ b/math.lisp @@ -53,15 +53,15 @@ (loop for v across tri collecting (translate-point position v)))) (defun rotate-triangle (points m) -; (if (not (vectorp (aref m 0))) -; (rotate-triangle points (make-rotation-matrix m))) - (make-array (length points) :initial-contents - (loop for v across points collecting (rotate* m v)))) + (if (not (eql (second (type-of m)) t)) + (rotate-triangle points (make-rotation-matrix m)) + (make-array (length points) :initial-contents + (loop for v across points collecting (rotate* m v))))) (defun rotate-points (points m) -; (if (not (vectorp (aref m 0))) -; (rotate-points points (make-rotation-matrix m))) - (make-array (length points) :initial-contents (loop for tri across points collecting (rotate* m tri)))) + (if (not (eql (second (type-of m)) t)) + (rotate-points points (make-rotation-matrix m)) + (make-array (length points) :initial-contents (loop for tri across points collecting (rotate* m tri))))) (defun scale-vector (v a) diff --git a/model.lisp b/model.lisp index dd34be1..ebe452d 100644 --- a/model.lisp +++ b/model.lisp @@ -109,7 +109,8 @@ (defparameter *ship-model* (make-model-3pyramid ;*3pyramid-flat-points* (transform-points - (rotate-points *3pyramid-flat-points* (make-rotation-matrix (vector 0 0 0))) + ;(rotate-points *3pyramid-flat-points* (make-rotation-matrix (vector 0 0 0))) + (rotate-points *3pyramid-flat-points* (vector 0 0 0)) (vector 4 1 3)) :face-colors '((196 196 196) (196 196 196) (196 196 196) (32 32 32))))