Method: Processing::Vector#limit

Defined in:
lib/processing/vector.rb

#limit(max) ⇒ Vector

Changes the length of the vector if it’s length is greater than the max value.

Parameters:

  • max (Numeric)

    max length

Returns:

See Also:



472
473
474
475
# File 'lib/processing/vector.rb', line 472

def limit(max)
  setMag max if magSq > max ** 2
  self
end