Simple one. You know how if you know an angle (0-360) and a radius you can work out the x and y coords of the edge or a circle e.g.
x = r * cos(angle)
y = r * sin(angle)
Well how to you go backwards to work the angle if you know the x and y? I know if it was a nice little right angled triangle WITH POSTITVE COORDS you'd go:
angle = acos(x/r)
or
angle = asin(y/r)
And you work out r as sqr(x*x+y*y). Well here's the problem, what if x or y are negative? Then when you work out r, r will always end up positive due the a minus*minus=positive. So it'll always give you angles in the postive quadrant.
Do you have to just work out which quadrant it's in and tweak the resulting angle by 90 degrees or whatever, or is there a better way, like with using Matrix maths?
Thanks!
x = r * cos(angle)
y = r * sin(angle)
Well how to you go backwards to work the angle if you know the x and y? I know if it was a nice little right angled triangle WITH POSTITVE COORDS you'd go:
angle = acos(x/r)
or
angle = asin(y/r)
And you work out r as sqr(x*x+y*y). Well here's the problem, what if x or y are negative? Then when you work out r, r will always end up positive due the a minus*minus=positive. So it'll always give you angles in the postive quadrant.
Do you have to just work out which quadrant it's in and tweak the resulting angle by 90 degrees or whatever, or is there a better way, like with using Matrix maths?
Thanks!