Skip to content

@technobuddha > library > Geometry > Angle

Function: normalizeAngle()

ts
function normalizeAngle(angle: number, options: UnitOptions): number;

Defined in: normalize-angle.ts:23

Normalizes an angle to be in range 0-1 turns.

Angles outside this range will be normalized to be the equivalent angle with that range. Angles are always returned as radians.

Parameters

ParameterTypeDescription
anglenumberAngle
optionsUnitOptionssee UnitOptions

Returns

number

Standardized angle in radians.

Example

typescript
normalizeAngle(Math.PI); // π
normalizeAngle(2 * Math.PI); // 0
normalizeAngle(180, 'degrees'); // π
normalizeAngle(540, 'degrees'); // π