made roate-* now can take a vector

This commit is contained in:
Dan Ballard 2012-06-26 22:20:02 -07:00
parent fe2dcf99f4
commit 75e3aea0ea
3 changed files with 10 additions and 9 deletions

View File

@ -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)

View File

@ -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)))
(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))))
(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)

View File

@ -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))))