* Sets a quat from the given angle and rotation axis, * then returns it. * * @param {quat} out the receiving quaternion * @param {ReadonlyVec3} axis the axis around which to rotate * @param {Number} rad the angle in radians * @returns {quat} out
(out, axis, rad)
| 3969 | **/ |
| 3970 | |
| 3971 | function setAxisAngle(out, axis, rad) { |
| 3972 | rad = rad * 0.5; |
| 3973 | var s = Math.sin(rad); |
| 3974 | out[0] = s * axis[0]; |
| 3975 | out[1] = s * axis[1]; |
| 3976 | out[2] = s * axis[2]; |
| 3977 | out[3] = Math.cos(rad); |
| 3978 | return out; |
| 3979 | } |
| 3980 | /** |
| 3981 | * Gets the rotation axis and angle for a given |
| 3982 | * quaternion. If a quaternion is created with |