Skip to content

Documentation / @interstellar-tools/equations / rot3

Function: rot3() ​

ts
function rot3(theta: Radians): Matrix3x3Type;

Defined in: helpers/rot-3.ts:38

Construct a right-handed rotation matrix about the z-axis (often written R₃).

This returns the 3×3 direction cosine matrix (DCM) for an active rotation by angle theta around the +Z axis:

R3(θ)=[cos⁡θ−sin⁡θ0sin⁡θcos⁡θ0001]

Notes:

  • theta is in radians.
  • Matrix layout is row-major: M[row][col].
  • Common in 3-1-3 / 3-2-1 rotation sequences (e.g., IAU pole + prime meridian rotations) and general 3D coordinate transforms.

Parameters ​

ParameterTypeDescription
thetaRadiansRotation angle (θ) in radians (finite).

Returns ​

Matrix3x3Type

3×3 rotation matrix (R3(θ)) (row-major).

Throws ​

If theta is not a finite number.

Example ​

ts
// Rotate about +Z by 90°:
const R = rot3(Math.PI / 2);