add transform function and now define ship based on flast 3pyramid rotated and transformed
This commit is contained in:
		
							parent
							
								
									e3fcf269cb
								
							
						
					
					
						commit
						086ef7f600
					
				|  | @ -59,9 +59,17 @@ | |||
| (defun scale-vector (v a) | ||||
|   (make-array (length v) :initial-contents (loop for i across v collecting (* i a)))) | ||||
| 
 | ||||
| ; scale points by a | ||||
| (defun scale-points (points a) | ||||
|   (make-array (length points) :initial-contents (loop for v across points collecting (scale-vector v a)))) | ||||
| 
 | ||||
| ; scale poitns by v (x y z) | ||||
| (defun transform-points (points x y z) | ||||
|   (make-array (length points) :initial-contents  | ||||
| 	      (loop for v across points collecting  | ||||
| 		   (make-array 3 :initial-contents | ||||
| 			       (list (* (aref v 0) x) (* (aref v 1) y) (* (aref v 2) z)))))) | ||||
| 
 | ||||
| ; returns a vector with all elemts scaled to biggest 1 which is scaled to 1 | ||||
| ; e.x. (scale-vector (8 4 2)) -> (1 .5 .25) | ||||
| (defun scale-vector-1 (v) | ||||
|  |  | |||
|  | @ -107,7 +107,9 @@ | |||
| 
 | ||||
| (defparameter *ship-model* | ||||
|   (make-model-3pyramid ;*3pyramid-flat-points* | ||||
|    (transform-points | ||||
|     (rotate-triangle  (make-2d-array 4 3 *3pyramid-flat-points*) (make-rotation-matrix 0 0 0)) | ||||
|     4 1 3) | ||||
|    :face-colors '((196 196 196) (196 196 196) (196 196 196) (32 32 32)))) | ||||
| 
 | ||||
| ;(defparameter *ship-model* | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue