Methods
Class Public methods
new(p, n)
Link
Source: show
# File benchmark/bm_app_aobench.rb, line 90 def initialize(p, n) @p = p @n = n end
Instance Public methods
intersect(ray, isect)
Link
Source: show
# File benchmark/bm_app_aobench.rb, line 95 def intersect(ray, isect) d = -@p.vdot(@n) v = ray.dir.vdot(@n) v0 = v if v < 0.0 then v0 = -v end if v0 < 1.0e-17 then return end t = -(ray.org.vdot(@n) + d) / v if t > 0.0 and t < isect.t then isect.hit = true isect.t = t isect.n = @n isect.pl = Vec.new(ray.org.x + t * ray.dir.x, ray.org.y + t * ray.dir.y, ray.org.z + t * ray.dir.z) end nil end