Skip to main content
GameDev.net gamedev.net
🔒 Locked

fast atan2

Started by minorlogic May 21, 2003 at 2:58 AM 4 replies 3.7k views
Original Post
minorlogic
minorlogic
It is used in a projection transformation ( spherical) What are you think about this approximation ? (Here is without sign respect.) double norm_atan( double M) {// very close to line curve return atan2( M , (1.0 - M ) ); } double norm_atan_appx( double t ) {// polinomial approximation return ((- 1.618679f*t + 2.428018f)*t + 0.761457f)*t; // return (((0.000004f*t - 1.513571f)*t + 2.270356f)*t + 0.814012f)*t; // return (((2.982346f*t - 7.456024f)*t + 5.000778f)*t - 0.045103f)*t + 1.088759f)*t; } double appx_atan2( double A, double B ) { //return norm_atan( A/(A + B) ); // return norm_atan_appx( A/(A + B) ); }
vanillacoke
vanillacoke
What are you trying to do? Are you trying to make a function that returns the angle of a cartesian point? Or are you trying to make a fast atan function?
You know what I never noticed before?
Andos
Andos
atan2 is the funtion to return the actual angle between two points. He asks for the fastest way to calculate this...
vanillacoke
vanillacoke
What is "the angle between two points?" Do you mean the angle between two vectors, or what?
You know what I never noticed before?
minorlogic
minorlogic
I talk about standart "atan2" function. So "appx_atan2( double A, double B )" work as a standart "atan2" and return angle in radians.

In my work i use it in a spherical to rectlinear conversion.

But if you know the fast methods of that conversion, let me know please!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.