Affine Linear Transformations of conics (parabola.)

266 Views Asked by At

I want to apply an affine-linear Transformation $L:\mathbb{R}^2 \rightarrow \mathbb{R}^2: x \rightarrow Lx+b$ on a parabola e.g. $y=x^2$. So I interpret the parabola as a conic and represent it as $\begin{bmatrix}x,y,1\end{bmatrix}M\begin{bmatrix}x,y,1\end{bmatrix}^T $ with $M \in \mathbb{R}^{3x3}$. To apply my transformation I need to expand $L$ to $L_1=\begin{bmatrix}L & 0\\0&-1 \end{bmatrix}$ and get my transformation by $\begin{bmatrix}x-b_1,y-b_2,1\end{bmatrix}L_1^TML_1\begin{bmatrix}x-b_1,y-b_2,1\end{bmatrix}^T$ with $b_1,b_2$ being the elements of $b$. For some rotation matrix $L \in SO(2)$ this works just as intended, however if my Matrix $L$ rotates and strechtes it doesn't. Meaning mapping 3 points that lay on my first parabola should also lay on the mapped parabola. Here is my Matlabcode, which I used for my calculations.

M=[-1,0,0;0,0,1/2;0,1/2,0];
L1=[0,2;-2,0];
b1=[1;1];
Points=[0,0;-1,1;1,1];
Pointsproj=(L1*Points'+b1)';
L=-eye(3);
L(1:2,1:2)=L1;
Mnew=(L)'*(M)*(L);
f=@(x,y)M(1,1)*(x)^2+(M(2,1)+M(1,2))*(x)*(y)+(M(3,1)+M(1,3))*(x)+(M(2,3)+M(3,2))*(y)+M(2,2)*(y)^2+M(3,3);
g=@(x,y)Mnew(1,1)*(x-b1(1))^2+(Mnew(2,1)+Mnew(1,2))*(x-b1(1))*(y+b1(2))+(Mnew(3,1)+Mnew(1,3))*(x-b1(1))+(Mnew(2,3)+Mnew(3,2))*(y-b1(2))+Mnew(2,2)*(y-b1(2))^2+Mnew(3,3);
figure
grid on;
hold on;
fimplicit(f);
plot(Points(:,1),Points(:,2),'+');
plot(Pointsproj(:,1),Pointsproj(:,2),'*');
fimplicit(g);
legend('f','x','Lx+b','g');

Giving me this: Parabola Plot where f is the original parabola and g the mapped one. I think I am missing some factor in my transformed parabola?

1

There are 1 best solutions below

2
On BEST ANSWER

(I have erased my first comment : the issue wasn't there).

Here is a modification of your Matlab program which works.

It differs from yours on two main points :

  1. On line 8, I take

$$L_1=\begin{bmatrix}L & b_1\\0&1 \end{bmatrix} \ \\text{with} \ \ L_1^{-1}=\begin{bmatrix}L^{-1} & -L^{-1}b_1\\0&1 \end{bmatrix}$$

including (it is classical) the translation vector $b_1$ as a third column but in a "backwards" mode (said otherwise : instead of $y=L*x+b_1$, I take $x=L^{-1}*(y-b_1)=L^{-1}*y-L^{-1}*b_1$) (see explanation below the program).

  1. Doing that, no need to subtract $b_1(1)$ and $b_1(2)$ to $x$ and $y$ resp. : this has already been done...

Please note (lines 11 and 12) the compact description of functions $f$ and $g$ taken profit of Matlab's easy matrix handling.

M=[-1,0,0;
   0,0,1/2;
   0,1/2,0];
L1=[0,2;-2,0];
L1=2*rand(2)-eye(2);% random L1 for testing
b1=[1;1];
Points=[0,0;-1,1;1,1];
Pointsproj=(L1*Points'+b1*ones(1,3))';
L=eye(3);L(1:2,1:2)=inv(L1);L(1:2,3)=-inv(L1)*b1;
N=L'*M*L;
f=@(x,y)([x,y,1]*M*[x;y;1]);
g=@(x,y)([x,y,1]*N*[x;y;1]);
close all;grid on;hold on;
e=ezplot(f);set(e,'linecolor','b');
e=ezplot(g);set(e,'linecolor','r');
plot(Points(:,1),Points(:,2),'+');
plot(Pointsproj(:,1),Pointsproj(:,2),'*');

Explanation for the backwards operation :

$$X^TMX=\underbrace{(L_1^{-1}X)^T}_{Y^T}L_1^TML_1\underbrace{(L_1^{-1}X)}_Y=0$$

Edit: Why this form for $L_1$ matrix ? Because $L_1=\begin{bmatrix}L & b_1\\0&1 \end{bmatrix}$ is such that $L_1 \begin{bmatrix}X \\ 1 \end{bmatrix}=\begin{bmatrix}LX+b_1\\1 \end{bmatrix}.$

enter image description here