Function Repository Resource:

MinimumVolumeEllipsoid

Source Notebook

Find the minimum-volume enclosing ellipsoid of a set of points

Contributed by: Jan Mangaldan

ResourceFunction["MinimumVolumeEllipsoid"][{p1,p2,}]

gives the minimum-volume enclosing ellipsoid of the points p1,p2,.

Details and Options

The minimum-volume enclosing ellipsoid is also known as the Löwner ellipsoid or Löwner–John ellipsoid.
The minimum-volume enclosing ellipsoid is the smallest ellipsoid that includes the points pi.
The result is returned as an Ellipsoid.
ResourceFunction["MinimumVolumeEllipsoid"] takes the following options:
MaxIterations100maximum number of iterations to use
ToleranceAutomatictolerance for accepting an enclosing ellipsoid

Examples

Basic Examples (2) 

A minimum volume ellipse:

In[1]:=
pts = RandomReal[{-1, 1}, {50, 2}];
In[2]:=
ResourceFunction["MinimumVolumeEllipsoid"][pts]
Out[2]=

The region is the smallest ellipse that includes the points:

In[3]:=
Graphics[{{Directive[Opacity[0.6, LightBlue]], %}, Point[pts]}]
Out[3]=

A minimum volume ellipsoid:

In[4]:=
pts = RandomReal[{-1, 1}, {50, 3}];
In[5]:=
ResourceFunction["MinimumVolumeEllipsoid"][pts]
Out[5]=

The region is the smallest ellipsoid that includes the points:

In[6]:=
Graphics3D[{{Directive[Opacity[0.6, LightBlue]], %}, Point[pts]}]
Out[6]=

Options (2) 

MaxIterations (1) 

Limit or increase the number of steps taken:

In[7]:=
pts = {{3, 10}, {6, 3}, {10, 2}, {2, 8}, {3, 3}};
In[8]:=
ResourceFunction["MinimumVolumeEllipsoid"][pts, MaxIterations -> 10]
Out[8]=

Tolerance (1) 

Increase or decrease the Tolerance:

In[9]:=
pts = {{3, 10}, {6, 3}, {10, 2}, {2, 8}, {3, 3}};
In[10]:=
ResourceFunction["MinimumVolumeEllipsoid"][pts, Tolerance -> 0.001]
Out[10]=

Applications (1) 

Find the minimum-volume enclosing ellipsoid for a 3D graphics object:

In[11]:=
graphics = \!\(\*
Graphics3DBox[
{EdgeForm[None], GraphicsComplex3DBox[CompressedData["
1:eJx1WGl0VtU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vx7T2+15x7Plt+z3mP3zl+91RwNqzl9+YJNB3LQbQ2cc8xO1bv8Xt6
bRSeST6H27jmdSX3/C3iZ6z3WGsb57aCeyvRbkhsroFzd4z/AvVboWs=
"]]}]},
Boxed->False,
ImageSize->{175., Automatic},
ViewPoint->{1.3, -2.4, 2.},
ViewVertical->{0., 0., 2.667290522030783}]\);
In[12]:=
mesh = DiscretizeGraphics[graphics];
In[13]:=
Show[graphics, Graphics3D[{Opacity[0.5], ResourceFunction["MinimumVolumeEllipsoid"][
    MeshCoordinates[mesh]]}]]
Out[13]=

Properties and Relations (2) 

Compare the result of MinimumVolumeEllipsoid with the bounding ellipse returned by BoundingRegion[pts,"FastEllipse"]:

In[14]:=
pts = RandomReal[{-1, 1}, {50, 2}];
In[15]:=
e1 = BoundingRegion[pts, "FastEllipse"]
Out[15]=
In[16]:=
e2 = ResourceFunction["MinimumVolumeEllipsoid"][pts]
Out[16]=
In[17]:=
{Area[e1], Area[e2]}
Out[17]=

Compare the result of MinimumVolumeEllipsoid with the bounding ellipsoid returned by BoundingRegion[pts,"FastEllipsoid"]:

In[18]:=
pts = RandomReal[{-1, 1}, {50, 3}];
In[19]:=
e1 = BoundingRegion[pts, "FastEllipsoid"]
Out[19]=
In[20]:=
e2 = ResourceFunction["MinimumVolumeEllipsoid"][pts]
Out[20]=
In[21]:=
{Volume[e1], Volume[e2]}
Out[21]=

Version History

  • 1.0.0 – 31 December 2020

Source Metadata

License Information