How to use this calculator
Measure shortest Euclidean distance from a point to an ellipse boundary and locate the nearest boundary point.
- Enter Horizontal semiaxis, Vertical semiaxis, Query x coordinate, Query y coordinate. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Nearest point on an axis aligned ellipse explained
A numerical walkthrough
Horizontal semiaxis = 3; Vertical semiaxis = 2; Query x coordinate = 5; Query y coordinate = 0.
- Distance to ellipse boundary: 2 distance units
- Nearest boundary point: 3, 9.65962663e-15
For the query (5, 0), the nearest boundary point is the right vertex (3, 0), giving distance 2. The tiny displayed y-coordinate is numerical minimization residue, not a meaningful offset.
The model behind the numbers
Minimize squared distance to (a cos θ,b sin θ)
Reflect the query into the first quadrant and parameterize the ellipse boundary by (a cosθ,b sinθ). Minimize squared distance over 0≤θ≤π/2, also checking both axis endpoints, then restore the original coordinate signs.
What to enter
a— Horizontal semiaxis- Horizontal semiaxis.
b— Vertical semiaxis- Vertical semiaxis.
x— Query x coordinate- Query x coordinate.
y— Query y coordinate- Query y coordinate.
Interpreting the result
Ellipse is centered at the origin and axis aligned; a bounded angular search is refined numerically. Interior distance is to the boundary, not to the filled ellipse.
Frequently asked questions
Does an interior point return zero?
Only if it is on the boundary; otherwise it has a positive boundary distance.
Can semiaxes be equal?
Yes, the ellipse then becomes a circle.
Is the result analytic?
The closest angle is found numerically.
How do I use the Nearest point on an axis aligned ellipse calculator?
Enter Horizontal semiaxis, Vertical semiaxis, Query x coordinate, Query y coordinate. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Nearest point on an axis aligned ellipse?
Horizontal semiaxis = 3; Vertical semiaxis = 2; Query x coordinate = 5; Query y coordinate = 0. Distance to ellipse boundary: 2 distance units Nearest boundary point: 3, 9.65962663e-15 For the query (5, 0), the nearest boundary point is the right vertex (3, 0), giving distance 2. The tiny displayed y-coordinate is numerical minimization residue, not a meaningful offset.
Read our calculation methodology.