# How to determine which points are on an envelope of ellipses?

I'm wondering how to determine the location of some of the points on the envelope of a family of ellipses? The picture I have is below:

For each of the individual ellipses, I know how to get the enclosed region using ImplicitRegion, and the code goes like either

ImplicitRegion[Evaluate[a*x^2+b*y^2+cx*y+dy*x+e<=0], {x, y}]


Or

ImplicitRegion[
Sum[EuclideanDistance[{x, y}, p], {p, foci}] <= majoraxis, {x, y}]]


Supposedly, I'm looking for a function that (1. taking in a point in the region bounded by the envelope, (2. for some theta determine the closest colored point in the angle theta with regards to the input point.

I only need around 20-30 points so that I can run lm and decide whether the envelope is also an ellipse (and I already know how to do this part). Any suggestions on how I can locate points on the envelope?

I tried running RegionIntersection, RegionBoundary and then rasterize it to take random points from the boundary, but this takes more than 1hr on my MacBook for an envelope of 100 ellipses. Both RegionIntersection and RegionBoundary runs very slow, so I'm looking for a more time-wise efficient solution.

• in what form do you have the ellipses? something like RegionBoundary@*ConvexHullRegion could work! (assuming you want the "outer" envelope. If you want the "inner envelope", something like RegionBoundary@*RegionIntersection could work, assuming you have filled ellipses (which aren't hard to get if you don't)) Aug 4, 2021 at 22:12
• @thorimur I have the ellipses in formulas, how can I let the contour map be "regions"? Aug 4, 2021 at 22:27
• ah i see. Parametric or given by solutions to equations? you could use ParametricRegion or ImplicitRegion, respectively! if you include a couple in your question i can demonstrate in an answer Aug 4, 2021 at 22:43
• @thorimur thanks!! I think I can use ImplicitRegion for now. Aug 4, 2021 at 22:46
• also note that you can take advantage of RandomPoint or MeshCoordinates to get a bunch of explicit coordinates in the resulting region! you might also want to DiscretizeRegion first Aug 4, 2021 at 22:54

Update

n = 10;
centers = Table[RandomReal[{0, 1/2}, 2], n];
majoraxis = Table[RandomReal[{3, 6}, 2], n];
interior = RegionIntersection@ellipsoids;
pts = MeshPrimitives[
RegionIntersection @@@ Subsets[DiscretizeRegion /@ ellipses, {2}] //RegionUnion, 0];
inpts = Select[pts, RegionWithin[interior, #] &];
outpts = Complement[pts, inpts];
Graphics[{{Yellow, DiscretizeRegion@interior},
ellipses, {Cyan, outpts}, {Red, PointSize[Medium], inpts}}]


Or

n = 10;
centers = Table[RandomReal[{0, 1/2}, 2], n];
majoraxis = Table[RandomReal[{3, 6}, 2], n];
interior = RegionIntersection@ellipsoids;
(* pts=RegionIntersection@@@Subsets[ellipses,{2}] *)
fig = Graphics[ellipses];
pts = GraphicsMeshFindIntersections[fig,
GraphicsMeshAllPoints -> False];
inpts = Select[pts, RegionMember[interior, #] &];
outpts = Complement[pts, inpts];
Graphics[{{Yellow, DiscretizeRegion@interior},
ellipses, {Cyan, Point@outpts}, {Red, PointSize[Medium],
Point@inpts}}]


Edit

Clear[ellipses, fig, pts];
ellipses =
Table[Circle[RandomReal[{0, 1/2}, 2], RandomReal[{3, 6}, 2]], 10];
fig = Graphics[ellipses];
pts = GraphicsMeshFindIntersections[fig,
GraphicsMeshAllPoints -> False];
Show[fig, Graphics[{PointSize[Medium], Red, Point[pts]}]]


Or

Clear[ellipses, pts];
ellipses =
Table[Circle[RandomReal[{0, 1/2}, 2], RandomReal[{3, 6}, 2]], 10];
pts = Cases[
Table[RegionIntersection[ellipses[[i]], ellipses[[j]]], {i,
Length@ellipses}, {j, i - 1}], {x_Real, y_Real} :> {x, y},
Infinity];
Graphics[{ellipses, PointSize[Medium], Red, Point[pts]}]


Original

Do you want such points?

reg = ImplicitRegion[4 x^2 + 3 y^2 - 3 x*y == 4, {x, y}];
pts = RandomPoint[reg, 5]
RegionMember[reg] /@ pts
RegionPlot[reg, Epilog -> {PointSize[Large], Red, Point[pts]}]


{True, True, True, True, True}

• I'm looking for points on the envelop of the ellipses, like the inner boundary of the intersections of a bunch of ellipses. Aug 5, 2021 at 15:54
• @duang Please see the updated. Aug 6, 2021 at 0:19
• thanks for the update. I would want points only on the innermost curve tho, is there any way to select those only? Aug 6, 2021 at 2:38
• @duang see another update. Aug 6, 2021 at 9:09