View Single Post
  #2   Spotlight this post!  
Unread 12-01-2006, 10:34
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Trig functions and type conversion

Quote:
Originally Posted by kaszeta
In short, if I calculate the angle using the atan() function, the results work when y>0, but give incorrect and discontinous results if y<0.
That's just the nature of arc tangents. You need to determine which quadrant you're in and offset the answer accordingly. Some trig libraries provide an atan2() function that deals with the issue for you.