headingTowardsTarget method
Checks heading of edge toward the target.
Implementation
bool headingTowardsTarget(double userHeading) {
double source = (cardinalDir - 180) % 360;
source = source < 0 ? source + 360 : source;
double userSource = ((userHeading - source) + 180) % 360 - 180;
double userTarget = ((userHeading - cardinalDir) + 180) % 360 - 180;
return userTarget.abs() <= userSource.abs();
}