elvout / cs393r

CS 393R Graduate Autonomous Robots, Fall 2021 | Autobots
0 stars 0 forks source link

Add two new angle functions to `math_utils` #51

Closed elvout closed 3 years ago

elvout commented 3 years ago

This PR introduces two new angular functions.

math_util::ConstrainAngle

Constrains a finite, non-NaN angle to the range [0, 2PI).

I did some basic benchmarking, and it seemed that the second std::fmod performs just as well as a branch to determine if the angle is positive or negative.

math_util::ReflexToConvexAngle

Converts a finite, non-NaN angle to its negative convex equivalent if the angle is reflex. (See #50).


Closes #50