Forum: Ruby formula for a x, y plot

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Shawn B. (Guest)
on 2008-12-20 01:00
(Received via mailing list)
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
Joel VanderWerf (Guest)
on 2008-12-20 01:06
(Received via mailing list)
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.
Shawn B. (Guest)
on 2008-12-20 09:02
(Received via mailing list)
Yes ! that helps a lot,
thanks very much, vjoel !
-sk

On Fri, Dec 19, 2008 at 4:57 PM, Joel VanderWerf
This topic is locked and can not be replied to.