lib/ruby_on_rays/shapes/plane.rb
# Finds the intersection between the ray and the plane.
# @param ray [Ray3]
# @return [nil] if no such intersection.
# @return [HitInfo] if an intersection was found.
Finds the intersection between the ray and the plane.
Finds the intersection between the ray and the plane .
def intersection(ray)
      b = ray.d.dot(@n)
      return nil if b == 0.0
      a = @p.sub(ray.o).dot(@n)
      t = a / b
      return nil if t < ray.tmin || t > ray.tmax
      ray[t]
      { t: t, p: ray[t], n: @n, shape: self }
    end
def intersection ( ray ) b = ray . d . dot ( @n ) return nil if b == 0.0 a = @p . sub ( ray . o ) . dot ( @n ) t = a / b return nil if t < ray . tmin || t > ray . tmax ray [ t ] { t : t , p : ray [ t ] , n : @n , shape : self } end
Finds the intersection between the ray and the plane.
Finds the intersection between the ray and the plane .
if no such intersection.
if no such intersection .
nil
if an intersection was found.
if an intersection was found .
HitInfo
ray
<not_specific>
<not_specific>
None