Hello All,
I’m trying to write a program that will create an arc from 2 points a line that will be tangent to the arc.
I’m not the best at trig, but I try. I can’t seem to find anything online that helps me solve this.
The problem is this: I have a line segment. I have another line close by; the other line is not parallel to the first. The arc will start and end at the first lines endpoints, and be tangent to the second line.
I do not know the radius as it changes every time, as does the lengths and angles of the lines. Any help in this would be greatly appreciated.
This isn’t a trig question, it’s just simple geometry.
First define a line that bisects the line segment. The center of the circle is on this line.
Then, consider a point on this line. Define the distance from this point the original line (that the circle is tangent to), and the distance to one of the line segment end points.
Solve for the position where these two distances are equal.
Is that enough of a hint?
We don’t know that the center is on the segment’s bisector.
Sure we do. AB’s bisector consists of those points which are equidistant from A and B; if A and B are to lie on a circle, its center better be equidistant from them.
Not exactly. The center of the circle will on a line that is perpendicular to the tangent line and passing thru the tangent point. That line doesn’t have to bisect AB. The center of the circle is at the radius R from A, B, and the tangent point.
The center of the circle, like every point, lies on many lines.
If the circle is to be tangent to the line L at point P, then the center lies on the line perpendicular to L passing through P, sure. And that particular line needn’t bisect AB, sure.
None of that is contradiction to the other fact, which is indeed a fact, that if the circle is to contain both A and B, then its center must lie on the line perpendicularly bisecting AB.
The center of the circle we are looking for is equidistant from point A, point B, and the desired tangent line L.
This means it lies on the perpendicular bisector of AB (to be equidistant from A and B). It also lies on the parabola with focus A and directrix L (to be equidistant from A and L). It also lies on the parabola with focus B and directrix L (to be equidistant from B and L). Where any two of those intersect, so does the third, and that intersection is the set of suitable centers.
Sure we do. The bisector of a circle’s chord contains the diameter.
The circle can be constructed by first drawing two preliminary circles. This is one of the amazing constructions due to the great Apollonius of Perga.
A key fact is the the Power of a Point Theorem attributed to Jakob Steiner, though Apollonius must have been aware of it. This theorem is very simple: If A, B, C, D, are any points on the same circle whose lines (ABG, CDG) intersect at G, then AG * BG = CG * DG. Note that if CDG is a tangent to the circle then C = D, so CG[sup]2[/sup] = AG * BG.
Thus, given the line ABG, there are an infinite number of circles containing A and B, but their tangents to G will all have the same length. We are given A, B on the desired circle, and a tangent line so we pick the point G to be the intersection of the tangent line with the line AB.
So … Find the midpoint of AB, draw the circle from that midpoint such that AB is a diameter of the circle. Find a point C at which CG is tangent to the circle just drawn. (This isn’t completely trivial to do with straightedge and compass, but is easier than the rest of this!) Now draw a circle centered at G with radius CG. Any point Z on this circle will form a circle ABZ with ZG tangent to the circle by the Power of a Point theorem.
So … simply take the intersection, F, of the circle just drawn with the tangent line you were originally given. The points A, B, F all lie on the desired circle since GF is the tangent line you were given! (Of course the center of that circle is found from two perpendicular bisectors.)
In general there will be a second point F’ where the second drawn circle intersects the given line. Thus there are two circles satisfying OP’s condition.
(Rereading OP, I see that he’s working in coordinate geometry and would have been happy with a simpler method! But it seems more elegant to to do it the way the ancient Greek greats did it!)
Given use of coordinates, solution is very simple, still using the Power of a Point Theorem. Find G as before, the intersectrion of the two given lines. Calculate d = √(AG * BG). The third point on the desired circle is on the tangent line at distance d from G. Again you have two solutions to choose from.
Ah, I misunderstood. It sounded like scr4 was saying to bisect the tangent line, not the segment between the two points.
Very nice!
Let us observe the one caveat that there will be no solutions if G actually lies on the segment AB (that is, between A and B instead of to the same side as both of them). What’s going on here is that AG * BG ought be thought of as negative in this case (its two factors having, in some sense, opposite sign), and thus lacking a square root.