lib/gamebox/lib/vector2.rb
# Limits vector's magnitude by a maximum value
Limits vector's magnitude by a maximum value
Limits vector ' s magnitude by a maximum value
def limit(maximum)
    mag_squared = magnitude ** 2
    return copy if mag_squared <= maximum**2
    return (unit! * maximum)
  end
def limit ( maximum ) mag_squared = magnitude ** 2 return copy if mag_squared <= maximum ** 2 return ( unit! * maximum ) end
Limits vector's magnitude by a maximum value
Limits vector ' s magnitude by a maximum value
maximum
<not_specific>