• Advertisement
Sign in to follow this  

Computing arctangent

This topic is 4919 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to find the arctangent of a dx and dy, so that the angle returned is in the appropriate quadrant. So far I have been using a lookup table of the tangent of the first 180 degrees and doing a binary search through that, and using symmetry if dy is negative. Is this the fastest way to do it?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
If you use C/C++, you can use atan2(y,x), it will return with the correct sign.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
dx/dy gives you the slope of the line. Times that by 90 to get the angle, no?

Share this post


Link to post
Share on other sites
No, the angle varies from the slope in an oddly shaped curve, not a straight line.
Otherwise we'd have a lot less problems optimising sine and cosine!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement