In Files

  • benchmark/ao-render.rb

Parent

Methods

Plane

Public Class Methods

new(p, n) click to toggle source
 
               # File benchmark/ao-render.rb, line 112
def initialize(p, n)
  @p = p
  @n = n
end
            

Public Instance Methods

intersect(ray, isect) click to toggle source
 
               # File benchmark/ao-render.rb, line 117
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
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus