Normalize the vector to length 1 (make it a unit vector). @webref pvector:method @usage web_application @webBrief Normalize the vector to a length of 1
()
| 771 | * @webBrief Normalize the vector to a length of 1 |
| 772 | */ |
| 773 | public PVector normalize() { |
| 774 | float m = mag(); |
| 775 | if (m != 0 && m != 1) { |
| 776 | div(m); |
| 777 | } |
| 778 | return this; |
| 779 | } |
| 780 | |
| 781 | |
| 782 | /** |