Question

How can I calculate the arc between two circles? The arc must be tangent to the two points on the circles.

Here is a picture illustrating it. I'm trying to code and calculate the orange arc and the blue arc.

alt text

more details:

Your applet should have 2 modes: 2D and 3D. The user should be able to switch between them by pressing the space bar. In the 2D mode, the user can edit the position of four control points A, B, C and D and should see 4 circular arcs defined by these points as follows. The red arc lies on a circle of center A and radius ||AB||. The green arc lies on a circle of center C and radius ||CD||. The orange arc lies on a supporting circle that is tangent to the supporting circle of the red arc at B and also tangent to the green circle at a point E, which your code must compute. This supporting circle should not separate A and C (i.e., A and C must either be both in that circle or out of it). Similarly, the blue arc lies on a circle that does not separate A and C and that is tangent to the supporting circle of the green arc at D and is also tangent to the supporting circle of the red arc at some point F which your program must compute. The red arc runs clockwise from F to B. The orange arc runs from B to E. The green arc runs from E to D. The blue arc runs from D back to F. These four arcs form a smooth boundary of a region S of the plane. Notice that depending on the position of the control points, the orange and blue arcs may each be either concave or convex. In the figure below, the blue arc is concave. (pictured above)

Was it helpful?

Solution

There are many "tangent circles" !

alt text

OTHER TIPS

Generally speaking, you can't. Draw straight lines through AB and CE, and extend them to the point of intersection. Call the intersection M. You can draw an arc through B and E that is tangent to circles if and only if BM = EM.

Let G be the center of the circle for the arc between B and E and H the circle for the arc between F and D.

The key point is that a line that intersects a circle is a tangent line if and only if it is perpendicular to the radius at the intersection point. This means that if you have two circles that are tangent, then the tangent point and the centers of the circles are collinear.

So this means that the center G is the intersection of the line defined by B and A and the line defined by E and C. Similarly, the center H is the intersection of the line defined by A and F and the line defined by C and D.

Given these centers, you can determine the radii of the two circles just from the distance from the center to the tangent point. From there you can use standard methods to draw the arc given its endpoints and the circle it is part of.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top