4
$\begingroup$

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.

circle arcs

The points B, F, D, and E can be changed by the user and dynamically update.

  • 0
    If points F, E, B, and D are meant to be independent, then there is no reason to expect that they be circle arcs. You can however construct a cubic segment, since each segment has to satisfy four constraints: two points to pass through and the corresponding slopes at those points, and a cubic is uniquely determined by four parameters.2010-11-05

2 Answers 2

1

As others have mentioned in comments, your control points cannot be independent. Nevertheless, if we assume that a given configuration has the properties you want, we can analyze the geometry.

I'll consider the orange arc, $BE$, and I'll assume that both circles $A$ and $C$ overlap the interior of the orange circle, which I'll further assume has not degenerated into a line.

Let $a = |AB|$, $c = |CE|$, and $x=|AC|$; all of these can be considered known quantities. Let the (unknown) radius of the orange circle be $r = |PB| = |PE|$, where $P$ is the circle's center. Because radii $AB$ and $PB$ are perpendicular to a common tangent line at $B$, these segments lie on the same line; likewise for $CE$ and $PE$; consequently, $P$ lies at the intersection of the two extended radii $AB$ and $CE$, so that the angle $BPE$ is congruent to the angle between the vectors $AB$ and $CE$. Call the measure of that angle $\theta$; it, too, can be considered a known quantity.

Now, triangle $APC$ has sides of length $x$, $r-a$, and $r-c$ (the last two because of the assumed overlap of circles), with angle $\theta$ between the last two. By the Law of Cosines:

$x^2 = (r-a)^2 + (r-c)^2 - 2 (r-a)(r-c) \cos\theta$

Solve this quadratic equation for $r$, and you can calculate whatever else you need to know: arc length, location of $P$, equation of the orange circle, etc.

(The equation of the orange circle can be expressed in a form that degenerates into a line equation as $r$ approaches infinity. Note that, in such a degenerate case, $\theta = 0$.)

0

I'm going to ignore arc AC and address what determines arcs FD and BE based on the points A, B, C, D, E, and F.

If two circles with centers X and Y are tangent at P, then X, Y, and P are collinear. So, line AF and line CD both pass through the center of the circle containing arc FD and line AB and line CE both pass through the center of the circle containing arc BE.

If you have coordinates for all of these points, you can write equations of the line and algebraically find their points of intersection. Given the coordinates of the centers of the circles, you can determine their radii. Given the coordinates of the centers of the circles and the endpoints of the arcs, you can determine the measure of the central angles that subtend the arcs. From the radii and central angles, you can determine the arc lengths. (It's hard to be more specific without introducing a bunch of variables, but I can add more detail if you are not sure how to carry out any of these steps.)