betaFeedback

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, r2arcsin⁡(c/2r)r^2\arcsin(c/2r), which measures the minor arc, and omits the term πr2\pi r^2. 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, r2[π−arcsin⁡(c/2r)]+(c/4)4r2−c2r^2[\pi-\arcsin(c/2r)]+(c/4)\sqrt{4r^2-c^2}, 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

L=r12arccos⁡d2+r12−r222dr1+r22arccos⁡d2+r22−r122dr2−12Π,(1)L = r_1^2 \arccos\frac{d^2+r_1^2-r_2^2}{2dr_1} + r_2^2 \arccos\frac{d^2+r_2^2-r_1^2}{2dr_2} - \frac{1}{2}\sqrt{\Pi}, \tag*{(1)}

where Π=(−d+r1+r2)(d+r1−r2)(d−r1+r2)(d+r1+r2)\Pi=(-d+r_1+r_2)(d+r_1-r_2)(d-r_1+r_2)(d+r_1+r_2). This expression subtracts quantities of nearly equal size when the lens is thin, and the arccosine of an argument 1−ϵ1-\epsilon amplifies the rounding error of the argument by ϵ−1/2\epsilon^{-1/2}. 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 h2=r12−a2h^2=r_1^2-a^2, 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 DkD_k denote the closed disk of centre oko_k and radius rkr_k bounded by the circle CkC_k, k=0,1,2k=0,1,2, and let R=D0∩D1∩D2R=D_0\cap D_1\cap D_2. We first remove every disk DjD_j that contains another disk DiD_i, because then Di∩Dj=DiD_i\cap D_j=D_i. One remaining disk gives A=πr2A=\pi r^2, and two remaining disks give the lens of that pair. The overlap vanishes, A=0A=0, as soon as one pair is disjoint. In all other configurations every pair of circles crosses at two points. A crossing of CiC_i and CjC_j that lies strictly inside DkD_k is a vertex of RR, and we denote the number of vertices by VV.

Proposition 1. For configurations without a crossing on the third circle, V∈{0,2,3,4}V\in\{0,2,3,4\}. The overlap is empty for V=0V=0, the lens of one pair for V=2V=2, a circular triangle with one vertex from each pair for V=3V=3, and a circular quadrilateral whose four vertices lie on one circle for V=4V=4.

Proof. The set RR is convex. Unless RR is a disk or has an empty interior, its boundary is a simple closed curve composed of aka_k arcs of each CkC_k, joined at the vertices, so a0+a1+a2=Va_0+a_1+a_2=V. An arc of ∂R\partial R on CiC_i is a component of (Ci∩Dj)∩(Ci∩Dk)(C_i\cap D_j)\cap(C_i\cap D_k), the intersection of two proper arcs of CiC_i. Hence ai≤2a_i\leq2, and ai=2a_i=2 holds exactly when the two arcs cover CiC_i, that is, when Ci⊂Dj∪DkC_i\subset D_j\cup D_k. The union Dj∪DkD_j\cup D_k is simply connected because Dj∩Dk≠∅D_j\cap D_k\ne\varnothing, and by the Jordan curve theorem it then contains DiD_i. A crossing q\mathbf{q} of CjC_j and CkC_k lies on the boundary of Dj∪DkD_j\cup D_k and therefore cannot lie in the interior of DiD_i, so the pair (j,k)(j,k) contributes no vertex. Each vertex on CjC_j then stems from the pair (i,j)(i,j) and each on CkC_k from (i,k)(i,k), which gives aj=ak=1a_j=a_k=1 and V=4V=4. In all other cases ak≤1a_k\leq1 for every kk, and hence V≤3V\leq3. For V=3V=3 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 V=2V=2 the boundary consists of two arcs of the circles of one pair. A boundary without vertices would be a full circle Ci⊂Dj∩DkC_i\subset D_j\cap D_k, which the containment reduction has removed. Therefore V=0V=0 implies R=∅R=\varnothing, and V=1V=1 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 π\pi. Panel (a) shows three pairwise intersecting disks without a common point.

Boundary walk

A counter-clockwise traversal of ∂R\partial R runs counter-clockwise around the centre of each of its arcs, since RR lies inside every disk. An arc of CsC_s between consecutive crossings on CsC_s has constant membership in the two other disks and belongs to ∂R\partial R exactly when its midpoint lies inside both. From every vertex u\mathbf{u} we therefore select the unique counter-clockwise arc to another vertex v\mathbf{v} on a shared circle CsC_s whose open span contains no other crossing of CsC_s and whose midpoint lies strictly inside the two other disks. We write u′=u−os\mathbf{u}'=\mathbf{u}-\mathbf{o}_s and v′=v−os\mathbf{v}'=\mathbf{v}-\mathbf{o}_s. The span test then reduces to signs of cross products, and the midpoint is os+rs(u′+v′)/∥u′+v′∥\mathbf{o}_s+r_s(\mathbf{u}'+\mathbf{v}')/\lVert\mathbf{u}'+\mathbf{v}'\rVert, with the positive sign for u′×v′>0\mathbf{u}'\times\mathbf{v}'>0. The successors form a single cycle through all vertices, and any other outcome identifies a degenerate input. For V=3V=3 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 V=4V=4 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 A=12∮(x dy−y dx)A=\frac{1}{2}\oint(x\,dy-y\,dx). We parametrise the arc of CsC_s from u\mathbf{u} to v\mathbf{v} as os+rs(cos⁡t,sin⁡t)\mathbf{o}_s+r_s(\cos t,\sin t). The identities rs(sin⁡β−sin⁡α)=vy−uyr_s(\sin\beta-\sin\alpha)=v_y-u_y and rs(cos⁡β−cos⁡α)=vx−uxr_s(\cos\beta-\cos\alpha)=v_x-u_x then remove all trigonometric functions of the end angles, and the arc contributes

Aarc=12[rs2Δθ+os,x(vy−uy)−os,y(vx−ux)],(2)A_{\mathrm{arc}}=\frac{1}{2}\left[r_s^2\Delta\theta+o_{s,x}(v_y-u_y)-o_{s,y}(v_x-u_x)\right], \tag*{(2)}

with

Δθ=atan2⁡(u′×v′,u′⋅v′)∈(0,2π].(3)\Delta\theta=\operatorname{atan2}(\mathbf{u}'\times\mathbf{v}',\mathbf{u}'\cdot\mathbf{v}')\in(0,2\pi]. \tag*{(3)}

Equation (3) determines the arc from the geometry rather than from a chord length, so arcs longer than π\pi 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

A=∑arcsrs22(Δθ−sin⁡Δθ)+12∑edges(u−p)×(v−p),(4)A = \sum_{\mathrm{arcs}} \frac{r_s^2}{2}(\Delta\theta-\sin\Delta\theta)+\frac{1}{2}\sum_{\mathrm{edges}}(\mathbf{u}-\mathbf{p})\times(\mathbf{v}-\mathbf{p}), \tag*{(4)}

where p\mathbf{p} 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 Δθ<0.5\Delta\theta< 0.5 we compute the segment from the Taylor series Δθ−sin⁡Δθ=∑n≥1(−1)n+1Δθ2n+1/(2n+1)!\Delta\theta-\sin\Delta\theta=\sum_{n\geq1}(-1)^{n+1}\Delta\theta^{2n+1}/(2n+1)!, truncated after nine terms. For Δθ≥0.5\Delta\theta\geq0.5 we use rs2sin⁡Δθ=u′×v′r_s^2\sin\Delta\theta=\mathbf{u}'\times\mathbf{v}', which requires no further transcendental function. We accumulate the polygon relative to p\mathbf{p}, so that its rounding error scales with the size of RR 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 C1C_1 and C2C_2 at distance dd lie at distance a1=[(d−r2)(d+r2)+r12]/2da_1=[(d-r_2)(d+r_2)+r_1^2]/2d from o1o_1 along the line of centres and at distance hh from it. Here 4d2h24d^2h^2 is sixteen times the squared area of the triangle with sides (r1,r2,d)(r_1,r_2,d). We evaluate this quantity with the ordering and bracketing of Kahan [14]. For the sorted sides α≥β≥γ\alpha\geq\beta\geq\gamma it reads

4d2h2=[α+(β+γ)][γ−(α−β)][γ+(α−β)][α+(β−γ)],(5)4d^2h^2=[\alpha+(\beta+\gamma)][\gamma-(\alpha-\beta)][\gamma+(\alpha-\beta)][\alpha+(\beta-\gamma)], \tag*{(5)}

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 2atan2⁡(h,a1)2\operatorname{atan2}(h,a_1) and 2atan2⁡(h,a2)2\operatorname{atan2}(h,a_2), which replaces Equation (1).

Degenerate input

We resolve tangencies and containments within 10−1210^{-12} of the largest radius by the reduction of § 2.2. A crossing within 10−910^{-9} of the third circle, a triple point, admits no reliable inside test. In this case we evaluate the solution with all radii shifted by ±10−8\pm10^{-8} 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 10−1510^{-15}, and for three circles through one point it equals 7×10−187\times10^{-18}.

Centroid

The decomposition of Equation (4) also yields the first moments of RR. The centroid of a segment with half-angle φ=Δθ/2\varphi=\Delta\theta/2 lies on its axis, beyond the chord midpoint by

e=r[4sin⁡3φ3(2φ−sin⁡2φ)−cos⁡φ]=r(φ25−13φ41050+⋯ ),(6)\begin{aligned} e=r\left[\frac{4\sin^3\varphi}{3(2\varphi-\sin2\varphi)}-\cos\varphi\right] \\ &=r\left(\frac{\varphi^2}{5}-\frac{13\varphi^4}{1050}+\cdots\right), \tag*{(6)} \end{aligned}

and for φ<0.5\varphi<0.5 we evaluate the series, which we derived in exact rational arithmetic to order φ20\varphi^{20}. Together with the triangle fan of the polygon, this gives the centroid of the overlap to within 1.7×10−121.7\times10^{-12} 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 3.2×10−143.2\times10^{-14} of the smallest disk, over 20,000 configurations, with an independent adaptive quadrature of the chord length min⁡k(yk+sk)−max⁡k(yk−sk)\min_k(y_k+s_k)-\max_k(y_k-s_k), 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 10−710^{-7} 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 κ=∑i∣pi ∂A/∂pi∣/A\kappa=\sum_i|p_i\,\partial A/\partial p_i|/A over the nine input parameters by differentiation in extended precision. An algorithm whose error does not exceed a small multiple of κu\kappa u, with u=2−53u=2^{-53} 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.

FamilyNNThis work(2), textbook(1)Fewell + G&A
general21551.9×10−131.9 \times10^{-13} / 1.12.0×10−92.0 \times10^{-9} / 7.3×1027.3 \times10^{2}2.0×10−92.0 \times10^{-9} / 7.3×1027.3 \times10^{2}1.5×10−131.5 \times10^{-13} / 30
similar49951.4×10−141.4 \times10^{-14} / 2.02.2×10−132.2 \times10^{-13} / 5.84.2×10−134.2 \times10^{-13} / 9.04.0×10−144.0 \times10^{-14} / 1.3×1021.3 \times10^{2}
hierarchical44181.5×10−121.5 \times10^{-12} / 1.32.1×10−72.1 \times10^{-7} / 9.1×1049.1 \times10^{4}2.1×10−72.1 \times10^{-7} / 9.1×1049.1 \times10^{4}3.4×10−123.4 \times10^{-12} / 2.1×1022.1 \times10^{2}
corner50009.9×10−99.9 \times10^{-9} / 1.02.3×10−22.3 \times10^{-2} / 1.1×1061.1 \times10^{6}—1.2×10−81.2 \times10^{-8} / 1.4
sliver lens50001.5×10−61.5 \times10^{-6} / 0.93.6×1063.6 \times10^{6} / 1.3×10121.3 \times10^{12}1.4×10111.4 \times10^{11} / 7.8×10167.8 \times10^{16}—

Table 1. Maximum relative error and maximum error in units of κu\kappa u.

Accuracy plots for small triangles, thin lenses, and all families

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 κu\kappa u. (c) Fraction of all 21,568 configurations whose error exceeds a given multiple of κu\kappa u.

The error of our method never exceeds 2.01κu2.01\kappa u in any of the 21,568 configurations, and its median is 0.12κu0.12\kappa u. The relative errors of 10−810^{-8} for the smallest triangles and 10−610^{-6} for the thinnest lenses are those of the data, because a relative perturbation of 10−1610^{-16} 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 101110^{11}. The corrected closed form of Fewell remains within 2×102κu2 \times10^{2}\kappa u but covers circular triangles only.

Arcs longer than π\pi

Among the circular triangles of Table 1, 101 contain an arc longer than π\pi. 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 Δθ=π\Delta\theta= \pi and diverges beyond it, which explains why the error escaped detection. Our method reproduces the corrected closed form to 2.4×10−122.4 \times10^{-12} of the smallest disk over all 4462 circular triangles and never tests whether an arc is reflex.

Circular triangle and overlap-area plots

Figure 4. A circular triangle with an arc of 3.78 rad on the smallest circle C3C_3. (a) Heron triangle and segments with the major segment on C3C_3, which gives the exact area. (b) The segment of Fewell’s Eq. 16, which takes the minor arc. (c) Overlap area as C3C_3 moves along yy. 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, ∣S∩(P∪M)∣|S \cap(P \cup M)|, 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 10−310^{-3} for a non-empty overlap, or a non-zero result exceeding 10−910^{-9} of the smallest disk for an empty one as a gross failure. Table 2 summarises the results.

CodeUndefined or exceptionWrong by >10−3>10^{-3}Max. error/κu\kappa uMedian error/κu\kappa u
This work002.00.12
gefera, union area3190––
eulerr 7.1.007669.7×10139.7 \times10^{13}2.7
venn.js036897.0×10137.0 \times10^{13}2.6
matplotlib-venn 1.1.2374619034.5×10154.5 \times10^{15}10
Shapely, 8 segments0215687.0×10147.0 \times10^{14}1.1×10131.1 \times10^{13}
Shapely, 64 segments0110224.6×10114.6 \times10^{11}2.1×10112.1 \times10^{11}
Shapely, 512 segments072947.1×1097.1 \times10^{9}3.5×1093.5 \times10^{9}

Table 2. Public software on 40,000 configurations.

gefera computes the union with a median relative error of 5×10−165 \times10^{-16} and agrees to 2.3×10−102.3 \times10^{-10} 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 b+r=1b + r = 1 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 1.6×1061.6 \times10^{6}. It evaluates circular segments from their width with an arccosine of 1−w/r1 - w/r and tests containment with an absolute tolerance of 10−1010^{-10}.

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 5×10−75 \times10^{-7} of the smallest disk. Shapely is limited by its polygon resolution. With 512 segments per quarter circle its median relative error is 1.9×10−51.9 \times10^{-5}, and small and thin overlaps are lost entirely.

Notes. NN 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 κu\kappa u. 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 2×1042 \times10^4 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 μ\mus and quadrilaterals 0.26 μ\mus. The

Notes. Errors are given relative to 50-digit references, and κu\kappa u 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 μ\mus 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 2×1052 \times10^{5} 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.

CodeTest setrp,rm=0.1,0.0092r_p,r_m = 0.1, 0.00920.12,0.050.12, 0.05
This work (Numba)824799
gefera (Fortran)–202514
venn.js (Node.js)465265573
eulerr (R)682553506550
matplotlib-venn300744566786749
Shapely, 8 segments347613597841859
Shapely, 64 segments8317292478103402
Shapely, 512 segments467650907037949028

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 μ\mus 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 κu\kappa u for all 21,568 tested configurations. The classical formulas err by factors up to 101610^{16} 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 μ\mus 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. [1]Agol, E., Luger, R., & Foreman-Mackey, D. 2020, AJ, 159, 123
  2. [2]Cabrera, J. & Schneider, J. 2007, A&A, 464, 1133
  3. [3]Csizmadia, S. 2020, MNRAS, 496, 4442
  4. [4]Fewell, M. P. 2006, Area of Common Overlap of Three Circles, Tech. Rep. DSTO-TN-0722, Defence Science and Technology Organisation, Australia
  5. [5]Frederickson, B. 2018, venn.js: area proportional Venn and Euler diagrams in JavaScript, https://github.com/benfred/venn.js, commit 5ff0ef3
  6. [6]GEOS contributors. 2025, GEOS computational geometry library, version 3.14.1, https://libgeos.org
  7. [7]Gillies, S. et al. 2025, Shapely: manipulation and analysis of geometric objects, version 2.1.2, https://github.com/shapely/shapely
  8. [8]Gordon, T. A. & Agol, E. 2022, AJ, 164, 111
  9. [9]Harris, C. R. et al. 2020, Nature, 585, 357
  10. [10]Higham, N. J. 2002, Accuracy and Stability of Numerical Algorithms, 2nd edn. (Philadelphia: SIAM)
  11. [11]Hippke, M. & Heller, R. 2022, A&A, 662, A37
  12. [12]Hunter, J. D. 2007, Computing in Science & Engineering, 9, 90
  13. [13]Johansson, F. et al. 2026, mpmath: a Python library for arbitrary-precision floating-point arithmetic (version 1.14.1), https://mpmath.org/
  14. [14]Kahan, W. 2014, Miscalculating Area and Angles of a Needle-like Triangle, Lecture notes, University of California, Berkeley
  15. [15]Kálmán, S., Csizmadia, S., Simon, A. E., et al. 2024, MNRAS, 528, L66
  16. [16]Kipping, D. M. 2011, MNRAS, 416, 689
  17. [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. [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. [19]Librino, F., Levorato, M., & Zorzi, M. 2014, Wireless Communications and Mobile Computing
  20. [20]Luger, R., Agol, E., Foreman-Mackey, D., et al. 2019, AJ, 157, 64
  21. [21]Luger, R., Lustig-Yaeger, J., & Agol, E. 2017, ApJ, 851, 94
  22. [22]Mandel, K. & Agol, E. 2002, ApJ, 580, L171
  23. [23]Pál, A. 2012, MNRAS, 420, 1630
  24. [24]Short, D. R., Orosz, J. A., Windmiller, G., & Welsh, W. F. 2018, AJ, 156, 297
  25. [25]Tretyakov, K. 2025, matplotlib-venn: area-weighted Venn diagrams for Matplotlib, version 1.1.2, https://github.com/konstantint/matplotlib-venn
  26. [26]Tusnski, L. R. M. & Valio, A. 2011, ApJ, 743, 97
  27. [27]Weisstein, E. W. 2024, Circle-Circle Intersection, From MathWorld—A Wolfram Web Resource, https://mathworld.wolfram.com/Circle-CircleIntersection.html

Paper details

vlnc:W_kw3ya5k3
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents