6

Let \begin{align*} C = \{(x,y,z) \in \mathbb{R}^3 | x^2+ y^2=1, z=0\} \end{align*} be a unit circle in 3D space and $f$ be a given affine transform $$f(p) = A p^t + b, \ p\in \mathbb{R}^3$$ which can transform $C$ into any ellipse. Moreover we are given a plane by its unit normal vector $n$ then $$P(p) = p - (p n^t) n, \ p\in \mathbb{R}^3 $$ is the orthogonal projection of $p$ onto the plane.

What are the coefficients of the polynomial equation that we get when $C$ is first transformed by $f$ then projected by $P$?

Background: This problem arises in astronomy when we observe an orbit through a camera. Here, $f$ gives the orbit in a coordinate system and the plane is the camera plane.


Update: As turned out the normal $n$ alone does not provide enough information to deduce the coefficients. If we instead assume we pitch $\theta$ or yaw $\psi$ (but not roll) the ellipse and project the result into the $x,y$ plane we get $P' : \mathbb{R}^3 \longrightarrow \mathbb{R}^2$ $$P' = \left [ \begin{matrix} \cos\theta \cos\psi & - \sin\psi & \sin\theta \cos\psi \\ \cos\theta \sin\psi & \cos\psi & \sin\theta \sin\psi \end{matrix} \right ].$$

JHT
  • 419
  • As usual with problems like this, it helps to write down the domain and codomain of everything. When you say "the polynomial equation we get when...", you presumably are looking for a polynomial with respect to some coordinate system. Do you perhaps have an origin and orthonormal basis for the target plane, and want a polynomial in those coordinates? Also, it seems likely that you're assuming that $n$ is a unit vector, yes? – John Hughes Dec 13 '25 at 16:50
  • Let me ask back a much simpler question: suppose that $n = \begin{pmatrix} 0 \ 0 \ 1 \end{pmatrix}$, the matrix $A$ is the identity, and $b$ is the zero vector. In this case, the target plane is exactly the $xy$-plane in 3-space. What's the polynomial that you're hoping to get as an answer to this question? Because right now your specification of $C$ involves two polynomials: $x^2 + y^2 = 1$ and $z = 0$. – John Hughes Dec 13 '25 at 16:56
  • @JohnHughes Yes, $n$ is a unit vector. I looking for the equation of the resulting ellipse within the plane so we have only two coordinates. In the case mentioned its $x^2+y^2=1$. – JHT Dec 13 '25 at 17:05
  • Given an arbitrary plane, what are its coordinates? Until you can answer that, your last comment doesn't really mean anything. Any polynomial will be ambiguous up to a choice of origin and a choice of an (orthonormal) basis. Once you specify those, then the problem becomes full-rank (you have a 2-space to 2-space transformation). – John Hughes Dec 13 '25 at 17:51
  • @JohnHughes Yes, that is indeed a problem even if we define the origin we have the rotation angle of the plane as a free parameter, see the answer below. – JHT Dec 13 '25 at 18:02
  • 2
    You may enjoy this answer about ellipse projection: https://astronomy.stackexchange.com/a/43350/16685 and this interactive 3D diagram https://sagecell.sagemath.org/?q=dmweol – PM 2Ring Dec 14 '25 at 01:05
  • 1
    @PM2Ring I certainly did :-) – uhoh Dec 14 '25 at 21:02

2 Answers2

4

The original circle is the intersection of the unit-radius infinite cylinder

$$ x^2 + y^2 = 1 $$

and the $xy$ plane $z = 0$.

If $p = (x, y, z) = \begin{bmatrix} x \\ y \\ z \end{bmatrix} $

And $ Q = \begin{bmatrix} 1 && 0 && 0 \\ 0 && 1 && 0 \\ 0 && 0 && 0 \end{bmatrix}$

Then equivalent to the above, the unit circle in the $xy$ plane is the intersection of the cylinder

$ p^T Q p = 1 $

And the plane

$ e_3^T p = 0 $

where $e_3 = (0,0,1) = \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}$

Now you define an affine transformation on $p$ which produces an image $p'$ corresponding to $p$ as follows

$ p' = f(p) = A p + b $

Further, we project the image $p'$ onto a plane passing through the origin, and having a unit normal vector $n$. Let the projected $p'$ be $p''$ then

$p'' = [I_3 - {nn}^T] p' $

Define matrix $J = I_3 - {nn}^T$ ,then

$p'' = J p' $

Using the expression for $p'$ we get

$ p'' = J ( A p + b ) = (J \ A) \ p + (J \ b) = F p + g$

with $F = J \ A $ and $g = J \ b $.

It is well-known that matrix $J$ is rank-deficient, actually its rank is $2$. So, assuming matrix $A$ is full rank, then $J \ A $ will also be rank deficient, and have a rank of $2$. And because of that, we cannot invert matrix $F$, which we need to solve for $p$ in terms of $p''$.

However we can use vector parametric methods to find what we're looking for.

The original unit circle in the $xy$ plane can be written parametrically as

$ p(\theta) = u_1 \cos(\theta) + u_2 \sin(\theta) $

where $u_1 = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} $ and $u_2 = \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} $

Therefore,

$ p'(\theta) = A ( u_1 \cos(\theta) + u_2 \sin(\theta) ) + b $

And

$ p''(\theta) = F p + g = F (u_1 \cos(\theta) + u_2 \sin(\theta) ) + g $

Let's define $w_1 = F \ u_1 $ , $w_2 = F \ u_2 $

$ p''(\theta) = w_1 \cos(\theta) + w_2 \sin(\theta) + g $

Note that we know that $p''$ lies in the plane $ n \cdot (x, y, z) = 0 $

We can attach a reference frame to this plane, with its $x'y'$ plane coinciding with the plane itself, and its $z'$ axis along the normal $n$. If $q = (x', y', 0)$ is the coordinate of point on the projection plane with respect to the arbitrarily selected orientation of the $x'$ and $y'$ axes, then

$ p'' = R q $

Note that the third coordinate of $q$ is zero. The $3 \times 3$ $R$ is a rotation matrix and is given by

$ R = [ \hat{x'}, \hat{y'}, \hat{n} ] $

where $ \hat{x'} $ is the unit vector along the positive $x'$ axis expressed in world coordinates, and $\hat{y'}$ is the unit vector along the positive $y'$ axis expressed in world coordinates.

From this, it follows that

$ q(\theta) = R^{-1} p''(\theta) = R^{T} ( w_1 \cos(\theta) + w_2 \sin(\theta) + g ) $

Define $ y_1 = R^{T} w_1$ and $y_2 = R^T w_2 $ and $q_0 = R^T g $ , then

$ q(\theta) - q_0 = \begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} y_1 && y_2 \end{bmatrix} \begin{bmatrix} \cos(\theta) \\ \sin(\theta) \end{bmatrix} $

Define

$Y = \begin{bmatrix} y_1 && y_2 \end{bmatrix} $ and $ u = \begin{bmatrix} \cos(\theta) \\ \sin(\theta) \end{bmatrix} $

then

$ q - q_0 = Y u \hspace{50pt}(1)$

Note that $q$ and $q_0$ have their third component identically zero.

Also, note that $Y$ is a $3 \times 2$ matrix, and $u$ is a $2 \times 1$ unit vector.

Pre-multiply both sides by $Y^T$, you get

$ Y^T q = (Y^T Y) u \hspace{50pt}(2)$

The matrix $(Y^T Y)$ is $2 \times 2$. Solving for $u$ we get

$ u = (Y^T Y)^{-1} Y^T (q - q_0) $

We know that $u$ is a unit vector, i.e. $u^T u = 1$ , therefore,

$ (q - q_0)^T \ Y (Y^T Y)^{-T} (Y^T Y)^{-1} Y^T \ (q - q_0) = 1 \hspace{50pt}{(3)} $

Recall that $q = \begin{bmatrix} x' \\ y' \\ 0 \end{bmatrix} $

Equation $(3)$ will give you the coefficients of $x'^2, y'^2, x'y', x', y'$ plus the constant term.

We can slightly modify $(3)$, by noting that matrix $Y$ can be written as

$ Y = R^T W $

where $W = \begin{bmatrix} w_1 && w_2 \end{bmatrix} $

Then $ Y^T Y = W^T R R^T W = W^T W $

Therefore, equation $(3)$ becomes

$ (q - q_0)^T \ R^T W (W^T W)^{-T} (W^T W)^{-1} W^T R \ (q - q_0) = 1 \hspace{30pt} (4) $

And recall that $q_0 = R^T g $.

A substantially different approach, starts with the equation

$ p''(\theta) = w_1 \cos(\theta) + w_2 \sin(\theta) + g \hspace{50pt}(5) $

which I copied from above.

I can now replace $ \theta $ with $(t - t_0)$ which $t$ is arbitrary and $t_0$ is a fixed value that is to be determined. With this, equation $(5)$ becomes

$ p''(t) = w_1 \cos( t - t_0) + w_2 \sin(t - t_0) + g \hspace{50pt}(6)$

Expand the trigonometric terms, to get

$ p''(t) = \cos(t) [ w_1 \cos(t_0) - w_2 \sin(t_0) ] + \sin(t) [ w_1 \sin(t_0) + w_2 \cos(t_0) ] + g \hspace{50pt} (7) $

By properly choosing $t_0$ we can make the vector $[ w_1 \cos(t_0) - w_2 \sin(t_0) ]$ orthogonal to the vector $[ w_1 \sin(t_0) + w_2 \cos(t_0) ]$, this requires that

$[ w_1 \cos(t_0) - w_2 \sin(t_0) ]\cdot [ w_1 \sin(t_0) + w_2 \cos(t_0) ] = 0 \hspace{50pt}(8)$

Expanding, gives us

$ (w_1 \cdot w_1 - w_2 \cdot w_2) ( \sin(t_0) \cos(t_0) ) + (w_1 \cdot w_2 ) ( \cos^2(t_0) - \sin^2(t_0) ) = 0 \hspace{50pt}(9) $

Using trigonometric identities, this in turn implies,

$ \dfrac{1}{2} \sin(2 t_0) (w_1 \cdot w_1 - w_2 \cdot w_2) + \cos(2 t_0) (w_1 \cdot w_2 ) = 0 \hspace{50pt}(10)$

And this finally gives us

$ t_0 = \dfrac{1}{2} \tan^{-1} \dfrac{ 2 (w_1 \cdot w_2 ) }{ w_2 \cdot w_2 - w_1 \cdot w_1 ) } \hspace{50pt}(11)$

This means that at this calculated $t_0$ the vectors

$ v_1 = w_1 \cos(t_0) - w_2 \sin(t_0) $

and

$ v_2 = w_1 \sin(t_0) + w_2 \cos(t_0) $

represent the major and minor semi-axes of the ellipse that is a result of transformation and projection.

Since $v_1$ is orthogonal to $v_2$ we can take these two directions to be the $x'$ and $y'$ axes direction.

So the equation of the ellipse now is

$ p''(t) = g + \cos(t) v_1 + \sin(t) v_2 \hspace{50pt}(12) $

where $v_1 \perp v_2$, therefore, taking the $x'$ coordinate to be along the $v_1$ direction and $y'$ to be along the $v_2$ direction, and further, if we let the origin of the coordinate system be at $g$ (which is known), then the quadratic polynomial describing the ellipse is

$ \dfrac{x'^2}{\| v_1 \|^2 } + \dfrac{ y'^2}{\| v_2 \|^2} = 1 \hspace{50pt}(13)$

To see this, look at equation $(12)$, we have

$ p''(t) - g = \cos(t) v_1 + \sin(t) v_2 \hspace{50pt}(12) $

Define the matrix

$ R = \begin{bmatrix} \dfrac{v_1}{\| v_1 \|} && \dfrac{v_2}{\| v_2 \| } && n \end{bmatrix} $

Now define the local coordinates vector $r = R^T (p'' - g) $

Then

$ r = \begin{bmatrix} x' \\ y' \\ 0 \end{bmatrix} = \begin{bmatrix} \| v_1 \| && 0 \\ 0 && \| v_2 \| \\ 0 && 0 \end{bmatrix} \begin{bmatrix} \cos(t) \\ \sin(t) \end{bmatrix} \hspace{50pt} (14) $

Disregarding the third row that is zero on both sides of the equation, and inverting, we get

$ \begin{bmatrix} \cos(t) \\ \sin(t) \end{bmatrix} = \begin{bmatrix} \dfrac{1}{\| v_1 \|} && 0 \\ 0 && \dfrac{1}{\| v_2 \|} \end{bmatrix} \begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} \dfrac{x'}{\| v_1 \|} \\ \dfrac{y'}{\| v_2 \|} \end{bmatrix} $

Since $\cos^2(t) + \sin^2(t) = 1 $ , then

$ \dfrac{x'^2}{\| v_1 \|^2 } + \dfrac{ y'^2}{\| v_2 \|^2} = 1$

as expressed in equation $(13)$.

Hosam Hajeer
  • 511
  • 1
  • 10
  • That was quick. I also got the non-full rank issue. What does (1) melt down to if we assume that the camera plane coordinate system was not rotated around its normal? – JHT Dec 13 '25 at 17:42
  • There is no default orientation for the axes $\hat{x'}$ and $\hat{y'} $. I've added a couple of lines to simplify the expression and make the effect of $R$ more pronounced. – Hosam Hajeer Dec 13 '25 at 17:54
  • Yeah, that's a problem as it leaves one free variable, the rotation angle of the plane coordinate system. And if for $n=(0,0,-1)$ (top-down view) we assume that the axes align with the original coodinates and for $n=(1,0,0)$ as well but switched, etc...? – JHT Dec 13 '25 at 18:00
  • You're right, that is a problem. I'll try and modify my solution to address this issue. – Hosam Hajeer Dec 13 '25 at 18:04
  • Thanks, technically it is perfectly fine as you are allowed to turn the camera around its viewing direction, but some sort of default would be nice. – JHT Dec 13 '25 at 18:07
  • Note that the coefficients you're looking for depend on you choice of $R$ (the rotation matrix that specifies your coordinate system $x'y'z'$). So in conclusion, You MUST choose a certain frame whose $x'y'$ plane is the given projection plane, then you can find the quadratic equation in the two variables $x'$ and $y'$, after that you can extract the properties of this ellipse. – Hosam Hajeer Dec 13 '25 at 19:04
  • I think the given normal $n$ is the problem as it does not provide enough information. Instead we might assume a default plane, e.g. original $x,y$ plane (the circle is in) and allow rotation in only two directions like here https://eyes.nasa.gov/apps/solar-system/#/home – JHT Dec 13 '25 at 19:36
  • 1
    @JHT please check my updated solution. – Hosam Hajeer Dec 13 '25 at 21:00
3

I will follow the usual convention in linear algebra to express a vector in $\mathbb R^3$ as a column vector. Hence $C$ is the set of all vectors $p$ in the form of $(\cos\theta,\sin\theta,0)^T$, $f(p)=Ap+b$ and $P(p)=(I-nn^T)p$. It follows that $$ q=P(f(p))=(I-nn^T)Ap+(I-nn^T)b=(I-nn^T)A\pmatrix{I_2\\ 0}\pmatrix{\cos\theta\\ \sin\theta}+(I-nn^T)b. $$ Let $M=(I-nn^T)A\pmatrix{I_2\\ 0}\in\mathbb R^{3\times2}$ and $c=(I-nn^T)b\in\mathbb R^3$. Then $q=M\pmatrix{\cos\theta\\ \sin\theta}+c$. The rank of $M$ is at most two, but $M$ can be rank-one even if $A$ is invertible; if $A$ is singular, $M$ may even be zero.

  • If $M$ is rank-two, then $\pmatrix{\cos\theta\\ \sin\theta}=M^+(q-c)=(M^TM)^{-1}M^T(q-c)$. Hence the locus of $q$ can be expressed as a single polynomial equation $\left\|(M^TM)^{-1}M^T(q-c)\right\|^{\,2}=1$. It is an ellipse.
  • If $M$ is rank-one, we may write it as $uv^T$ where $u$ is a nonzero vector in $\mathbb R^3$ and $v$ is a unit vector in $\mathbb R^2$. Hence the locus of $q=uv^T\pmatrix{\cos\theta\\ \sin\theta}+c$ is the line segment joining $c-u$ and $c+u$.
  • If $M=0$, then the locus of $q$ is the single point $c$. If you insist on writing it as a single polynomial equation, you may write $(q_1-c_1)^2+(q_2-c_2)^2+(q_3-c_3)^2=0$.
user1551
  • 151,715
  • I wonder if there is a condensed expression of $M^{+}$? – JHT Dec 13 '25 at 20:05
  • 1
    @JHT If you mean an explicit symbolic formula, I think $(M^TM)^{-1}M^T$ is the only viable option. If numerical computation is allowed, you may also use singular value decomposition. – user1551 Dec 13 '25 at 21:04
  • @user1551 The equation you derived and said that it is an ellipse, is not an equation of an ellipse. It is an equation of an elliptical cylinder. To get the ellipse your equation has to be intersected with the equation of the projection plane. – Hosam Hajeer Dec 14 '25 at 11:33
  • @HosamHajeer Could we not just use $q=(x',y',0)$. Then the coefficients I got look reasonable, but I wonder which $R$ from your solution that would be? – JHT Dec 14 '25 at 14:19
  • No. , we cannot use $q = (x',y', 0) $ . The $q$ variable that user1551 uses is what I call $p''$, and not the same as the variable $q$ that I use. – Hosam Hajeer Dec 14 '25 at 14:24