Jon Berndt writes:
> 
> Does anyone know of a simple algorithm to calculate the difference between
> the desired heading and the actual heading, where the angle is given in
> degrees from 0 to 260? The stipulations are that the result must be <= 180.
> For example, you can go from 60 to 340 degrees (counter-clockwise), 110 to
> 280 (clockwise), 290 to 40 (clockwise), etc.  The desired result in the
> first case is -80, in the second case, 170, and for the last case, 110.  And
> so on ...

see $SIMGEAR / simgear / sg_inlines.h

SG_NORMALIZE_RANGE( Desired - Actual, -180.0, 180.0 );

Norman

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to