4

I am working on a model that requires that I know the area and center coordinates of the ellipse that is created by the intersection of an ellipsoid and a plane.

Specifically, for the location of the center of the ellipse I want to know the coordinates of this ellipse in Cartesian coordinates.

The general equations for the ellipsoid and plane I have started with are: $$\frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} = 1$$

$$m(x-x_0) + n(y-y_0) + k(z-z_0) = 0$$

I am writing the general forms of these equations because actually I need to be able to solve this for a number of different ellipses and planes with different orientations.

One specific case that I would like to use this solution for first is the case of an ellipsoid that is defined by:

$$a = 7, b = 5, c = 6$$

and a plane defined by:

$$(y+b)tan(\theta)-z + \frac{1}{2} = 0$$

Where $\theta$ is the desired angle of the plane, in this case $\theta=30^o$ is perfectly fine (arbitrary example).

Please note that "b" is the same b used in the equation of the ellipsoid.

I looked at some of the other threads that have asked about plane ellipsoid intersections. However, since I specifically need to calculate the area of the ellipse generated by this intersection and the location of its center, when I tried to use a parametric solution, I had difficulty doing this once I had the parametric equations.

I would really love to learn how to solve this problem so I can include it into my model. Help is greatly appreciated.

Thank you!

-Christian

  • 3
    A general approach ... Use the plane equation to eliminate, say, $z$, from the ellipsoid equation, leaving a second-degree equation in $x$ and $y$ that corresponds to an ellipse in the $xy$-plane. This is a projection of the target ellipse. So, if you can find the projection's center, $(h,k)$, then you can plug these coords into the plane eqn to find the $z$-coord of the target's center. Also, $$\text{(area of projection)}=(\text{area of target}) \cos\phi$$ where (the normals of) the cutting plane and $xy$ plane make angle $\phi$, so "all you have to do" is find the area of the projection. – Blue Apr 13 '20 at 04:15
  • 1
    To determine elements of a conic described by a general degree-$2$ polynomial, see, for instance, this answer. The center is straightforward, given by $x_\triangle$ and $y_\triangle$ in that answer. The area is $\pi r_{max} r_{min}$, whose expression is a bit messy. – Blue Apr 13 '20 at 04:23
  • Thank you very much for your comment! So once I find the xy-plane equation, do I need to change the ellipse projection into conic-form to find the center (h,k)? I noticed when I used that elimination technique I was left with a (const)*(xy) term that confuses me a bit. – Christian Bundschu Apr 13 '20 at 04:24
  • Oh you also answered the question I was asking like magic! Thank you so much, I will go take a look. – Christian Bundschu Apr 13 '20 at 04:25
  • 1
    The $xy$ term means that the ellipse is rotated out of the "standard" orientation, which just complicates everything. :) Since you've tagged the question with linear-algebra, I'll note that one typically approaches this stuff by applying appropriate transformations (rotations and translations) to get the ellipse into "standard form" where everything makes sense. That's way too much to explain in a comment, but you can easily find references to this kind of thing with web searches for "general equation for conic section" or somesuch. – Blue Apr 13 '20 at 04:32
  • 1
    Another note: For the specific cutting planes you mention, $y(b+\tan\theta)-z+\frac12=0$, you won't have to worry about $xy$ terms. Manipulating the projection's equation into "standard" form is straightforward completing-the-square stuff, no rotations. So, finding the center and major/minor radii is comparatively easy. (Likewise for any plane that involves just two coordinate variables.) – Blue Apr 13 '20 at 04:38
  • 1
    I am literally in the process of trying to solve this based on your recommendations right now, currently by plugging in my specific example equation into the equation of the ellipsoid. Your help has been more than anything I could have asked for. I will keep plugging away at this, and let you know how it goes. Again, thank you so much. – Christian Bundschu Apr 13 '20 at 04:42
  • If I wanted to plot the ellipse that is on the plane in MATLAB or something, similarly to how I found the location of the center in 3D-space, would all I need to then do is then plug in the this equation of the ellipse into the equation of my plane to get the z-component? – Christian Bundschu Apr 13 '20 at 05:35
  • I'm not familiar enough with MATLAB to provide specific guidance. However, at least in your simple plane example, you can get to the "standard" equation for the projected ellipse and then convert that into parametric form. (Eg, $(x-h)/p^2+(y-k)^2/q^2=1$ becomes $(x,y)=(h+p\cos\psi,k+q\sin\psi)$.) Then, yes, you can substitute the parametric forms of $x$ and $y$ into the plane equation to get a parametric formula for $z$ in terms of $\psi$. (In the rotated case, this kind of thing is also possible, just messier.) – Blue Apr 13 '20 at 05:50

2 Answers2

4

This is pretty straightforward if you work in homogeneous coordinates.

The general equation of a quadric surface can be written in the form $\mathbf X^TQ\mathbf X=0$, where $Q$ is a symmetric $4\times4$ matrix. Given a coordinate system (i.e., a parameterization) $\lambda\mathbf u+\mu\mathbf v+\tau\mathbf w$ of the plane, let $M = [\mathbf u\;\mathbf v\;\mathbf w]$ so that $\mathbf X=M\mathbf x$. Then we have $$\mathbf X^TQ\mathbf X = (M\mathbf x)^TQ(M\mathbf x) = \mathbf x^T(M^TQM)\mathbf x=0,$$ that is, the intersection is a conic with matrix $M^TQM$ relative to this coordinate system of the plane.

Applying this to your problem, we have $Q=\operatorname{diag}(1/a^2,1/b^2,1/c^2,-1)$. For the matrix $M$, we need a point on the plane and any two linearly independent vectors orthogonal to its normal, $(m,n,k)$. A pair of orthogonal unit vectors removes the need to scale the computed area at the end, but it’s not necessary. For a point on the plane, you have $(x_0,y_0,z_0)$, and for the two vectors parallel to the plane, you can take any two of $(0,k,-n)$, $(-k,0,m)$ and $(n,-m,0)$ that are linearly independent. For example, taking the last two of these vectors we would have $$M=\begin{bmatrix}-k&n&x_0\\0&-m&y_0\\m&0&z_0\\0&0&1\end{bmatrix}.$$

Once you have $C=M^TQM$, you can use standard formulas to find the center of the ellipse and compute its area. For instance, the last row of $C^{-1}$ or, equivalently, of $\operatorname{adj}(C)$ are the homogeneous coordinates of the conic’s center, if it has one. After dehomogenizing to obtain the center coordinates $(u,v)$, you can translate the origin to this point, which will give you a matrix of the form $$C'=\begin{bmatrix}a&b&0\\b&c&0\\0&0&f\end{bmatrix}.$$ Note that translation doesn’t affect the upper-left $2\times2$ submatrix, but it does replace the lower-right element of $C$ with $f=(u,v,1)C(u,v,1)^T$. If this represents an ellipse, which it should if you started with an ellipsoid, its area is equal to ${\pi\lvert f\rvert\over\sqrt{ac-b^2}}$. Since the coordinate system chosen for the plane is probably not orthonormal, to get the true area you need to multiply this by $\lVert\mathbf u\times\mathbf v\rVert$, where $\mathbf u$ and $\mathbf v$ are the two basis vectors that you chose when constructing $M$. To obtain the 3-D coordinates of the center point, just multiply its homogeneous coordinates by $M$.

You might also want to know if the plane even intersects the ellipsoid in more than one point in the first place. This can be accomplished at various stages in the process, but it’s fairly easy to check this early on before doing any of the other work. If the ellipsoid were a unit sphere, then we could just check that the distance of the plane to the origin was less than one, so we can apply to the plane the same transformation that maps our ellipsoid to the unit sphere and then check the distance of the transformed plane from the origin. Skipping ahead to the result, the plane will intersect the ellipsoid in a nontrivial ellipse when $$(mx_0+ny_0+kz_0)^2\le (am)^2+(bn)^2+(ck)^2.$$

Applying this to your example with $\theta=\pi/6$, we first check that $$\left(-5\cdot\frac1{\sqrt3}-\frac12\right)^2\le\left(5\cdot\frac1{\sqrt3}\right)^2+(-1\cdot 6)^2.$$ It is, so we have an ellipse. We can choose $$M = \begin{bmatrix}1&0&0\\0&1&-5\\0&\frac1{\sqrt3}&\frac12\\0&0&1\end{bmatrix}.$$ This turns out to be convenient because the basis vectors are orthogonal and the ellipse’s axes are aligned with them. We then obtain $$C = M^TQM = \begin{bmatrix}\frac1{49}&0&0\\0&\frac{133}{2700}&\frac1{72\sqrt3}-\frac15\\0&\frac1{72\sqrt3}-\frac15&\frac1{144}\end{bmatrix}.$$ The center of this ellipse works out to be $\left(0,-\frac5{266}(5\sqrt3-216)\right)$, which gives us $f = \frac1{532}(20\sqrt3-429)$. Since the basis vectors are orthogonal, the norm of their cross product is just the product of their norms, which is equal to $2/\sqrt3$. Multiplying everything out produces an area of $${15(429-20\sqrt3)\over19\sqrt{133}}\pi \approx 84.8112,$$ which matches the area computed by GeoGebra. Finally, the 3-D coordinates of the ellipse’s center are $\left(0,-\frac{25}{266}(10+\sqrt3),\frac{18}{133}(3+10\sqrt3)\right) \approx (0,-1.10264,2.75014)$, which also matches the center computed by GeoGebra.

We could’ve normalized both of the basis vectors up front when constructing $M$, but I don’t think that really saves much work in this example: doing so only changes the nonzero off-diagonal entries of $C$ and eliminates one multiplication at the end at the cost of one division up front, which is a wash.

amd
  • 53,693
  • Thank you as well for a really nice method to solve this problem, I solved this problem using the other method.Good news for me (I think?) is that my numbers using the same case example come out the same as yours. I will need to read more about the principles used behind your method before I can fully understand it 100%. However having another generalized solution like this is really helpful and appreciated. – Christian Bundschu Apr 13 '20 at 12:26
  • 1
    @ChristianBundschu One thing that I like about this approach is that it operates directly on the original equation of the ellipsoid instead of requiring you to first transform it into some canonical form, which is itself a nontrivial calculation. (Those w.l.o.g.’s can hide a lot of work!) Your ellipsoid is already in a canonical form, so that’s a wash, but it also extracts the ellipse area more or less directly from the resulting, usually non-canonical, equation. – amd Apr 13 '20 at 20:27
  • That's also another really great point! Would I be able to use an approach like this for then plotting purposes? I know that one benefit of parameterizing is that you can use those equations to then plot the ellipse for visual purposes. – Christian Bundschu Apr 14 '20 at 14:46
  • 1
    @ChristianBundschu Well, you still have to find a parameterization of a two-dimensional ellipse equation, but once you have that, you can certainly lift it back to 3-D by multiplying by $M$. – amd Apr 14 '20 at 19:35
  • 1
    @ChristianBundschu Note, BTW, that I did take advantage of the nice form of your ellipsoid’s equation in the intersection test. It’s possible to put something for the general case by comparing the distances of the plane and its pole to the ellipsoid’s center, but that involves inverting $Q$ or computing $\operatorname{adj}(Q)$, which you otherwise don’t need. – amd Apr 14 '20 at 19:38
2

Without loss of generality, you can translate the ellipsoid to origin, rotate it so that its semiaxes are parallel to the Cartesian coordinate axes, and reorder the axes so that the $z$ component of the intersection plane normal in the rotated coordinates has the largest magnitude. Then, the points on the ellipsoid fulfill $$\frac{x^2}{r_x^2} + \frac{y^2}{r_y^2} + \frac{z^2}{r_z^2} = 1 \tag{1}\label{AC1}$$ where $r_x$, $r_y$, and $r_z$ are the ellipsoid semiaxes.

Define the plane using its normal $(n_x, n_y, n_z)$ and signed distance from origin $n_d$, i.e. point $(x, y, z)$ is on the plane if and only if $$x n_x + y n_y + z n_z = n_d \tag{2a}\label{AC2a}$$ Solving this for $z$ yields $$z = \frac{n_d - x n_x - y n_y}{n_z} \tag{2b}\label{AC2b}$$ (We reorder the axes so that $\lvert n_z \rvert \ge \lvert n_y \rvert$, $\lvert n_z \rvert \ge \lvert n_x \rvert$, to avoid division by zero, and in numerical computations, for best numerical stability.)

Substituting $\eqref{AC2b}$ into $\eqref{AC1}$ yields general quadratic form $$a x^2 + b x y + c y^2 + d x + e y + f = 0$$ where (assuming $n_z r_z \ne 0$, both sides multiplied by $n_z^2 r_z^2$) $$\left\lbrace ~ \begin{aligned} a &= n_x^2 + n_z^2 r_z^2 / r_x^2 \\ b &= 2 n_x n_y \\ c &= n_y^2 + n_z^2 r_z^2 / r_y^2 \\ d &= -2 n_x n_d \\ e &= -2 n_y n_d \\ f &= n_d^2 - n_z^2 r_z^2 \\ \end{aligned} \right . \tag{3}\label{AC3}$$ Using this answer by Osmund Francis and the Wikipedia Ellipse article, we can express the following:

The discriminant $D$ (note sign convention!) is $$D = b^2 - 4 a c$$ where the intersection is an ellipse if and only if $D \lt 0$.

Center of the ellipse is at $(x_0, y_0)$, $$\left\lbrace ~ \begin{aligned} \displaystyle x_0 &= \frac{2 c d - b e}{D} \\ \displaystyle y_0 &= \frac{2 a e - b d}{D} \\ \end{aligned} \right.$$ Semimajor axis length $r_+$ and semiminor axis length $r_-$ are $$\begin{aligned} r_+ &= \frac{1}{-D}\sqrt{ 2 ( a e^2 + c d^2 - b d e + f D ) ( a + c + \sqrt{ b^2 + ( a - c )^2 } ) } \\ r_- &= \frac{1}{-D}\sqrt{ 2 ( a e^2 + c d^2 - b d e + f D ) ( a + c - \sqrt{ b^2 + ( a - c )^2 } ) } \\ \end{aligned}$$ and the area $A$ of the ellipse is $$A = \pi ~ r_+ ~ r_-$$ The angle $\theta$ between $x$ axis and major axis is $$\theta = \begin{cases} \operatorname{atan2}\left(c - a - \sqrt{b^2 + (a-c)^2}, b\right), & b \ne 0 \\ 0, & b = 0, \quad a \lt c \\ 90^o, & b = 0, \quad a \gt c \\ 0, & b = 0, \quad a = c, \quad \lvert d \rvert \ge \lvert f \rvert \\ 90^o, & b = 0, \quad a = c, \quad \lvert d \rvert \lt \lvert f \rvert \\ \end{cases}$$ Note that the major axis intersects the ellipse at $(x_{+1}, y_{+1})$ and $(x_{+2}, y_{+2})$, $$\left\lbrace ~ \begin{aligned} x_{+1} &= x_0 + r_+ ~ \cos\theta \\ y_{+1} &= y_0 + r_+ ~ \sin\theta \\ \end{aligned} \right ., \quad \left\lbrace ~ \begin{aligned} x_{+2} &= x_0 - r_+ ~ \cos\theta \\ y_{+2} &= y_0 - r_+ ~ \sin\theta \\ \end{aligned} \right .$$ and similarly the minor axis intersects the ellipse at $(x_{-1}, y_{-1})$ and $(x_{-2}, y_{-2})$, $$\left\lbrace ~ \begin{aligned} x_{-1} &= x_0 + r_- ~ \cos\theta \\ y_{-1} &= y_0 + r_- ~ \sin\theta \\ \end{aligned} \right ., \quad \left\lbrace ~ \begin{aligned} x_{-2} &= x_0 - r_- ~ \cos\theta \\ y_{-2} &= y_0 - r_- ~ \sin\theta \\ \end{aligned} \right .$$ Finally, using angle parameter $\varphi$, we can parametrize the ellipse as $\bigr(x(\varphi), y(\varphi)\bigr)$, $0 \le \varphi \le 360^o$, $$\left\lbrace ~ \begin{aligned} x(\varphi) &= x_0 + r_+ \cos\theta \cos\varphi - r_- \sin\theta \sin\varphi \\ y(\varphi) &= y_0 + r_+ \sin\theta \cos\varphi + r_- \cos\theta \sin\varphi \\ \end{aligned} \right .$$ which is just $x = r_+ \cos \varphi$, $y = r_- \sin\varphi$, rotated by $\theta$, and translated to $(x_0, y_0)$.

  • Thank you very much for the detailed, response! For my own curiosity, why did you switch the signs on the discriminant D, and its equation for the centers of the ellipse compared with the reference? – Christian Bundschu Apr 13 '20 at 12:22
  • @ChristianBundschu: That is how the discriminant is defined, see e.g. the Wikipedia Ellipse article I linked to. As to the center of the ellipse: negating both numerator and denominator does not change the value of the fraction, so this actually agrees with both the Wikipedia article and the answer by Osmund Francis. – Anonymous Coward Apr 13 '20 at 13:43
  • Thank you again! Another question, do you have a reference you can refer me to for understanding / determining the signed distance for the plane $n_d$? – Christian Bundschu Apr 17 '20 at 11:09