Algorithms that convert x and y value to an angle (degrees or radian.

Posted 21 February 2013 - 02:58 AM

Hi i am new on the forum. I am making a smartphone application and this is the first time i’m working with algorithms.
I am looking for algorithms that can convert x and y value on a Cartesian plane (x,y) to an angle. The angle can be 0-360 degrees or 0-2π radian.

Does anyone know of such algorithms?
I have looked for geometric algorithms on Google. I have also found a list of algorithms on Wikipedia, but no luck finding this particular algorithm.
Also are there search databases that solely contain algorithms?
Thank you in Advance.

Re: Algorithms that convert x and y value to an angle (degrees or radian.

Posted 21 February 2013 - 08:30 AM

You should know about vectors. These are the primary representations that we use to calculate angles, or more precisely, the relationship and manipulation a of arbitrary points in either 2D or 3D space.

Re: Algorithms that convert x and y value to an angle (degrees or radian.

Posted 21 February 2013 - 08:45 AM

ButchDean, on 21 February 2013 - 08:30 AM, said:

You should know about vectors. These are the primary representations that we use to calculate angles, or more precisely, the relationship and manipulation a of arbitrary points in either 2D or 3D space.

Re: Algorithms that convert x and y value to an angle (degrees or radian.

Posted 17 March 2013 - 07:48 AM

Is it so hard to give direct answer to my question?

"No i don't know any algorithms"

I'm doing a application Android application test. I'm testing battery use and speed of algorithms using different sensors.
I have already made 2 algorithms myself and collected 4 algorithms from forums and researchliterature.

So i'm done. Despite the unneccesary discussion, thank you for your time.

ButchDean, on 22 February 2013 - 12:21 PM, said:

Well, when I suggested linear algebra you said I was overthinking it. Go figure.

Re: Algorithms that convert x and y value to an angle (degrees or radian.

Posted 17 March 2013 - 10:55 AM

Try researching "Complex Conjugate" and Complex numbers. More specifically "Agrand Diagrams". The only info I have is on my unis portal so I can't link you but there should be plenty of other info out there!

In the context of your question, the math and algorithms are one and the same. An algorithm is just a finite series of steps that return a specific result. As such, the math falls under the scope of an algorithm here. The inverse trig functions return angles, and are defined on restricted domains. You can get the correct values on all the domains by breaking them up piecewise and compensating appropriately. That's how the atan2() function works, as well as your approach with inverse cosine. You could play around with inverse sine in the same way.