this one is empirical, i started from 0.25 and moved around
change const2 to 1.0 to get result in radians (I personally prefer working in degrees)
this one here just means "quarter circle" so pi/4 or 90 degrees
main formula
the sign-related stuff can be done very quickly with some if or case statements
note that there is only 1 division.
tweak these to see what happens (here's the mathcad file)
Worst case scenario we're off by about 0.25 degrees. This is sufficient for navigation
if waypoints are closely spaced.
use for sailboat hull shapes?
error in degrees over range
comparison between atan2 and its approximation