4
$\begingroup$

I am familiar with the basics of atan2. The doubt I have in the computation of atan2 came across from an image processing sofware.

This is a portion of the code segment when x>y. x and y are absolute values.

const_1 = 57.2836266;

const_2 = -18.6674461;

const_3 = 8.91400051;

const_4 = -2.53972459;

c = sqrt(y/x);

c2 = c*c;

angleInTheta = (((const_4*c2 + const_3)*c2 + const_2)*c2 + const_1)*c;

What confuses me is the formula of angleInTheta. The results are perfectly correct when applied. I would like to know get a brief explanation of this formula.

Thanks,

1 Answers 1

5

This produces a not-too-bad approximation to $\dfrac{180}{\pi} \arctan(\sqrt{y/x})$ for $0 < y < x$. I suppose the $x$ and $y$ are squares of the actual coordinate values. If you call your function $f(\sqrt{y/x})$, it appears that $f(t)/t$ is close to a best uniform approximation of $\dfrac{180}{\pi} \dfrac{\arctan(t)}{t}$ on the interval $[-1,1]$ by polynomials of degree $6$. That best approximation would have coefficients 57.28492047, -18.69087134, 8.976572844, 2.581481000, according to Maple.

  • 0
    Thanks Robert and Harald for the help. The links helped me to have a jump start in this field. Though I stumbled upon this unknowingly, the approximations fascinated me and I started digging through this field of mathematics! :)2012-06-19