How to find location of a point for a rectangle

353 Views Asked by At

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.

enter image description here

3

There are 3 best solutions below

0
On

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.

0
On

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.

6
On

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)$$