In Files

  • benchmark/ao-render.rb

Vec

Public Class Methods

new(x, y, z) click to toggle source
 
               # File benchmark/ao-render.rb, line 32
def initialize(x, y, z)
  @x = x
  @y = y
  @z = z
end
            

Public Instance Methods

vadd(b) click to toggle source
 
               # File benchmark/ao-render.rb, line 45
def vadd(b)
  Vec.new(@x + b.x, @y + b.y, @z + b.z)
end
            
vcross(b) click to toggle source
 
               # File benchmark/ao-render.rb, line 53
def vcross(b)
  Vec.new(@y * b.z - @z * b.y,
          @z * b.x - @x * b.z,
          @x * b.y - @y * b.x)
end
            
vdot(b) click to toggle source
 
               # File benchmark/ao-render.rb, line 59
def vdot(b)
  r = @x * b.x + @y * b.y + @z * b.z
  r
end
            
vlength() click to toggle source
 
               # File benchmark/ao-render.rb, line 64
def vlength
  Math.sqrt(@x * @x + @y * @y + @z * @z)
end
            
vnormalize() click to toggle source
 
               # File benchmark/ao-render.rb, line 68
def vnormalize
  len = vlength
  v = Vec.new(@x, @y, @z)
  if len > 1.0e-17 then
    v.x = v.x / len
    v.y = v.y / len
    v.z = v.z / len
  end
  v
end
            
vsub(b) click to toggle source
 
               # File benchmark/ao-render.rb, line 49
def vsub(b)
  Vec.new(@x - b.x, @y - b.y, @z - b.z)
end
            
x() click to toggle source
 
               # File benchmark/ao-render.rb, line 41
def x; @x; end
            
x=(v) click to toggle source
 
               # File benchmark/ao-render.rb, line 38
def x=(v); @x = v; end
            
y() click to toggle source
 
               # File benchmark/ao-render.rb, line 42
def y; @y; end
            
y=(v) click to toggle source
 
               # File benchmark/ao-render.rb, line 39
def y=(v); @y = v; end
            
z() click to toggle source
 
               # File benchmark/ao-render.rb, line 43
def z; @z; end
            
z=(v) click to toggle source
 
               # File benchmark/ao-render.rb, line 40
def z=(v); @z = v; 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