Quick and easy atan2?

Status
Not open for further replies.

echo47

Advanced Member level 6
Joined
Apr 7, 2002
Messages
3,933
Helped
638
Reputation
1,274
Reaction score
90
Trophy points
1,328
Location
USA
Activity points
33,176
Hi guys,

Is there a quick and easy approximation to arctangent2(y,x) that is simpler than CORDIC (what I'm using now) and accurate to within a few degrees? My x and y inputs are 16-bit signed integers. I want a 16-bit result that goes from 0 to 65535 as the angle goes from 0 to 360 degrees. I don't mind some decreased accuracy when x and y are both small.

I already have a satisfactory approximation for my magnitude calculation:
Instead of sqrt(x*x + y*y), I use 0.95 * max(x,y) + 0.387 * min(x,y).
That is accurate to about one percent, and is easy to pipeline in Virtex II. Of course I scale it into integer arithmetic.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…