YawPitchRollAngles Class

Three angles that determine the orientation of an object in space. Sometimes referred to as Tait–Bryan angles.

  • The matrix construction can be replicated by this logic:
  • xyz coordinates have
    • x forward
    • y to left
    • z up
    • Note that this is a right handed coordinate system.
    • yaw is a rotation of x towards y, i.e. around positive z:
      • yawMatrix = Matrix3d.createRotationAroundAxisIndex(2, Angle.createDegrees(yawDegrees));
    • pitch is a rotation that raises x towards z, i.e. rotation around negative y:
      • pitchMatrix = Matrix3d.createRotationAroundAxisIndex(1, Angle.createDegrees(-pitchDegrees));
    • roll is rotation of y towards z, i.e. rotation around positive x:
      • rollMatrix = Matrix3d.createRotationAroundAxisIndex(0, Angle.createDegrees(rollDegrees));
    • The YPR matrix is the product
      • result = yawMatrix.multiplyMatrixMatrix(pitchMatrix.multiplyMatrixMatrix(rollMatrix));
    • Note that this is for "column based" matrix, with vectors appearing to the right
      • Hence a vector is first rotated by roll, then the pitch, finally yaw.


Name Description
constructor(yaw: Angle = Angle.zero(), pitch: Angle = Angle.zero(), roll: Angle = Angle.zero()): YawPitchRollAngles    
clone(): YawPitchRollAngles Make a copy of this YawPitchRollAngles.  
freeze(): void Freeze this YawPitchRollAngles  
isAlmostEqual(other: YawPitchRollAngles): boolean * Compare angles between this and other.  
isIdentity(allowPeriodShift: boolean = true): boolean Returns true if this rotation does nothing.  
maxAbsDegrees(): number Return the largest angle in degrees.  
maxAbsRadians(): number Return the largest angle in radians  
maxDiffRadians(other: YawPitchRollAngles): number Return the largest difference of angles (in radians) between this and other  
setFrom(other: YawPitchRollAngles): void Install all rotations from other into this.  
setFromJSON(json?: YawPitchRollProps): void populate yaw, pitch and roll fields using Angle.fromJSON  
sumSquaredDegrees(): number Return the sum of squared angles in degrees.  
sumSquaredRadians(): number Return the sum of the angles in squared radians  
toJSON(): YawPitchRollProps Convert to a JSON object of form { pitch: 20 , roll: 29.999999999999996 , yaw: 10 }.  
toMatrix3d(result?: Matrix3d): Matrix3d Expand the angles into a (rigid rotation) matrix.  
createDegrees(yawDegrees: number, pitchDegrees: number, rollDegrees: number): YawPitchRollAngles Static constructor for YawPitchRollAngles with angles in degrees.  
createFromMatrix3d(matrix: Matrix3d, result?: YawPitchRollAngles): YawPitchRollAngles | undefined Static Attempts to create a YawPitchRollAngles object from an Matrix3d  
createRadians(yawRadians: number, pitchRadians: number, rollRadians: number): YawPitchRollAngles Static constructor for YawPitchRollAngles with angles in radians.  
fromJSON(json?: YawPitchRollProps): YawPitchRollAngles Static construct a YawPitchRoll object from an object with 3 named angles  
tryFromTransform(transform: Transform): object Static Return an object from a Transform as an origin and YawPitchRollAngles.  


Name Type Description
pitch Angle The pitch angle.  
roll Angle The roll angle.  
yaw Angle The yaw angle.  

Defined in

Last Updated: 05 June, 2020