Appearance
Rotation
Rotation represented as a quaternion
Can be created from euler angles or quaternion components. Use Rotation.slerp() for smooth interpolation between rotations.
Example:
javascript
// From euler angles (radians)
var rot = Rotation(0, Math.PI / 2, 0); // 90° around Y
// From quaternion
var rot = Rotation.quaternion(0, 0.707, 0, 0.707);
// Interpolate between rotations
var mid = Rotation.slerp(rotA, rotB, 0.5);Properties
eulerAngles
- Type: Vector3
- Euler angles in radians (x, y, z)
quaternion
- Type: Vector4
- Quaternion components (x, y, z, w)
Methods
create()
javascript
create(): RotationCreate identity rotation (no rotation)
Returns: Rotation
inverse()
javascript
inverse(r: Rotation): RotationGet the inverse (conjugate) of a rotation
Parameters:
Returns: Rotation
inverse()
javascript
inverse(): RotationGet the inverse of this rotation
Returns: Rotation
multiply()
javascript
multiply(r1: Rotation, r2: Rotation): RotationMultiply two rotations (compose)
Parameters:
Returns: Rotation
multiply()
javascript
multiply(other: Rotation): RotationMultiply (compose) with another rotation
Parameters:
other(Rotation) - Rotation to apply after this one
Returns: Rotation
slerp()
javascript
slerp(r1: Rotation, r2: Rotation, t: number): RotationSpherically interpolate between two rotations
Parameters:
Returns: Rotation
slerp()
javascript
slerp(other: Rotation, t: number): RotationSpherically interpolate to another rotation
Parameters:
other(Rotation) - Target rotationt(number) - Interpolation factor (0-1)
Returns: Rotation