[gameprogrammer] Re: Diff Between 2 Angles

  • From: "Peter M." <plm@xxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Thu, 29 Sep 2005 09:10:55 -0700

Stephen wrote:

The main problem is when dealing with negative angles, angles > 360, and also getting the shortest distance (i.e. not the long way round). For example, the difference between -359 and 359 should be 2 degrees. The difference between 90 and -270 should be zero. Etc.. etc.. Can anyone help please?


Do you want the absolute difference between angles or do you want to preserve the direction of the difference? For example, should diff(190,5) give 85 or 185? What about diff(5,190)?


Peter


--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: