lib/triangular/vector.rb in triangular-0.0.2 vs lib/triangular/vector.rb in triangular-0.1.1

- old
+ new

@@ -1,4 +1,11 @@ +# frozen_string_literal: true + module Triangular - class Vector < Point + class Vector < Point + 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 end end