plane_intersection   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm

Implementation

(bind-func plane_intersection
  (lambda (ray_origin:float* ray_dir:float* plane_centre:float* plane_normal:float*)
    (let ((denom (vvdot plane_normal ray_dir 3))
          (t -1.0))
      (if (> (fabs denom) 0.0001:f) ;; epsilon
          (begin
            (vvsub plane_centre ray_origin 3 plane_centre)
            (set! t (/ (vvdot plane_centre plane_normal 3)
                       denom))))
      (if (>= t 0.0)
          #t
          #f))))


Back to Index

Similar Entries