( begin auto-generated from PVector_normalize.xml ) Normalize the vector to length 1 (make it a unit vector). ( end auto-generated ) @webref pvector:method @usage web_application @brief Normalize the vector to a length of 1
()
| 801 | * @brief Normalize the vector to a length of 1 |
| 802 | */ |
| 803 | public PVector normalize() { |
| 804 | float m = mag(); |
| 805 | if (m != 0 && m != 1) { |
| 806 | div(m); |
| 807 | } |
| 808 | return this; |
| 809 | } |
| 810 | |
| 811 | |
| 812 | /** |