Content
- World Coordinate System
- Combined Transformations
- Articulated Structures
Graphics 1 CMP-5010B
Dr. David Greenwood
February, 2022
Order matters!
So far we have looked at individual 2D transformations applied to the vertices of a 2D polygon.
Having put in place a uniform method, applicable to all transformations, we can now look at combining transformations.
We will show now that the order of the applied transformations is absolutely crucial to obtain the desired results!
Where in the world do we start?
Most graphics systems adopt a World Coordinate System (WCS), with a camera in a particular position and orientation.
For example in OpenGL, the camera is at the origin of the WCS pointing in the negative z-direction with its “up” vector pointing in the y-direction.
So far we have been working with 2D transformations.
Given the description of the OpenGL coordinate system, what has been the significance of the z-axis?
The WCS is represented by a right-handed coordinate system, with the z-axis popping out of the screen.
Order matters…
Matrix multiplication is associative:
\[ABC=A(BC)=(AB)C\]
Matrix multiplication is not commutative:
\[AB \neq BA\]
Start with two common concatenated transformations:
Start with two common concatenated transformations:
\[ \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} = \begin{bmatrix} 1 & ~0& ~t_x \\ 0 & ~1& ~t_y \\ 0 & ~0& ~1 \end{bmatrix} \begin{bmatrix} \cos \alpha& -\sin \alpha& ~0 \\ \sin \alpha&~ ~\cos \alpha& ~0 \\ 0& 0& ~1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \]
\[ \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} = \begin{bmatrix} \cos \alpha& -\sin \alpha& ~0 \\ \sin \alpha&~ ~\cos \alpha& ~0 \\ 0& 0& ~1 \end{bmatrix} \begin{bmatrix} 1 & ~0& ~t_x \\ 0 & ~1& ~t_y \\ 0 & ~0& ~1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \]
Multiplying out the first example from right to left:
Multiplying out the second example from right to left:
\[ RTv \neq TRv \]
The order of the transformations is important.
Hierarchical transformations…
Make the articulated structure from only the square polygon.
Order of transformations:
\[ \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix}= \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 1s \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \]
Order of transformations:
\[ \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix}= \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 2s \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos \alpha & - \sin \alpha & 0 \\ \sin \alpha & \cos \alpha & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & 1.5s \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 3 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \]
Order of transformations:
\[ \begin{aligned} \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} =~ &\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 2s \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos \alpha & - \sin \alpha & 0 \\ \sin \alpha & \cos \alpha & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & 3s \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \\[10pt] &\begin{bmatrix} \cos \beta & - \sin \beta & 0 \\ \sin \beta & \cos \beta & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & s \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 2 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \end{aligned} \]
NB: equation runs over two lines.
There is a template solution for each of the three parts.
Base:
\[ \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix}= \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & ? \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 \\ 0 & ? & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \]
Link 1:
\[ \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix}= \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & ? \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos \alpha & - \sin \alpha & 0 \\ \sin \alpha & \cos \alpha & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & ?\\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} ? & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \]
\[ \alpha = ?^{\circ} \]
Link 2
\[ \begin{aligned} \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} =~ &\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & ? \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos \alpha & - \sin \alpha & 0 \\ \sin \alpha & \cos \alpha & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & ? \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \\[10pt] &\begin{bmatrix} \cos \beta & - \sin \beta & 0 \\ \sin \beta & \cos \beta & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & ? \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} ? & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \end{aligned} \]
\[\alpha = ?^{\circ} ~, ~ \beta = ?^{\circ}\]
Reading: