Related to a previous question I had, I am interested in filling the intersection of multiple ellipses.
Specifically, I need to figure out how to draw partial arcs of ellipses, using only two points, the radius, and the center.
Here is an example of the kind of diagram I want, which I created using a straight line approximation:
#import "@preview/cetz:0.4.2": *
#canvas({
import draw: *
circle((0,0), radius: (8, 4), name: "G")
circle((rel: (-6, 0.4), to: "G.center"), radius: 0.25, name: "A", fill:black)
circle("A", radius: 3, name: "inner", stroke: gray)
circle("A", radius: 4, name: "outer", stroke: gray)
intersections("i", "G", "inner")
intersections("o", "G", "outer")
merge-path(
stroke: color.purple + 2pt,
fill: color.purple.transparentize(80%),
close: true,
{
arc-through("i.0", "inner.east", "i.1")
line("i.1", "o.1")
arc-through("o.1", "outer.east", "o.0")
line("o.0", "i.0")
}
)
})
This does not work for larger segments:
#canvas({
import draw: *
circle((0,0), radius: (8, 4), name: "G")
circle((rel: (-6, 0.4), to: "G.center"), radius: 0.25, fill: black, name: "A")
circle("A", radius: 3, name: "inner", stroke: gray)
circle("A", radius: 10, name: "outer", stroke: gray)
intersections("i", "G", "inner")
intersections("o", "G", "outer")
merge-path(
stroke: purple + 2pt,
fill: purple.transparentize(80%),
close: false,
{
arc-through("i.0", "inner.east", "i.1")
line("i.1", "o.0")
arc-through("o.0", "outer.east", "o.1")
line("o.1", "i.0")
}
)
// If I had the angle of these lines, could I draw the partial arc?
line("G", "i.0")
line("G", "o.0")
line("G", "i.1")
line("G", "o.1")
})
It really seems like with the center, radius and two points, I should have all of the information necessary to draw these partial arcs. I think my best idea was to compute the angle of the lines in the figure I added, but I thus far have not been able to put anything together that works.
Thank you in advance for any ideas.


