Function angles::shortest_angular_distance

Function Documentation

static inline double angles::shortest_angular_distance(double from, double to)

shortest_angular_distance

\function

Given 2 angles, this returns the shortest angular difference. The inputs and ouputs are of course radians.

The result would always be -pi <= result <= pi. Adding the result to “from” will always get you an equivelent angle to “to”.