How to Find the Distance from an Ellipsoid to a Plane
At a glance
- 1. Write the equations
Represent the ellipsoid by its center and shape matrix, and write the plane using its normal vector.
- 2. Find extreme projections
Use Lagrange multipliers to maximize and minimize the ellipsoid’s projection onto the plane normal.
- 3. Check for intersection
If the plane’s level falls between those extreme projections, the distance is zero.
- 4. Calculate the gap
Otherwise, subtract the ellipsoid’s projection radius from the gap and divide by the normal’s length.
The distance from an ellipsoid to a plane is the smallest perpendicular distance between a point on the ellipsoid and the plane. The key is to find how far the ellipsoid extends in the direction normal to the plane. Lagrange multipliers find those extreme projections directly.
The formula below covers an ellipsoid in any orientation. It also makes clear when the plane intersects the ellipsoid, in which case their distance is zero.
General formula
Write the ellipsoid as
where is its center and is a symmetric positive-definite matrix. Write the plane as
where is a normal vector. The ellipsoid’s distance from the plane is
For the ellipsoid’s surface, the same formula gives the distance to the plane: it is zero when the plane intersects or is tangent to the surface, and positive otherwise. For the solid ellipsoid, a plane passing through its interior also has distance zero.
The term is the distance from the ellipsoid’s center to the plane. The term is the ellipsoid’s radius measured in the plane-normal direction. Subtract the latter from the former, but do not allow a negative distance.
Derivation with Lagrange multipliers
The ellipsoid’s extreme projections onto the normal direction are the maximum and minimum of subject to its surface constraint
Since is constant, maximize or minimize . Introduce a multiplier and set the gradients equal:
Thus . Substituting into the constraint gives
so . The two extreme points are therefore
and the corresponding extreme values of are . In other words, the ellipsoid’s projection onto the normal direction runs from to .
The plane’s level is . If lies in that projection interval, the plane intersects the ellipsoid and the distance is zero. Otherwise, the difference between and the nearest endpoint is the gap measured in the unnormalized normal direction. Divide by to convert it to perpendicular distance.
Worked example
Find the distance from
to the plane
The ellipsoid is centered at the origin, with
Calculate the projection radius and normal length:
The plane is farther from the center than the ellipsoid’s projection radius, so it does not intersect the ellipsoid. The distance is
The factor of matters: the plane equation’s normal is not a unit vector.
Axis-aligned ellipsoids
For an ellipsoid with center and semi-axis lengths ,
the shape matrix is . For a plane , use and . The projected radius becomes
This gives a convenient version of the general formula without constructing a matrix explicitly.
Common mistakes
- Forgetting to normalize the plane normal. The plane equation’s coefficients give a normal vector, but it may not have length one. Divide the final gap by .
- Treating the ellipsoid like a sphere. Its reach in a given direction depends on that direction. Use , not one of the semi-axis lengths alone.
- Reporting a negative result. A negative gap means the plane crosses the ellipsoid’s projection interval. The distance is then zero, not negative.
- Confusing distance to the plane with distance to a point on it. This method minimizes perpendicular distance to the entire plane. A problem asking for the closest point between two surfaces may require a different optimization setup.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.