Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI]. @param v1 the other vector @return the angle in radians in the range [0,PI]
(Vector2f v1)
| 158 | * @return the angle in radians in the range [0,PI] |
| 159 | */ |
| 160 | public final float angle(Vector2f v1) { |
| 161 | double vDot = this.dot(v1) / (this.length() * v1.length()); |
| 162 | if (vDot < -1.0) vDot = -1.0; |
| 163 | if (vDot > 1.0) vDot = 1.0; |
| 164 | return ((float) (Math.acos(vDot))); |
| 165 | } |
| 166 | |
| 167 | |
| 168 | } |