SIGN(ABS(a1 - a2) - 180)>>>
>FUNCTION AzimuthChange > >LPARAMETERS ; > tnAzimuth1 ; > , tnAzimuth2 > >* If we're only concerned about the *change* in Azimuth, >* we can rotate our frame of reference so tnAzimuth1 is always 0 (due north) >* so we can avoid problems with Azimuth changes that span 0 > >LOCAL ; > lnFrameRotation > >* Calculate how much we have to rotate the frame of reference so that m.tnAzimuth1 is at 0 degrees: >m.lnFrameRotation = MOD( 360 - m.tnAzimuth1, 360 ) && MOD() handles case where m.tnAzimuth1 = 0 > >* Add that amount to the second Azimuth: >m.tnAzimuth2 = MOD( m.tnAzimuth2 + m.lnFrameRotation, 360 ) > >RETURN IIF( m.tnAzimuth2 > 180, m.tnAzimuth2 - 360, m.tnAzimuth2 ) >That looks good ! Thank you. All I need to know is that if the returned value is negative I need to go anti-clockwise and vice versa.