bool AlmostEqual( Rotation& r, float delta )

robot_2Generated
code_blocksInput

Description

The AlmostEqual method is used to determine if two Rotation instances are approximately equal within a specified tolerance. This is useful in scenarios where exact equality is not feasible due to floating-point precision limitations.

Usage

To use the AlmostEqual method, you need to have two Rotation instances. You will call this method on one of the instances, passing the other instance and a tolerance value as parameters. The method will return true if the two rotations are approximately equal within the specified tolerance, otherwise it will return false.

Example

// Example usage of the AlmostEqual method
Rotation rotation1 = Rotation.FromAxis(new Vector3(1, 0, 0), 45);
Rotation rotation2 = Rotation.FromAxis(new Vector3(1, 0, 0), 45.1f);

float tolerance = 0.2f;
bool areAlmostEqual = rotation1.AlmostEqual(ref rotation2, tolerance);

// areAlmostEqual will be true if the difference between rotation1 and rotation2 is less than or equal to 0.2 degrees.