# Formula for a x, y plot

hey there all,

ok, not really a ruby question, but did not know where to look.
i have a circle on a graph paper.
if i know the x and y of a point on the graph, if the center is at
0,0, and i know the radius,
how can i find the angle that the point will be on the circumference?
somewhere between 1-360.

would appreciate any tips, thanks
ok, if it is really against the grain to post this question here,
anyone have a recommendation of where to put it?
thanks all

sk

shawn bright wrote:

ok, if it is really against the grain to post this question here,
anyone have a recommendation of where to put it?
thanks all

sk

irb(main):007:0> Math.atan2(-1.0, -1.0)*180/Math::PI % 360
=> 225.0
irb(main):008:0> Math.atan2(-1.0, 1.0)*180/Math::PI % 360
=> 315.0
irb(main):009:0> Math.atan2(1.0, 1.0)*180/Math::PI % 360
=> 45.0
irb(main):010:0> Math.atan2(1.0, -1.0)*180/Math::PI % 360
=> 135.0

HTH.

Yes ! that helps a lot,
thanks very much, vjoel !
-sk

On Fri, Dec 19, 2008 at 4:57 PM, Joel VanderWerf