# Rotation using homogeneous coordinates in 4D

#### Romsek

##### Full Member
I think the procedure is to
i) translate the point such that the axis of rotation is at the origin
ii) perform the rotation
iii) translate the rotated point by the negative of that done in (i)

Given a 2D point $$\displaystyle \begin{pmatrix}x\\y\end{pmatrix}$$

we augment this as $$\displaystyle \begin{pmatrix}x\\y\\1\end{pmatrix}$$

and then we can perform both rotations and translations using matrices.

To translate $$\displaystyle \begin{pmatrix}x\\y\end{pmatrix}$$ by $$\displaystyle \begin{pmatrix}x_0\\y_0\end{pmatrix}$$ we do

$$\displaystyle \begin{pmatrix}1 &0 &x_0\\0&1 &y_0\\0 &0 &1\end{pmatrix}\begin{pmatrix}x\\y\\1\end{pmatrix} = \begin{pmatrix}x+x_0\\y+y_0\\1\end{pmatrix}$$

We can do rotations by simply augmenting the 2D rotation matrix in the obvious way.

So for this problem we
i) translate by (-1,-5) to get the axis of rotation at the origin.

$$\displaystyle T_1 = \begin{pmatrix}1&0&-1\\0&1&-5\\0&0&1\end{pmatrix}$$

ii) rotate by 30 degrees clockwise

$$\displaystyle R = \dfrac 1 2\begin{pmatrix}\sqrt{3}&1&0\\-1 &\sqrt{3}&0\\0&0&2\end{pmatrix}$$

iii) and translate back

$$\displaystyle T_2 = \begin{pmatrix}1&0&1\\0&1&5\\0&0&1\end{pmatrix}$$

And the whole idea is that the entire transformation is the product of these three matrices.

$$\displaystyle \begin{pmatrix}x^\prime\\y^\prime\\1\end{pmatrix}=T \begin{pmatrix}x\\y\\1\end{pmatrix}= T_2 R T_1 \begin{pmatrix}x\\y\\1\end{pmatrix}$$

I'm not exactly sure how homogeneous coordinates fit into all this. But to my knowledge this is the usual way to augment vectors and matrices to allow affine transformations.

#### ignoremail

##### New member
I think the procedure is to
i) translate the point such that the axis of rotation is at the origin
ii) perform the rotation
iii) translate the rotated point by the negative of that done in (i)

Given a 2D point $$\displaystyle \begin{pmatrix}x\\y\end{pmatrix}$$

we augment this as $$\displaystyle \begin{pmatrix}x\\y\\1\end{pmatrix}$$

and then we can perform both rotations and translations using matrices.

To translate $$\displaystyle \begin{pmatrix}x\\y\end{pmatrix}$$ by $$\displaystyle \begin{pmatrix}x_0\\y_0\end{pmatrix}$$ we do

$$\displaystyle \begin{pmatrix}1 &0 &x_0\\0&1 &y_0\\0 &0 &1\end{pmatrix}\begin{pmatrix}x\\y\\1\end{pmatrix} = \begin{pmatrix}x+x_0\\y+y_0\\1\end{pmatrix}$$

We can do rotations by simply augmenting the 2D rotation matrix in the obvious way.

So for this problem we
i) translate by (-1,-5) to get the axis of rotation at the origin.

$$\displaystyle T_1 = \begin{pmatrix}1&0&-1\\0&1&-5\\0&0&1\end{pmatrix}$$

ii) rotate by 30 degrees clockwise

$$\displaystyle R = \dfrac 1 2\begin{pmatrix}\sqrt{3}&1&0\\-1 &\sqrt{3}&0\\0&0&2\end{pmatrix}$$

iii) and translate back

$$\displaystyle T_2 = \begin{pmatrix}1&0&1\\0&1&5\\0&0&1\end{pmatrix}$$

And the whole idea is that the entire transformation is the product of these three matrices.

$$\displaystyle \begin{pmatrix}x^\prime\\y^\prime\\1\end{pmatrix}=T \begin{pmatrix}x\\y\\1\end{pmatrix}= T_2 R T_1 \begin{pmatrix}x\\y\\1\end{pmatrix}$$

I'm not exactly sure how homogeneous coordinates fit into all this. But to my knowledge this is the usual way to augment vectors and matrices to allow affine transformations.
I needed to do it specifically using homogeneous coordinates, but I appreciate the help. From looking around, it looks like I need to create a 4x4 matrix, which contains the 3x3 rotation matrix and the final row/column filled with 0s bar the bottom right, which is a 1.

#### Romsek

##### Full Member
you should probably be able to take what I did and just add a dimension to it.

$$\displaystyle T_1 = \begin{pmatrix}1&0&0&-1\\0&1&0&-5\\0&0&1&0\\0&0&0&1\end{pmatrix}$$

$$\displaystyle R = \dfrac 1 2 \begin{pmatrix}\sqrt{3}&1&0&0\\-1&\sqrt{3}&0&0\\0&0&2&0\\0&0&0&2\end{pmatrix}$$

$$\displaystyle T_2 = \begin{pmatrix}1&0&0&1\\0&1&0&5\\0&0&1&0\\0&0&0&1\end{pmatrix}$$

$$\displaystyle \begin{pmatrix}x^\prime\\y^\prime\\z^\prime\\1\end{pmatrix} = T_2 R T_1 \begin{pmatrix}x\\y\\z\\1\end{pmatrix}$$

• ignoremail