[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

formula for a x, y plot

shawn bright

12/19/2008 10:52:00 PM

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

2 Answers

Joel VanderWerf

12/19/2008 10:58:00 PM

0

shawn bright wrote:
> 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

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.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

shawn bright

12/20/2008 6:54:00 AM

0

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

On Fri, Dec 19, 2008 at 4:57 PM, Joel VanderWerf
<vjoel@path.berkeley.edu> wrote:
> shawn bright wrote:
>>
>> 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
>
> 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.
>
> --
> vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
>
>