Hallo Melody,
my english is not so good, but i start.
We have a Point P, the coordinate is ( x,y ). So we have P(x,y).
The question is, what is the angle from the x-axis to that Point (we call the angle also polar angle ). See: https://en.wikipedia.org/wiki/Polar_coordinate_system
The formula for the angular coordinate is : α=arctan(ypxp) or α=atan(ypxp)
But this formula does not calculate the angle correctly. We have the same angle in the Quadrant ( I and III ) and in the Quadrant ( II and IV ).
Why?
Because +yp+xp=−yp−xp=+ypxp and +yp−xp=−ypxp=−ypxp
If we divide y by x, the information about the quadrant has disappeared.
But we can see:
Point in the I. Quadrant yp>0 and xp>0Point in the II. Quadrant yp>0 and xp<0Point in the III. Quadrant yp<0 and xp<0Point in the IV. Quadrant yp<0 and xp>0
We must correct the angular coordinate afterwards.
and if y or x is zero, we must put constants:
yp=0 and xp>0α=0 yp>0 and xp=0α=π2 yp=0 and xp<0α=π yp<0 and xp=0α=32π
We have succeed, there is a function which takes this work from us!
The funktion is atan2
and needs two parametres yp and xp
The new formula for the angular coordinate is : α=atan2(yp,xp)
You can also use atan2, see examples below, to get the angle in the quadrant (I, II, III, and IV):
Formula:α=atan2 (Δy,Δx)
Examples:
http://web2.0rechner.de/#atan2(1,1) α=45 degreesQuadrant I
http://web2.0rechner.de/#atan2(1,-1) α=135 degreesQuadrant II
http://web2.0calc.com/#atan2(-1,-1) α=−135 degreesQuadrant III
http://web2.0rechner.de/#atan2(-1,1) α=−45 degreesQuadrant IV
Click the "=" Button in the link
Thanks Heureka,
I have never seen this before. I am going to try it too :))
I am trying to use acos(0.5) your way and get the different quadrant answers but it is not working for me.
Can you show me how to do this please Heureka ?
Hallo Melody,
my english is not so good, but i start.
We have a Point P, the coordinate is ( x,y ). So we have P(x,y).
The question is, what is the angle from the x-axis to that Point (we call the angle also polar angle ). See: https://en.wikipedia.org/wiki/Polar_coordinate_system
The formula for the angular coordinate is : α=arctan(ypxp) or α=atan(ypxp)
But this formula does not calculate the angle correctly. We have the same angle in the Quadrant ( I and III ) and in the Quadrant ( II and IV ).
Why?
Because +yp+xp=−yp−xp=+ypxp and +yp−xp=−ypxp=−ypxp
If we divide y by x, the information about the quadrant has disappeared.
But we can see:
Point in the I. Quadrant yp>0 and xp>0Point in the II. Quadrant yp>0 and xp<0Point in the III. Quadrant yp<0 and xp<0Point in the IV. Quadrant yp<0 and xp>0
We must correct the angular coordinate afterwards.
and if y or x is zero, we must put constants:
yp=0 and xp>0α=0 yp>0 and xp=0α=π2 yp=0 and xp<0α=π yp<0 and xp=0α=32π
We have succeed, there is a function which takes this work from us!
The funktion is atan2
and needs two parametres yp and xp
The new formula for the angular coordinate is : α=atan2(yp,xp)