Hi,
> There are 2 magic numbers in atan2 -> 0x00003240 and 0x0000FB50. Could
> someone explain what they stand for? Additionally, if I could get the
> literature/source algorithm/equations of trigonometric functions used in
> the code, it would be great help.
angle = fix16_mul(0x00003240 , r_3) - fix16_mul(0x0000FB50,r) +
PI_DIV_4;
That looks like a third order polynomial fit to atan2() in some range.
The factors (0x3240/65536 = 0.19, 0xFB50/65536=0.98) are close to Taylor
series approximation (0.33, 1.0), but while Taylor series offers best
fit at x = 0, polynomial fit offers better fit over some defined range.
I do not know exactly what range the polynomial has been optimized to
work over.
--
Petteri