Search code examples
algorithm3dgeometrydistancecomputational-geometry

How to check a point is inside an ellipsoid with orientation?


For an ellipsoid of the form

formula

with orientation vector formula and centre at point formula, how to find whether a point formula is inside the ellipsoid or not?

An additional note that the geometry actually is with a=b (spheroid) and therefore one axis is sufficient to define orientation

Note: I see a similar question asked in the forum. But, it is about an ellipsoid at origin and without any arbitrary orientation and here both arbitrary position and orientation are considered.


Solution

  • Find affine transform M that translates this ellipse in axis-oriented one (translation by -p and rotation to align orientation vector r and proper coordinate axis).
    Then apply this transform to point p and check that p' lies inside axis-oriented ellipsoid, i.e.
    x^2/a^2+ y^2/b^2+z^2/c^2 <= 1