( begin auto-generated from PVector_limit.xml ) Limit the magnitude of this vector to the value used for the max parameter. ( end auto-generated ) @webref pvector:method @usage web_application @param max the maximum magnitude for the vector @brief Limit the magnitude of the vector
(float max)
| 840 | * @brief Limit the magnitude of the vector |
| 841 | */ |
| 842 | public PVector limit(float max) { |
| 843 | if (magSq() > max*max) { |
| 844 | normalize(); |
| 845 | mult(max); |
| 846 | } |
| 847 | return this; |
| 848 | } |
| 849 | |
| 850 | |
| 851 | /** |