Set this quaternion to be a representation of the supplied axis and angle (in radians). @param axis the rotation axis @param angle the angle in radians @return this
(Vec3 axis, double angle)
| 484 | * @param angle the angle in radians |
| 485 | * @return this |
| 486 | */ |
| 487 | public Quat fromAxisAngleDeg(Vec3 axis, double angle) { |
| 488 | double hangle = Math.PI*(angle/180.0) / 2.0; |
| 489 | double sinAngle = Math.sin(hangle); |
| 490 | double vLength = axis.length(); |
| 491 | |
| 492 | x = axis.x / vLength * sinAngle; |
| 493 | y = axis.y / vLength * sinAngle; |
| 494 | z = axis.z / vLength * sinAngle; |
| 495 | w = Math.cos(hangle); |
| 496 | |
| 497 | return this; |
| 498 | } |
| 499 | |
| 500 | /** |
no test coverage detected