Combined Transformations

Graphics 1 CMP-5010B

Dr. David Greenwood

February, 2022

Content

  • World Coordinate System
  • Combined Transformations
  • Articulated Structures

Combining 2D Transformations

Order matters!

Recap

So far we have looked at individual 2D transformations applied to the vertices of a 2D polygon.

Recap

Having put in place a uniform method, applicable to all transformations, we can now look at combining transformations.

Recap

We will show now that the order of the applied transformations is absolutely crucial to obtain the desired results!

World Coordinate System

Where in the world do we start?

World Coordinate System

Most graphics systems adopt a World Coordinate System (WCS), with a camera in a particular position and orientation.

World Coordinate System

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.

World Coordinate System

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?

  • Answer: It is the axis of rotation.

World Coordinate System

The WCS is represented by a right-handed coordinate system, with the z-axis popping out of the screen.

  • For 2D, we draw in the x-y plane, and rotate about the z-axis.
right handed coordinate system

Combined Transformations

Order matters…

Recap: Matrix Multiplication

Matrix multiplication is associative:

\[ABC=A(BC)=(AB)C\]

Matrix multiplication is not commutative:

\[AB \neq BA\]

Combined Transformations

Start with two common concatenated transformations:

  1. Rotate the model, then translate it.
  2. Translate the model, then rotate it.

Combined Transformations

Start with two common concatenated transformations:

  1. \[ \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} \]

  2. \[ \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:

  1. \[ \begin{aligned} \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} &= % \begin{bmatrix} 1 & ~0& ~t_x \\ 0 & ~1& ~t_y \\ 0 & ~0& ~1 \end{bmatrix} % \begin{bmatrix} x \cos \alpha - y \sin \alpha \\ x \sin \alpha + y \cos \alpha \\ 1 \end{bmatrix} \\[10pt] % \Rightarrow % \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} &= \begin{bmatrix} (x \cos \alpha - y \sin \alpha) + t_x \\ (x \sin \alpha + y \cos \alpha) + t_y \\ 1 \end{bmatrix} \end{aligned} \]

Multiplying out the second example from right to left:

  1. \[ \begin{aligned} \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} x + t_x \\ y + t_y \\ 1 \end{bmatrix} \\[10pt] % \Rightarrow % \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} &= \begin{bmatrix} (x + t_x) \cos \alpha - (y + t_y) \sin \alpha \\ (x + t_x) \sin \alpha + (y + t_y) \cos \alpha \\ 1 \end{bmatrix} \end{aligned} \]

Combined Transformations

\[ RTv \neq TRv \]

The order of the transformations is important.

Articulated Structures

Hierarchical transformations…

Make the articulated structure from only the square polygon.

square, length = s
articulated structure

Assumptions

  • The objects are in order of their position in the hierarchy, i.e. we start with the first object in the hierarchy, then the next and so on.
  • The articulations should be operative rather than static, i.e for different value angles, the structure will still be connected.
  • We only use the metric \(s\) in our transformation matrices.
  • The solution may not be unique.

The base

square, length = s
part 1, the base

The base

The base

Order of transformations:

  1. scale in y, \(~s_y = 2\)
  2. translate in y, \(~t_y = 1s\)

The base

\[ \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} \]

Articulated Arm Template

There is a template solution for each of the three parts.

Articulated Arm Template

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} \]

Articulated Arm Template

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} \]

Articulated Arm Template

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}\]

Summary

  • World Coordinate System
  • Combined Transformations
  • Articulated Structures

Reading:

  • Hearn, D. et al. (2004). Computer Graphics with OpenGL.
  • Strang, Gilbert, et al. (1993) Introduction to linear algebra.
// reveal.js plugins