Wednesday 6 March 2013

geometry - Draw the line segment joining the centers of two circles. Where does it meet the circles?



I'm trying to construct a line segment between two circles. Given each radius and $x$, $y$ center of each circle, how can I find the endpoints for the blue line segment?



enter image description here


Answer



Let the centres of the two circles be $(x_1, y_1)$ and $(x_2, y_2)$, where either $x_1 < x_2$ or $x_1 = x_2$ and $y_1 < y_2$, and radii $r_1$, $r_2$.




Suppose $x_1 = x_2$. In this case, the blue line segment is vertical, and its endpoints can easily be seen to be $(x_1, y_1 + r_1)$ and $(x_2, y_2 - r_2) = (x_1, y_2 - r_2)$.



Now suppose $x_1 < x_2$. By shifting horizontally and vertically, we can assume the two circles are centred at $(0, 0)$ and $(a, b)$ $a = x_2 - x_1$ and $b = y_2 - y_1$. The slope of the line passing through the two centres is $b/a$; note, $a \neq 0$ as $x_1 \neq x_2$. As the $y$-intercept of the line is $0$, the equation of the line which passes through them is $y = \frac{b}{a}x$; note that the endpoints of the blue line segment lie on this line.



As can be see from the right-angled triangle in the image below, $\sin\theta = \frac{b}{\sqrt{a^2+b^2}}$, $\cos\theta=\frac{a}{\sqrt{a^2+b^2}}$, and $\tan\theta = \frac{b}{a}$ where $\theta$ is the angle the line $y = \frac{b}{a}x$ makes with the positive $x$-axis.



$\hspace{37mm}$



In order to determine the first endpoint of the blue line segment, consider the following image.




$\hspace{37mm}$



The coordinates of the first endpoint are $(a_1, b_1)$; we just need to determine what $a_1$ and $b_1$ are. Note that $R_1 = r_1$, so using the small right-angled triangle, we see that $\cos\theta = \frac{a_1}{r_1}$ so $a_1 = r_1\cos\theta$; likewise, $b_1 = r_1\sin\theta$.



In order to determine the second endpoint of the blue line segment, consider the following image.



$\hspace{37mm}$



The coordinates of the second endpoint are $(a_2, b_2)$; we just need to determine what $a_2$ and $b_2$ are. Note that $R_2 = \sqrt{a^2 + b^2} - r_2$, so using the smaller of the two right-angled triangles, we get the following expressions for $a_2$ and $b_2$ as we did above: $a_2 = (\sqrt{a^2 + b^2} - r_2)\cos\theta$, $b_2 = (\sqrt{a^2 + b^2} - r_2)\sin\theta$.




Combining the information deduced from the three images above, we see that, after a little bit of algebra, the endpoints of the blue segment are



$$\left(\frac{ar_1}{\sqrt{a^2 + b^2}}, \frac{br_1}{\sqrt{a^2+b^2}}\right)\ \text{and}\ \left(a\left(1 - \frac{r_2}{\sqrt{a^2 + b^2}}\right), b\left(1 - \frac{r_2}{\sqrt{a^2 + b^2}}\right)\right).$$



We can undo the original horizontal and vertical shifts we did at the beginning and well as express $a$ and $b$ in terms of the original data to obtain the endpoints



$$\left(x_1 + \frac{(x_2 - x_1)r_1}{\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}}, y_1 + \frac{(y_2 - y_1)r_1}{\sqrt{(x_2 - x_1)^2+(y_2 - y_1)^2}}\right)$$



$$\text{and}$$




$$\left(x_2 - \frac{(x_2 - x_1)r_2}{\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}}, y_2 - \frac{(y_2 - y_1)r_2}{\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}}\right).$$



Note, these formulae give the correct endpoints even in the case where $x_1 = x_2$.


No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...