3 (in-package :tuple-trace
)
5 ;; this is a small enough thing it might be a primitive in cl-tuples..
8 ((origin :type vector3d
)
9 (direction :type vector3d
))))
12 (defun make-ray (xo yo zo xr yr zr
)
15 :origin
(make-vector3d* xo yo zo
)
16 :direction
(make-vector3d* xr yr zr
))))
19 (defmethod distance-of ((self ray
))
20 (vector3d-length (direction-of self
)))
22 (defmethod direction-normal-of ((self ray
))
23 (vector3d-normal (direction-of self
)))
25 (def-tuple-op extrapolate
26 ((origin vector3d
(xo yo zo
))
27 (direction vector3d
(xd yd zd
))
33 (+ zo
(* zd alpha
)))))
35 (defmethod point-on ((self ray
) interval
)
42 ;; (defparameter *ray* (make-ray 0.0 1.0 0.0 0.0 -1.0 0.0))
43 ;; (direction-of *ray*)
44 ;; (distance-of *ray*)
45 ;; (direction-normal-of *ray*)
46 ;; (setf (direction-of *ray*) #{ 0.0 -2.0 0.0 })
47 ;; (direction-normal-of *ray*)
48 ;; (point-on *ray* 4.0)