Skip to content

@ue-too/math / index / normalizeAngleZero2TwoPI

関数: normalizeAngleZero2TwoPI()

normalizeAngleZero2TwoPI(angle): number

定義: index.ts:688

Normalizes an angle to the range [0, 2π).

パラメータ

angle

number

Angle in radians (can be any value)

戻り値

number

Normalized angle between 0 and 2π

Remarks

This function wraps any angle to the range [0, 2π) by taking the modulo and ensuring the result is positive.

typescript
normalizeAngleZero2TwoPI(Math.PI * 3); // π (180 degrees)
normalizeAngleZero2TwoPI(-Math.PI / 2); // 3π/2 (270 degrees)
normalizeAngleZero2TwoPI(0); // 0