Class: Triangular::Vector

Inherits:
Point
  • Object
show all
Defined in:
lib/triangular/vector.rb

Instance Attribute Summary

Attributes inherited from Point

#x, #y, #z

Instance Method Summary collapse

Methods inherited from Point

#==, #initialize, parse, pattern, #to_s, #translate!

Constructor Details

This class inherits a constructor from Triangular::Point

Instance Method Details

#angle_to(other_vector) ⇒ Object



5
6
7
8
9
# File 'lib/triangular/vector.rb', line 5

def angle_to(other_vector)
  dot_product = @x * other_vector.x + @y * other_vector.y + @z * other_vector.z
  radians = Math.acos(dot_product)
  radians * (180.0 / Math::PI)
end