Description
The Clamped
method of the Angles
struct returns a new Angles
instance where each component (pitch, yaw, and 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 angles.
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 this 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 (since -45 + 360 = 315)
// roll = 0 (720 % 360)