WorksPhysics and Astronomy
An exact and fast solution for the common overlap of three disks in mutual transits and eclipses
Abstract
The area common to three disks determines how much light is blocked during mutual events of transiting planets, moons, and eclipsing multiple stars. We present a new solution that removes every case distinction from the evaluation and corrects several errors in earlier work. We prove that a non-degenerate overlap has at most four corners, which reduces the geometry to five topologies that a single directed walk along the boundary arcs resolves. Green's theorem then yields the area as a sum of circular segments and a vertex polygon. The evaluation needs one arctangent per arc, suffers no subtractive cancellation, and handles arcs longer than without a special case. We verify the solution for all cases and show that the algorithm is componentwise backward stable. Five public packages that compute the same area fail on some of our test configurations, either through undefined values, missing topologies, or lost precision. Our complete computation takes 45 ns per configuration on one CPU core, which is four to several thousand times faster than the public packages. The same decomposition also delivers the centroid of the overlap in closed form.
Introduction
When two bodies transit a star at the same time and overlap on the sky, the stellar light they block equals the area of the union of their shadows on the stellar disk. We represent the star, a planet, and its moon by three disks. The union then follows from the pairwise lenses and one further quantity, the area of the common overlap of all three disks. Mutual events of this kind constrain the orbits of exomoons [2, 26, 16, 11, 15], planet–planet occultations [21], and multiply eclipsing stellar systems [24]. The occultation by a single body has an analytic solution [22, 1, 20], and the geometry of three disks underlies every analytic treatment of the mutual case.
Fewell [4] gave the first closed form for the common overlap of three circles. He split the circular triangle into the straight triangle on its three chords, which he evaluated with Heron’s formula, and three circular segments, and he sorted the configurations into nine cases of which only one is a circular triangle. For a segment that exceeds half of its disk, his Eq. 16 retains the arcsine of the chord, , which measures the minor arc, and omits the term . Kipping [16] transcribed Fewell’s construction to the star–planet–moon problem in the algorithm LUNA. He organised the configurations into 27 principal cases with subcases and thereby inherited the error in his Eq. 37 (case 14.1b). Gordon & Agol [8] found a discrepancy between LUNA and an exact computation near the inner edge of the stellar limb and published the corrected segment, , in their Appendix B. The root cause is structural. A chord length fixes an arc only up to the choice between the arc and its complement, so every formula built on chord lengths needs an additional geometric test to make that choice.
The exact limb-darkened light curve of two mutually transiting bodies follows from Green’s theorem, which converts the flux integral over the visible stellar disk into line integrals along its boundary arcs [23]. Gordon & Agol [8] implemented this approach in the code gefera with a tree of 16 geometric cases. Short et al. [24] integrate the line integrals numerically, Luger et al. [21] discretise the star into annuli, and Kálmán et al. [15] combine pixel classification with Gauss–Legendre quadrature in the Transit and Light Curve Modeller [3]. Outside astronomy, Librino et al. [19] computed intersections of many circles by inclusion–exclusion over a trellis of pairwise terms and confirmed Fewell’s construction as the reference for three circles. Area-proportional Euler and Venn diagrams require the same quantity. The packages eulerr [18], venn.js [5], and matplotlib-venn [25] compute intersections of circles from their crossing points, polygon areas, and circular segments, whereas general geometry libraries such as Shapely [7] on GEOS (GEOS contributors [6]) approximate disks by polygons. LUNA is not public.
All of these approaches rest on the area of a two-disk lens. Its textbook form (Weisstein [27]) is
where . This expression subtracts quantities of nearly equal size when the lens is thin, and the arccosine of an argument amplifies the rounding error of the argument by . For a small disk that barely enters a large one, as for a moon at stellar ingress, Equation (1) loses every significant digit (§ 3.1). The same cancellation affects the intersection points computed as , and these enter all vertex-based formulas.
In this paper we present a solution that is free of case-dependent formulas, correct for arcs of any length, backward stable in floating-point arithmetic, and as fast as the closed form of a single topology. We derive the method in § 2, quantify its accuracy and cost in § 3, and discuss its scope in § 4.
Method
Statement of AI use
The solution presented in this paper was derived with the large language model Claude Opus 5.5 (Anthropic) in September and October 2026. The authors began with general questions to Claude and then challenged the proposed solutions with increasingly specific requests, until they could follow every step of the derivation. The solution in its present form results from these iterations and not from a single answer of the model. Claude also wrote the software, including our implementation and the code that compares the accuracy and speed of all methods. It also assisted in drafting the text and in checking its spelling and grammar. No other artificial intelligence (AI) tool was used.
Topology
Let denote the closed disk of centre and radius bounded by the circle , , and let . We first remove every disk that contains another disk , because then . One remaining disk gives , and two remaining disks give the lens of that pair. The overlap vanishes, , as soon as one pair is disjoint. In all other configurations every pair of circles crosses at two points. A crossing of and that lies strictly inside is a vertex of , and we denote the number of vertices by .
Proposition 1. For configurations without a crossing on the third circle, . The overlap is empty for , the lens of one pair for , a circular triangle with one vertex from each pair for , and a circular quadrilateral whose four vertices lie on one circle for .
Proof. The set is convex. Unless is a disk or has an empty interior, its boundary is a simple closed curve composed of arcs of each , joined at the vertices, so . An arc of on is a component of , the intersection of two proper arcs of . Hence , and holds exactly when the two arcs cover , that is, when . The union is simply connected because , and by the Jordan curve theorem it then contains . A crossing of and lies on the boundary of and therefore cannot lie in the interior of , so the pair contributes no vertex. Each vertex on then stems from the pair and each on from , which gives and . In all other cases for every , and hence . For every circle carries one arc and two vertices. Two vertices from the same pair would leave the third circle without an arc, so each pair contributes exactly one. For the boundary consists of two arcs of the circles of one pair. A boundary without vertices would be a full circle , which the containment reduction has removed. Therefore implies , and does not occur.
The proposition thus replaces the 9, 27, and 16 cases of Fewell [4], Kipping [16], and Gordon & Agol [8] by a simple count, and Figure 1 shows the five resulting topologies.
Figure 1. The topologies of the common overlap (red) of three disks after containment reduction. Vertices are marked by dots, boundary arcs are drawn in the colour of their circle, and the dashed arc in panel (e) exceeds . Panel (a) shows three pairwise intersecting disks without a common point.
Boundary walk
A counter-clockwise traversal of runs counter-clockwise around the centre of each of its arcs, since lies inside every disk. An arc of between consecutive crossings on has constant membership in the two other disks and belongs to exactly when its midpoint lies inside both. From every vertex we therefore select the unique counter-clockwise arc to another vertex on a shared circle whose open span contains no other crossing of and whose midpoint lies strictly inside the two other disks. We write and . The span test then reduces to signs of cross products, and the midpoint is , with the positive sign for . The successors form a single cycle through all vertices, and any other outcome identifies a degenerate input. For each circle carries exactly two vertices, the arcs follow the fixed adjacency of the three pairs, and the midpoint test alone fixes their orientation. For the two arcs on the circle that carries all vertices join angularly adjacent vertices in counter-clockwise order. We evaluate both cases without enumeration.
Area
Green’s theorem gives . We parametrise the arc of from to as . The identities and then remove all trigonometric functions of the end angles, and the arc contributes
with
Equation (3) determines the arc from the geometry rather than from a chord length, so arcs longer than need no separate treatment. Each term of Equation (2) equals the circular segment of the arc plus the signed triangle $(\mathbf{o}_s,\mathbf{u},\mathbf{v}),
ends_mid=1 and the triangle terms combine around the cycle into the polygon of the vertices. The area is therefore
where denotes the first vertex. Equation (4) generalises the decomposition of Fewell [4] to every topology and every arc length, and we evaluate it in a form that contains no subtractive cancellation beyond that inherent in the data. For we compute the segment from the Taylor series , truncated after nine terms. For we use , which requires no further transcendental function. We accumulate the polygon relative to , so that its rounding error scales with the size of and not with the coordinates, and we translate the input to the centre of the smallest disk. Figure 2 illustrates the walk and the decomposition.
Figure 2. (a) Vertices of the overlap (dots), crossings outside the third disk (crosses) and the directed boundary arcs. (b) Decomposition of Equation (4) into the vertex polygon and one circular segment per arc, with the centroid of Equation (6).
Crossings and lenses
The crossings of and at distance lie at distance from along the line of centres and at distance from it. Here is sixteen times the squared area of the triangle with sides . We evaluate this quantity with the ordering and bracketing of Kahan [14]. For the sorted sides it reads
which retains full relative accuracy for needle-like triangles, that is, for nearly tangent circles. The lens then follows from two segments with central angles and , which replaces Equation (1).
Degenerate input
We resolve tangencies and containments within of the largest radius by the reduction of § 2.2. A crossing within of the third circle, a triple point, admits no reliable inside test. In this case we evaluate the solution with all radii shifted by of the largest radius and average the two results. For a circle through both corners of a lens the averaged area agrees with the exact lens to , and for three circles through one point it equals .
Centroid
The decomposition of Equation (4) also yields the first moments of . The centroid of a segment with half-angle lies on its axis, beyond the chord midpoint by
and for we evaluate the series, which we derived in exact rational arithmetic to order . Together with the triangle fan of the polygon, this gives the centroid of the overlap to within of the smallest radius against an independent quadrature. The centroid provides the first-order correction for the variation of the stellar intensity across the overlap, which constant-intensity treatments of mutual events omit.
Results
Accuracy
We measure accuracy against references computed with 50 significant digits in an arbitrary-precision library (Johansson et al. [13]). The reference re-evaluates every vertex, angle, segment, and polygon of Equation (4) in extended precision and takes the topology from the double-precision classification. That classification agrees to of the smallest disk, over 20,000 configurations, with an independent adaptive quadrature of the chord length , which contains no geometric case logic. We sample the problem with five families of configurations, namely general disks, disks of similar radius with strong overlap, a hierarchical star–planet–moon geometry with radii 1, 0.02–0.2, and 0.005–0.1, circular triangles produced by clipping a lens corner to a depth of to 0.5 times the smallest radius, and thin lenses of a small disk at the rim of a large one.
The conditioning of the problem limits the attainable accuracy. We compute the componentwise relative condition number over the nine input parameters by differentiation in extended precision. An algorithm whose error does not exceed a small multiple of , with the unit roundoff, returns the exact area of a configuration perturbed by a few units of roundoff in its data and is therefore backward stable in the componentwise sense (Higham [10]). Table 1 and Figure 3 compare our method with the direct evaluation of Equation (2) using the textbook crossings and Equation (1), with the corrected closed form of Fewell [4] and Gordon & Agol [8] for circular triangles, and with Equation (1) for lenses.
Table 1. Maximum relative error and maximum error in units of .

Figure 3. Accuracy against 50-digit references. (a) Relative error of small circular triangles versus their area in units of the smallest disk. (b) Relative error of thin lenses. The black curve marks . (c) Fraction of all 21,568 configurations whose error exceeds a given multiple of .
The error of our method never exceeds in any of the 21,568 configurations, and its median is . The relative errors of for the smallest triangles and for the thinnest lenses are those of the data, because a relative perturbation of in the coordinates changes these areas by the same amounts. The direct evaluation of Equation (2) with the textbook crossings exceeds this limit by up to six orders of magnitude for small triangles, and Equation (1) does so by up to 16 orders of magnitude for thin lenses, where it returns areas wrong by factors up to . The corrected closed form of Fewell remains within but covers circular triangles only.
Arcs longer than
Among the circular triangles of Table 1, 101 contain an arc longer than . On these configurations the original Eq. 16 of Fewell [4], which Kipping [16] adopted as Eq. 37, errs by up to 66% of the area. Figure 4 shows one example, in which the original formula reduces the overlap from 0.859 to 0.654 of the smallest disk. A displacement of the smallest disk shows that the original formula is continuous at the transition and diverges beyond it, which explains why the error escaped detection. Our method reproduces the corrected closed form to of the smallest disk over all 4462 circular triangles and never tests whether an arc is reflex.

Figure 4. A circular triangle with an arc of 3.78 rad on the smallest circle . (a) Heron triangle and segments with the major segment on , which gives the exact area. (b) The segment of Fewell’s Eq. 16, which takes the minor arc. (c) Overlap area as moves along . The shaded interval contains a reflex arc.
Public software
We evaluated five public packages on the 40,000 configurations of § 3.1, of which 21,568 have a non-zero overlap and 18,432 an empty one. The packages are gefera (commit e27e832, Gordon & Agol [8]), eulerr 7.1.0 (Larsson [18]), venn.js (Frederickson [5]), matplotlib-venn 1.1.2 (Tretyakov [25]), and Shapely 2.1.2 with GEOS 3.14.1 (Gillies et al. [7]; GEOS contributors [6]) at 8, 64, and 512 polygon segments per quarter circle. We compiled gefera from its Fortran source with its own flags and, with identical results, with -O2. The code returns the flux of a star occulted by two bodies. For a uniform source this flux equals the area of the union of the two shadows on the star, , and we compare that quantity directly, which spares gefera the cancellation of an inclusion–exclusion. We count an undefined result, an exception, a relative error above for a non-empty overlap, or a non-zero result exceeding of the smallest disk for an empty one as a gross failure. Table 2 summarises the results.
| Code | Undefined or exception | Wrong by | Max. error/ | Median error/ |
| This work | 0 | 0 | 2.0 | 0.12 |
| gefera, union area | 31 | 90 | – | – |
| eulerr 7.1.0 | 0 | 766 | 2.7 | |
| venn.js | 0 | 3689 | 2.6 | |
| matplotlib-venn 1.1.2 | 3746 | 1903 | 10 | |
| Shapely, 8 segments | 0 | 21568 | ||
| Shapely, 64 segments | 0 | 11022 | ||
| Shapely, 512 segments | 0 | 7294 |
Table 2. Public software on 40,000 configurations.
gefera computes the union with a median relative error of and agrees to with the reference in all hierarchical configurations. It returns undefined values, however, in all 31 configurations in which the disk of the planet lies inside that of the moon. This behaviour is expected, because gefera is designed for physical configurations, in which the moon is not larger than the planet. Within its domain, which includes bodies larger than the star (Gordon & Agol [8]), gefera assigns wrong areas, with errors up to 95%, to 90 circular quadrilaterals, 88 of which involve a body larger than the star. It also returns undefined values when a crossing of planet and moon lies exactly on the limb and when for a single body.
eulerr agrees with the reference in general configurations but fails on 310 small triangles and 448 thin lenses, and on 8 hierarchical configurations with bodies of radius 0.02 and 0.006, where it returns either zero or the full smallest disk in place of overlaps of 24 to 94% of that disk.
venn.js fails on 1473 small triangles and 2216 thin lenses, with relative errors up to . It evaluates circular segments from their width with an arccosine of and tests containment with an absolute tolerance of .
matplotlib-venn raises an exception in 3746 configurations in which one disk lies inside another, because its region algebra excludes holes. It returns zero in 886 configurations in which the smallest disk lies inside both others and fails on 1017 overlaps smaller than of the smallest disk. Shapely is limited by its polygon resolution. With 512 segments per quarter circle its median relative error is , and small and thin overlaps are lost entirely.
Notes. is the number of configurations with non-zero area. Each entry gives the maximum relative error followed by the maximum of the error divided by . Equation (1) applies to lens results, and the closed form of Fewell [4] with the correction of Gordon & Agol [8] to circular triangles.
Speed
We implemented the method in Python compiled with Numba (Lam et al. [17]) and timed batches of configurations per topology on one core of an Intel Core Ultra 5 226V, taking the best of nine repetitions. The cost per configuration, including classification, translation, and evaluation, depends on the topology. A representative mixture of all families costs 45 ns and is dominated by the early exits of empty and contained configurations at 21–31 ns, while circular triangles cost 0.17 s and quadrilaterals 0.26 s. The
Notes. Errors are given relative to 50-digit references, and is defined as in Table 1. For gefera we compare the union of the two shadows on the star, whose condition number differs from that of the triple overlap. Its maximum relative error is 0.95. Its 31 undefined results occur for a planet inside the moon, which lies outside the domain of gefera (§ 3.3).
specialised walks of § 2.3 halve the cost relative to the general walk, which costs 117–427 ns. The stable evaluation of Equations (4)–(5) costs the same as the direct evaluation on the mixture and at most 41% more on lenses. The closed form of Fewell [4] with the correction of Gordon & Agol [8] costs 0.10 s for a circular triangle when the topology is known in advance, but it requires a case tree for all other configurations.
Table 3 and Figure 5 compare the public packages on the same core, each through its native interface, on the 40,000 test configurations and on two light-curve sequences of positions of a planet and a moon on the stellar disk with fixed radii. Our method is 4–5 times faster than gefera, 6 times faster than venn.js, and 80 to 5700 times faster than eulerr, matplotlib-venn, and Shapely.
Figure 5. Cost per configuration on one CPU core (Table 3), logarithmic scale, for the 40,000 test configurations and two light-curve sequences of a planet and a moon with fixed radii. gefera accepts one pair of radii per call and is timed on the sequences only. Shapely is shown at 8, 64, and 512 segments per quarter circle.
| Code | Test set | ||
| This work (Numba) | 82 | 47 | 99 |
| gefera (Fortran) | – | 202 | 514 |
| venn.js (Node.js) | 465 | 265 | 573 |
| eulerr (R) | 6825 | 5350 | 6550 |
| matplotlib-venn | 30074 | 45667 | 86749 |
| Shapely, 8 segments | 34761 | 35978 | 41859 |
| Shapely, 64 segments | 83172 | 92478 | 103402 |
| Shapely, 512 segments | 467650 | 907037 | 949028 |
Table 3. Cost per configuration in ns.
Discussion
Our method separates topology from evaluation. The proposition reduces the topology to the number of vertices, and the walk determines the boundary without any formula that depends on the configuration. A single expression then evaluates every topology. This structure removes the failure modes of earlier work at their origin. The reflex error of Fewell [4] and Kipping [16] cannot occur because no arc is inferred from a chord, and the precision loss of Equation (1) cannot occur because we form neither an arccosine of an argument near unity nor a difference of nearly equal areas. The resulting algorithm is backward stable in the componentwise sense over all tested geometries, including the near-tangent configurations that arise at every ingress and egress of a mutual event. The failures of the public packages in § 3.3 fall into the same two classes. The first class comprises case trees that omit topologies, such as quadrilaterals in gefera or holes in matplotlib-venn. The second class is the loss of the small and thin overlaps of ingress and egress, which stems from the segment formula and the absolute tolerance in venn.js and also affects eulerr and matplotlib-venn.
The cost of the complete computation amounts to a few square roots and one arctangent per boundary arc. In a photodynamical model the overlapping configurations form a small fraction of all samples, and most evaluations end in the early exits at 21–31 ns. The method therefore removes the three-disk geometry as a computational concern from light-curve models, and its error is bounded by the conditioning of the data.
To first order in the gradient of the stellar intensity, the area and the centroid of the overlap determine the light blocked twice during a mutual event. The exact limb-darkened flux requires the line integrals of Pál [23] and Gordon & Agol [8] along the same boundary arcs. Our walk of § 2.3 supplies these arcs, their end points, and their orientation for every topology, and the stable crossings of Equation (5) supply accurate end points for the elliptic integrals. The boundary walk thus serves as a robust front end for exact mutual-transit photometry. The proposition and the walk also extend without change to disks of any relative size, including bodies larger than the star in stellar triples.
Notes. gefera accepts one pair of radii per call and is therefore timed on the sequences only. It also evaluates its limb-darkening integrals for a uniform source. The eulerr times include 1.8 s of R loop overhead per configuration, and the venn.js times include the construction of its circle objects. The test set contains more triangles than the mixture quoted in the text.
Conclusions
We have presented an exact solution for the area of the common overlap of three disks that is complete, backward stable, and fast. A proof that the overlap has at most four corners reduces the geometry to five topologies, which one boundary walk resolves. Green’s theorem, evaluated as circular segments with series for thin segments, a vertex polygon relative to its first vertex, and crossings from Kahan’s stable triangle area, yields errors below 2.01 for all 21,568 tested configurations. The classical formulas err by factors up to of this bound, or for reflex arcs by up to 66% of the area. Five public packages, including the mutual-transit code gefera, fail on between 121 and 21,568 of 40,000 configurations, whereas our method fails on none. The complete computation costs 45 ns per configuration on average and 0.26 s in the most complex topology, which is four to several thousand times less than the public packages. The same decomposition also gives the centroid of the overlap in closed form. An open-source implementation is available at https://github.com/hippke/reuleaux.
Acknowledgements. R. Heller acknowledges support from the German Aerospace Agency (Deutsches Zentrum für Luft- und Raumfahrt) under PLATO Data Center grants 50OO1501 and 50OP1902. This research made use of NumPy (Harris et al. [9]), Numba (Lam et al. [17]), mpmath (Johansson et al. [13]), Matplotlib (Hunter [12]), gefera (Gordon & Agol [8]), eulerr (Larsson [18]), venn.js (Frederickson [5]), matplotlib-venn (Tretyakov [25]), Shapely (Gillies et al. [7]), and GEOS (GEOS contributors [6]).
References
- [1]Agol, E., Luger, R., & Foreman-Mackey, D. 2020, AJ, 159, 123
- [2]Cabrera, J. & Schneider, J. 2007, A&A, 464, 1133
- [3]Csizmadia, S. 2020, MNRAS, 496, 4442
- [4]Fewell, M. P. 2006, Area of Common Overlap of Three Circles, Tech. Rep. DSTO-TN-0722, Defence Science and Technology Organisation, Australia
- [5]Frederickson, B. 2018, venn.js: area proportional Venn and Euler diagrams in JavaScript, https://github.com/benfred/venn.js, commit 5ff0ef3
- [6]GEOS contributors. 2025, GEOS computational geometry library, version 3.14.1, https://libgeos.org
- [7]Gillies, S. et al. 2025, Shapely: manipulation and analysis of geometric objects, version 2.1.2, https://github.com/shapely/shapely
- [8]Gordon, T. A. & Agol, E. 2022, AJ, 164, 111
- [9]Harris, C. R. et al. 2020, Nature, 585, 357
- [10]Higham, N. J. 2002, Accuracy and Stability of Numerical Algorithms, 2nd edn. (Philadelphia: SIAM)
- [11]Hippke, M. & Heller, R. 2022, A&A, 662, A37
- [12]Hunter, J. D. 2007, Computing in Science & Engineering, 9, 90
- [13]Johansson, F. et al. 2026, mpmath: a Python library for arbitrary-precision floating-point arithmetic (version 1.14.1), https://mpmath.org/
- [14]Kahan, W. 2014, Miscalculating Area and Angles of a Needle-like Triangle, Lecture notes, University of California, Berkeley
- [15]Kálmán, S., Csizmadia, S., Simon, A. E., et al. 2024, MNRAS, 528, L66
- [16]Kipping, D. M. 2011, MNRAS, 416, 689
- [17]Lam, S. K., Pitrou, A., & Seibert, S. 2015, in Proceedings of the Second Workshop on the LLVM Compiler Infrastructure in HPC, 7:1
- [18]Larsson, J. 2026, eulerr: Area-Proportional Euler and Venn Diagrams with Ellipses, R package version 7.1.0, https://CRAN.R-project.org/package=eulerr
- [19]Librino, F., Levorato, M., & Zorzi, M. 2014, Wireless Communications and Mobile Computing
- [20]Luger, R., Agol, E., Foreman-Mackey, D., et al. 2019, AJ, 157, 64
- [21]Luger, R., Lustig-Yaeger, J., & Agol, E. 2017, ApJ, 851, 94
- [22]Mandel, K. & Agol, E. 2002, ApJ, 580, L171
- [23]Pál, A. 2012, MNRAS, 420, 1630
- [24]Short, D. R., Orosz, J. A., Windmiller, G., & Welsh, W. F. 2018, AJ, 156, 297
- [25]Tretyakov, K. 2025, matplotlib-venn: area-weighted Venn diagrams for Matplotlib, version 1.1.2, https://github.com/konstantint/matplotlib-venn
- [26]Tusnski, L. R. M. & Valio, A. 2011, ApJ, 743, 97
- [27]Weisstein, E. W. 2024, Circle-Circle Intersection, From MathWorld—A Wolfram Web Resource, https://mathworld.wolfram.com/Circle-CircleIntersection.html


