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

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);
}