2
$\begingroup$

$T_1$ and $T_2$ are $3 \times 3$ homogenous transform matrices. $P_1$ is the $3 \times 1$ matrix with $x, y$ coordinates of point $P_1$.

What I am trying to do here is trying to get $x, y$ coordinate of point $P$ in coordinate system with transform $T_2$ when I know its $x, y$ in coordinate system with transform $T_1$.

Well in this relation it seems obvious that $P_2=T_2^{-1} \cdot T_1 \cdot P_1$. But this is giving wrong result in a code of mine. I am right now at my wit's end, so posted this question.

Are there any corner cases where this equation can fail? I know of one case when $\det(T_2)=0$.

  • 0
    Or, to simplify the problem, insteading transforming twice(one forward one backward), try to use ONE transform matrix: if $T_{1}$ is composed by angle $\alpha$ and $T_{2}$ by $\gamma$, then use $T$ composed by angle $\alpha - \gamma$. It allows you to avoid the computation of inverse matrix and matrix operation.2019-06-02

1 Answers 1

1

Don't take this answer as an answer. I'm writing here simply because it is easier to edit. Here we go.

Say $\tilde{x}$ is a vector lying in $\mathbb{R}^3$ space(your Euclidean space).

If you only have one transform variable, it only allows you to transfrom in $\mathbb{R}^2$ (sub)space. In order to transform in 3D, you need two angle variables.

Check wiki for the details. In the course of one rotation, you have to rotation about ONE axis, whose coordinate would remain unchanged.

If it is a rotation matrix, in convention it means you rotation the vector COUNTERCLOCKWISELY (wiki is sometimes confusing :D) by angle $\theta$, while the matrix is $ \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} $

so, if $ T_{1}(\alpha) = \begin{bmatrix} \cos\alpha & -\sin\alpha \\ \sin\alpha & \cos\alpha \end{bmatrix} $

$ T_{2}(\gamma) = \begin{bmatrix} \cos\gamma & -\sin\gamma \\ \sin\gamma & \cos\gamma \end{bmatrix} $,

then $T_{2}^{-1}T_{1}\vec{x}$ means rotating $\vec{x}$ counterclockwisely by $\alpha$ then clockwisely by $\gamma$. So actually you can use $T_{2}^{-1}T_{1}\vec{x} = \tilde{T} = \begin{bmatrix} \cos(\alpha-\gamma) & -\sin(\alpha-\gamma) \\ \sin(\alpha-\gamma) & \cos(\alpha-\gamma) \end{bmatrix} $

Though it is equivalent in mathematics, it simplifies the computation a little bit and it also avoids inverse and matrix multiplication.

I only work in 2D because if the thrid dimension remains the same: if $ T_{2}(\gamma) = \begin{bmatrix} \cos\gamma & -\sin\gamma & 0 \\ \sin\gamma & \cos\gamma & 0 \\ 0&0&1 \end{bmatrix} $ the third entry of vector $\vec{x}$ wouldn't be changed. So actually you can reduce the dimension.

I hope it helps a bit. And using uppercase only means to grasp some attention and doesn't mean to offend anyone.

  • 0
    @AppleGrew since I don't know neither HTML nor javascript, I'll shut my mouth up. :D2011-08-30