geom.intersectcircles
drafting: P = geom.intersectcircles (C1, R1, C2, R2)
Where two circles meet.
P = geom.intersectcircles (C1, R1, C2,
R2) returns the points common to the two circles: two rows where they
cross, one where they touch, and none where they do not reach each other or
one lies wholly inside the other.
This is how a point is located from two distances — the compass construction that predates coordinates, and still the way a bolt hole is placed from two datums or a linkage position solved.
Circles that touch give a distance exactly equal to the sum or difference of the radii, and in floating point that equality is a coin toss between two points a nanometre apart and no points at all. The comparison carries a tolerance scaled by the radii, so circles within one part in of touching return exactly one point, on the line of centres.
Two circles with the same centre and radius share every point of their circumference. Returning nothing would say they share none, and returning two would name an arbitrary pair; neither is true, so this raises instead. Concentric circles of different radii genuinely share no point and return empty.
See also: geom.intersectcircle, geom.intersectlines, geom.tangentpoints
Source Code: geom.intersectcircles
Two circles locate a point from two distances --- the compass construction that predates coordinates, and still how a hole is placed from two datums.
P = geom.intersectcircles ([0, 0], 50, [70, 0], 40)
P = 41.429 27.994 41.429 -27.994
D = draw.Drawing ().circle ([0, 0], 50).circle ([70, 0], 40);
D.Colour = 'red';
for k = 1:rows (P)
D = D.line (P(k,:) - [4, 0], P(k,:) + [4, 0]);
D = D.line (P(k,:) - [0, 4], P(k,:) + [0, 4]);
endfor
plot (D);
title ('a point located from two distances');
Circles that touch give one point, and ones that do not reach each other give none. Touching is decided against a tolerance rather than left to rounding, so a grazing pair never returns two points a nanometre apart.
geom.intersectcircles ([0, 0], 30, [80, 0], 50) # touching
ans = 30 0
geom.intersectcircles ([0, 0], 10, [80, 0], 20) # too far apart
ans = [](0x2)
geom.intersectcircles ([0, 0], 50, [5, 0], 10) # one inside the other
ans = [](0x2)