Object
# File irb/easter-egg.rb, line 6 def initialize(x, y, z) @x, @y, @z = x, y, z end
# File irb/easter-egg.rb, line 20 def cross(other) ox, oy, oz = other.x, other.y, other.z Vec.new(@y*oz-@z*oy, @z*ox-@x*oz, @x*oy-@y*ox) end
# File irb/easter-egg.rb, line 16 def dot(other) @x*other.x + @y*other.y + @z*other.z end
# File irb/easter-egg.rb, line 25 def normalize r = Math.sqrt(self.dot(self)) Vec.new(@x / r, @y / r, @z / r) end
# File irb/easter-egg.rb, line 12 def sub(other) Vec.new(@x - other.x, @y - other.y, @z - other.z) end
This page was generated for Ruby 2.5.1
Ruby-doc.org is a service of James Britt and Neurogami, purveyors of fine dance noise.
Generated with Ruby-doc Rdoc Generator 0.44.2.