Angular distance

From vegard.wiki
Revision as of 07:27, 26 December 2019 by Vegard (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Shortest angular distance between two angles, in radians (always positive):

// https://gamedev.stackexchange.com/a/4472
float delta_angle(float a0, float a1)
{
    return M_PI - fabs(fabs(a1 - a0) - M_PI);
}