Calculates dot product of two vectors.
v1 = Vector2d(2, 1) v2 = Vector2d(2, 3) Vector2d.dot_product(v1, v2) # => 10
22 23 24
# File 'lib/vector2d/calculations.rb', line 22 def dot_product(vector1, vector2) (vector1.x * vector2.x) + (vector1.y * vector2.y) end