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

2.1k Views Asked by At

For an ellipsoid of the form

$$ \frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} = 1 $$

with orientation vector $\vec r$ and centre at point $\vec p$, how to find whether a point $\vec q$ is inside the ellipsoid or not?

Note: The geometry is a oblate spheroid with a=b and therefore one axis is sufficient to define orientation.

2

There are 2 best solutions below

1
On BEST ANSWER

So you have an ellipsoid whose equation in "nice" $xyz$-coordinates is $$ \frac{x^2+y^2}{a^2} + \frac{z^2}{c^2} = 1 $$ byt your test point $\vec q$ is given in "non-nice" $x'y'z'$-coordinates.

You also also know the $x'y'z'$-coordinates of the point $\vec p$ whose $xyz$-coordinates are $(0,0,0)$, and the $x'y'z'$-coordinates of a displacement vector $\vec r$ that is parallel to the "nice" $z$-axis.

Now start by computing $\vec q-\vec p$ and then find the nice $z$ coordinate by $$ z^2 = \left(\pm\frac{(\vec q-\vec p)\cdot \vec r}{|\vec r|}\right)^2 = \frac{((\vec q-\vec p)\cdot \vec r)^2}{\vec r\cdot \vec r} $$ This gives you half of what you need to insert into the equation of the ellipsoid. The other half we get from Pythagoras: $$ x^2+y^2 = |\vec q-\vec p|^2 - z^2 = (\vec q-\vec p)\cdot(\vec q-\vec p) - z^2 $$ and then it's just a matter of inserting into the equation and see whether the LHS is less than $1$ or not.

(If you need to do this many times, you can save some effort by pre-scaling $\vec r$ to have unit length, of course).

0
On

By applying the reverse rotation and translation you will find the coordinates of $q$ in the ellipsoid-centered coordinates. Then check that the LHS $\le1$.