# Formula for a x, y plot

**URL:** <https://www.ruby-forum.com/t/formula-for-a-x-y-plot/156070>\
**Category:** Ruby\
**Created:** [December 20, 2008, 12:00am UTC](https://www.ruby-forum.com/t/formula-for-a-x-y-plot/156070 "2008-12-20T00:00:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nephish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/8e7dd6/32.png) [@nephish](https://www.ruby-forum.com/u/nephish)\
**Post date:** [December 20, 2008, 12:00am UTC](https://www.ruby-forum.com/t/formula-for-a-x-y-plot/156070/1 "2008-12-20T00:00:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nephish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/8e7dd6/32.png) [@nephish](https://www.ruby-forum.com/u/nephish)\
**Post date:** [December 20, 2008, 12:06am UTC](https://www.ruby-forum.com/t/formula-for-a-x-y-plot/156070/2 "2008-12-20T00:06:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nephish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/8e7dd6/32.png) [@nephish](https://www.ruby-forum.com/u/nephish)\
**Post date:** [December 20, 2008, 8:02am UTC](https://www.ruby-forum.com/t/formula-for-a-x-y-plot/156070/3 "2008-12-20T08:02:50Z")

</div>

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

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