2
$\begingroup$

In a cartesian system I have 2 lines (an input and an output) and want to find the radius (r) and centre (c1, c2) of the two circles of equal radius that are touched tangentially at the end point of the input line (p1) and the start point of the output line (p2), and touch each other tangentially. The desired outcome is that a smooth path will be possible from the input line, onto the first circle, onto the second circle where they touch and then onto the output line.

I got part way through a solution but failed: Assuming that I can work out the direction of the lines perpendicular to input/output lines (d1, d2) that the circles' centres should lie on to give the optimal (smallest radius) solution, I noted that sliding c1 and c2 along these lines by an amount (t) would give the correct result (t = r) when the distance between c1 and c2 was 2t.

c1 = p1 + t * d1 c2 = p2 + t * d2 |c1 c2| = 2t 

This all seems correct to me, but my method of solving it from there involved making a quadratic equation and solving for t. For my simple test data (below) this resulted in a division by zero and taking the root of a negative number (it is possible that I expanded incorrectly, but have checked several times and can't find the error).

Sample data:

p1 = (0,0) p2 = (5,2) d1 = (1,0) d2 = (-1,0) 

I am looking for either a quadratic equation that works or an entirely different method of working it out, I'm just after a generalised solution (I can find a solution for the sample data through trig but I don't know of a trig method that generalises well).

  • 0
    It's still not very clear, $p_1$ and $p_2$ are start _end_ point of _both_ lines? Or do you mean: you have two lines parallel to the $x$-axis (or line segments, but this should change your situation) passing through $(0,0)$ and $(5,2)$, respectively. Now you want two circles of equal radius such that the first line touches the first circle in $(0,0)$, the second line touches the second circle in $(5,2)$ and the two circles touch in one point?2012-05-24

2 Answers 2

0

Suppose we let $q_1$ and $q_2$ denote the centers of circles c1 and c2 respectively, and let $r$ denote their radii. We know that $q_1 = p_1 + r*d_1$ $q_2 = p_2 + r*d_2$ $distance(q_1, q_2) = 2r$ Substitute $q_1$ and $q_2$ from the first and second equations into the third, and you get a quadratic that you can solve to get $r$. Substitute back into the first and second equations to get $q_1$ and $q_2$.

  • 0
    Tha$n$ks for the response. This is the path I went down, and was having problems when using the sample data I provided (negative square root and division by zero in the quadratic formula). It turns out I was being a little dumb and hadn't realised that for data like the sample it is linear, and has only one solution, so just needed to special case for that. Giving you the answer as you are correct, and I have a solution now. Thanks again.2012-06-06
0

Given two lines and a point on one of the line, there is already a unique circle that is tangent to the lines and passes through the point.

You demand in addition that two such circles through two arbitrary points have the same radius. This is something that you cannot demand and therefore, your argument is flawed as well, because there are two different radii to use in the formula.

  • 0
    One last attempt at clarification, I think I missed a couple of 'respectively's out of my description that might have cleared things up. Circle 1 touches p1, and c1 is on the line p1 + t * d1. Circle 2 touches p2, and c2 is on the line p2 + t * d2. If i manage to up my reputation before I forget this question I will answer with an image and my values for the quadratic equation (or linear in the case where d1 and d2 are parallel).2012-05-24