Set this quaternion to be a representation of the supplied axis and angle (in radians). @param angle the angle in radians @param axisX the x-coordinate of the rotation axis @param axisY the y-coordinate of the rotation axis @param axisZ the z-coordinate of the rotation axis @return this
(double angle, double axisX, double axisY, double axisZ)
| 325 | * @param axisZ the z-coordinate of the rotation axis |
| 326 | * @return this |
| 327 | */ |
| 328 | public Quat setAngleAxis(double angle, double axisX, double axisY, double axisZ) { |
| 329 | double hangle = angle / 2.0; |
| 330 | double sinAngle = Math.sin(hangle); |
| 331 | double vLength = Math.sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ); |
| 332 | |
| 333 | x = axisX / vLength * sinAngle; |
| 334 | y = axisY / vLength * sinAngle; |
| 335 | z = axisZ / vLength * sinAngle; |
| 336 | w = Math.cos(hangle); |
| 337 | |
| 338 | return this; |
| 339 | } |
| 340 | |
| 341 | /** |
no test coverage detected