# How to find location of a point for a rectangle

I have a circle with a line that is drawn through it at two points. I have the coordinate for the center of the circle, the two coordinates where it intersects the circle and the radius as well. I want to put the two rectangles around the two pieces from the circle, as shown by the green marking. My question is how can I get the coordinates of the rectangle? Any help would be appreciated

One of the things i considered using was the midpoint formula to find the middle coordinate between the intercepting points and then I can find the distance.

## 3 Answers

Assuming the center to be the origin, compute $r-\Big\Vert \frac{A+B}2 \Big\Vert$. This is the amount of offset needed. The direction is given by $\frac{A+B}2$, so the complete formula is $$O = \frac{r-\left\Vert\frac{A+B}2\right\Vert}{\left\Vert\frac{A+B}2\right\Vert} \frac{A+B}2 = \frac{2r - \Vert A+B\Vert}{2\Vert A+B\Vert} (A+B)$$

• are A and B those intersecting points? I can calculate the distance apart for those little pieces in between the circle to the point of the rectangle, but I'm not sure about the coordinates because the cut can be made at an angle – Masterminder Mar 9 '14 at 17:50
• $A$ and $B$ are the coordinates of the two intersection points. The other points of the rectangle are given by $A' = A+O$ and $B'=B+O$, all the points are two-coordinate vectors and $\Vert P \Vert = \sqrt{P_1^2+P_2^2}$. The Angle of $\overline{AB}$ is irrelevant to the question. – AlexR Mar 9 '14 at 17:52
• so A' and B' would be the two co-ordinates on the blue line correct from my understanding? – Masterminder Mar 9 '14 at 18:00
• @Masterminder No, $A'$ and $B'$ will be the corners of the rectangle not on the circle (Green). $A$ and $B$ are the red-circled points in your sketch. – AlexR Mar 9 '14 at 18:02
• Yes but they will lie on the blue line correct? The line divides the circle and those rectangles start where the blue line is. Do you know what I mean? – Masterminder Mar 9 '14 at 18:07

Hint : find the angular coefficient of the line between the points $A$ and $B$ $\left( m = \frac{A_y-B_y}{A_x-B_x}\right)$ and $q$ (where the line crosses the y-axis), and solve the system of the equation of the circle and the line, letting $\Delta = 0$. Let $(C_x,C_y)$ be the centre of the circle, and $r$ its radius...

\begin{cases} (x-C_x)^2+(y-C_y)^2=r^2 \\ y=mx+q \\ \end{cases} Let $\Delta = 0$, because if $\Delta \gt 0$ there are 2 solutions $\to$ there are 2 common points between the line and the circle, otherwise $\Delta \lt 0$ there are no intersections.

Find equation of the blue line and that of the circle(shift origin here or it will get a bit nasty) and add an arbitrary constant to it and put in equation of circle retaining only x terms.

You will get a quadratic equation. Set discriminant to be 0 as you want only 1 point of contact with circle(tangent)

Knowing this point, You can find its equation and equation of other lines as you know their slopes/points. You will get 2 values of arbitrary constants up there corresponding to 2 rectangles.