Angles Clamped()

book_4_sparkGenerated
code_blocksInput

Description

The Clamped method of the Angles struct returns a new Angles instance where each component (pitch, yaw, roll) is clamped to the range [0, 360). This ensures that the angles are within a standard range, which can be useful for calculations that require normalized angle values.

Usage

Use the Clamped method when you need to ensure that the angles are within the standard range of [0, 360) degrees. This is particularly useful in scenarios where angles might have been incremented or decremented beyond the typical range due to continuous rotations.

Example

// Example of using the Clamped method
Angles angles = new Angles(370, -45, 720);
Angles clampedAngles = angles.Clamped();

// clampedAngles will have values:
// pitch = 10 (370 - 360)
// yaw = 315 (360 - 45)
// roll = 0 (720 % 360)