Sets the value of this vector to the normalization of vector v1. @param v1 the un-normalized vector
(Vector2f v1)
| 130 | * @param v1 the un-normalized vector |
| 131 | */ |
| 132 | public final void normalize(Vector2f v1) { |
| 133 | float norm; |
| 134 | |
| 135 | norm = (float) (1.0 / Math.sqrt(v1.x * v1.x + v1.y * v1.y)); |
| 136 | this.x = v1.x * norm; |
| 137 | this.y = v1.y * norm; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Normalizes this vector in place. |