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]
(Vector3d v1)
| 182 | * @return the angle in radians in the range [0,PI] |
| 183 | */ |
| 184 | public final double angle(Vector3d v1) { |
| 185 | double vDot = this.dot(v1) / (this.length() * v1.length()); |
| 186 | if (vDot < -1.0) vDot = -1.0; |
| 187 | if (vDot > 1.0) vDot = 1.0; |
| 188 | return Math.acos(vDot); |
| 189 | } |
| 190 | |
| 191 | |
| 192 | } |