Method: MiniGL::Vector#distance

Defined in:
lib/minigl/global.rb

#distance(other_vector) ⇒ Object

Returns the euclidean distance between this vector and other_vector.



64
65
66
67
68
# File 'lib/minigl/global.rb', line 64

def distance(other_vector)
  dx = @x - other_vector.x
  dy = @y - other_vector.y
  Math.sqrt(dx ** 2 + dy ** 2)
end