transformation matrix of unit circle to ellipse

5k Views Asked by At

Given the quadratic form of an ellipse, $f(x,y) = ax^2 + bxy + cy^2 +dx + fy + g = 0$, with known coefficients. What is the relationship between $f(x,y)$ and a $2\times 3$ transformation matrix $T$ such that a point on the unit circle $(x_C,y_C)$ can be transformed to a point on the ellipse $(x_e,y_e)$ as

$$ \begin{bmatrix} x_e \\ y_e \\ \end{bmatrix} = T\begin{bmatrix} x_C \\ y_C \\ 1\\ \end{bmatrix}$$

The 3rd column of $T$, $t_{13}$ and $t_{23}$, is the coordinate of the ellipse center $(x_0,y_0)$. The entry $t_{12}$ appears to always equal to zero.

If there is no rotation to the ellipse, then $t_{11} = $ length of semi-major axis and $t_{22}$ = length of semi-minor axis and $t_{21}=0$. No issues in this scenario.

My issue is when there is rotation to the ellipse. In this case, I am unable to see the direct relationship between $t_{11}, t_{2,1}$ and $t_{22}$. Is there a way to compute each of the entries of $T$ directly from $f(x,y)$?

2

There are 2 best solutions below

0
On BEST ANSWER

There is an infinite number of affine transformations that map the unit circle to a given ellipse, each corresponding to a choice of conjugate half-diameters.

Let $\mathbf c$ be the ellipse’s center and $\mathbf c+\mathbf u$ and $\mathbf c+\mathbf v$ be the endpoints of a pair of conjugate half-diameters of the ellipse. Then, per the Wikipedia article on ellipses, the ellipse can be parameterized as $$\mathbf c+\mathbf u\cos t+\mathbf v\sin t.$$ This is the image of the unit circle under the affine map given by $2\times3$ matrix $$T = \begin{bmatrix}\mathbf u & \mathbf v & \mathbf c\end{bmatrix}.$$

To illustrate, let’s assume w.l.o.g. that the ellipse is centered at the origin and the constant term in its equation is $-1$. We can then focus on the linear part of $T$, $M=\begin{bmatrix}\mathbf u&\mathbf v\end{bmatrix}$. For $\mathbf u$, we’ll take the positive $x$-intercept of the ellipse, $\left(1/\sqrt a,0\right)^T$. The conjugate diameter to the $x$-axis is parallel to the tangent at this point, so we compute an intersection of the ellipse with the line $2ax+by=0$, choosing $$\mathbf v=\left(-{b \over\sqrt{a(4ac-b^2)}}, {2\sqrt{a}\over\sqrt{4ac-b^2}}\right),$$ from which $$M = \begin{bmatrix}\frac1{\sqrt a} & -{b\over\sqrt{a(4ac-b^2)}} \\ 0 & {2\sqrt a\over\sqrt{4ac-b^2}} \end{bmatrix}.$$ By symmetry, we can multiply either or both $\mathbf u$ and $\mathbf v$ by $-1$ to obtain another three affine transformations that produce the same ellipse, while reversing the roles of $\mathbf u$ and $\mathbf v$ generates another four. Note, by the way, that the only time that $t_{12}=0$ with this choice of $\mathbf u$ is when the ellipse is already axis-aligned, in which case $T$ represents a simple scaling operation.

If you choose $\mathbf u$ parallel to the ellipse’s major axis, $\mathbf v$ will be orthogonal to it, and so parallel to the minor axis. You can think of this as the “canonical” transformation $M$ that generates the ellipse: a scaling in the direction of the coordinate axes followed by a rotation. Any orthogonal transformation $U$ maps the unit circle to itself, so $MU$ also maps the circle to the ellipse. In fact, this is another way to generate all such transformations.

0
On

Here's a way. Write $$ f(x, y) = \pmatrix{x & y & 1 } \pmatrix{a & b/2 & d/2 \\ b/2 & c & f/2 \\ d/2 & f/2 & g} \pmatrix{x\\y\\1}, $$ which I'll denote as $h^t M h$, where $M$ is the middle matrix, and $h$ is the vector $\pmatrix{x\\y\\1}$.

You'd like to find a matrix $T$ with the property that when $u^2 + v^2 = 1$, then $$ s = T\pmatrix{u\\v\\1} $$ has the property that $s^t M s = 0$. (I'm going to use a $3 \times 3$ matrix for $T$, but the last row will be $\pmatrix{0& 0&1}$, so you can chop it off to get your $T$ matrix, OK? )

Composing those two things, and letting w be the vector $\pmatrix{u\\v\\1}$ you want to have \begin{align} 0 &= s^t M s \\ 0 &= (Tw)^t M (Tw) \\ 0 &= w^t T^t M Tw \\ 0 &= w^(T^t M T)w \end{align} for all vectors $w$ with $u^2 + v^2 = 1$. So letting $K = T^t M T$, we want to have $$ \pmatrix{u & v & 1} K \pmatrix{u\\v\\1} = 0, $$ for all $u,v$ with $u^2 + v^2 = 1$. If we simply pick $K$ to be $\pmatrix{1&0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1}$, we get \begin{align} \pmatrix{u & v & 1} K\pmatrix{u\\v\\1} &= \pmatrix{u & v & 1} \pmatrix{1&0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1} \pmatrix{u\\v\\1}\\ &= u^2 + v^2 - 1 \\ &= 0. \end{align}

So now we know what we need: a matrix $T$ with the property that $T^t M T$ is the diagonal matrix with $1,1,-1$ on the diagonal.

To find this, we simply find the eigenvectors of $M$ and put them into the columns of $T$ and compute $T^t M T$; if the result has the $-1$ in the wrong spot, swap the vectors in $T$ to move that column to the last column. (BTW, you may also need to multiply each column by some constant to make the product have $1$s and $-1$ on the diagonal rahter than some other numbers).

Perhaps "find the eigenvectors of $M$" isn't something you know how to do -- you didn't really say how much math you knew -- but for this particular problem, it's not too tough. My best guess, off the top of my head, is that two of them look something like $$ \pmatrix {\cos \theta\\ \sin \theta \\ 0}, \pmatrix {-\sin \theta\\ \cos \theta \\ 0}, $$ where $\theta$ is the angle of rotation of your ellipse, and the third (with the negative eigenvalue) is the cross-product of these two. [I'm sure that guess is at least slightly wrong, but that's the gist.]