# Finding the radius of a rectangle based on a given x,y coordinate.

Is it possible to find the radius of a rectangle based on a given x and y coordinate?

If so, how is the achieved.

I'm trying to create a rectangle in C++ ( using OpenGL ), and would like to obtain the formula for the radius of a Rectangle based on its center.

-
What's the radius of a rectangle?? – Hans Lundmark Jan 15 '12 at 8:37
It would be really helpful to have a specific example of what you know and what you want to know—a picture showing which measurements you know and what point and measurements you're trying to find would probably help a lot. – Isaac Jan 15 '12 at 17:12

1 point is not enough to determine a unique rectangle. If the radius of a rectangle means the distance of a point on the perimeter of a rectangle from its center in terms of the angle anticlockwise from the horizontal, and the rectangle has a corner (x,y) and centre (0,0) and sides parallel to the x and y axis, then

$r=\frac{y}{\sin \theta}$ for $a\leq\theta\leq \pi-a$ or $\pi+a\leq\theta\leq 2\pi-a$

$r=\frac{x}{\cos \theta}$ for $\pi -a\leq\theta\leq \pi+a$ or $-a\leq\theta\leq a$

-
are those fors comparable to for loops in programming? – about blank Jan 15 '12 at 9:14
No, it describes a case distinction. In fact, in programming terms, you can read it as an "if" statement. – Johannes Kloos Mar 15 '12 at 9:04