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 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 modified or calculated in a way that results in values outside this range.
Example
// Example of using the Clamped method
Angles angles = new Angles(370, -45, 720);
Angles clampedAngles = angles.Clamped();
// clampedAngles will have values within the range [0, 360)
// clampedAngles.pitch will be 10
// clampedAngles.yaw will be 315
// clampedAngles.roll will be 0