0% found this document useful (0 votes)
4 views30 pages

Linear Transformations & Rotations Explained

Uploaded by

Jordi Escofet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views30 pages

Linear Transformations & Rotations Explained

Uploaded by

Jordi Escofet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Attitude L. T.

Rotations DoFs in Rotations Dualism Concatenation HW

Centre de la Imatge i la Tecnologia Multimèdia

Linear Transformations &


Rotation Matrices
in Theme 2. Attitude

Julen Cayero, Cecilio Angulo

Bachelor’s Degree in Video Game Design


and Development

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 1/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Outline
Centre de la Imatge i la Tecnologia Multimèdia

4 Degrees of freedom in
Rotations
1 Attitude representation
5 Dualism with change of
2 Linear transformations basis

3 Rotations 6 Concatenation of Linear


transformations

7 Homework

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 2/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Outline
Centre de la Imatge i la Tecnologia Multimèdia

4 Degrees of freedom in
Rotations
1 Attitude representation
5 Dualism with change of
2 Linear transformations basis

3 Rotations 6 Concatenation of Linear


transformations

7 Homework

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 3/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Attitude
Centre de la Imatge i la Tecnologia Multimèdia
What is it?

Definition
Attitude is a term used in geometry that refers to the orientation of a
body in space.

Express the attitude of a body is not simple. How is it done?


Define an orthonormal basis. It would be the world reference frame.
Define an orthonormal basis that moves with the object.
Why you will need it?
Position of characters in a virtual world
Virtual Camera views
VR
Look at that: [Link]
[Link] eL27Y
J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 4/30
Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Attitude
Centre de la Imatge i la Tecnologia Multimèdia
Intro

We are going to spend a few of classes talking about:


Transformations between reference frames
Attitude representation
How the several attitude representations relate
Which is the best way of representing attitude

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 5/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Outline
Centre de la Imatge i la Tecnologia Multimèdia

4 Degrees of freedom in
Rotations
1 Attitude representation
5 Dualism with change of
2 Linear transformations basis

3 Rotations 6 Concatenation of Linear


transformations

7 Homework

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 6/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Linear Transformation
Centre de la Imatge i la Tecnologia Multimèdia
What is?

Definition
A Linear Transformation is a Multivariate function that transforms the
space maintaining the origin,

T : Rn −→ Rm

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 7/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Centre de la Imatge i la Tecnologia Multimèdia

Property
If a, b ∈ Rn , T is a Linear Transformation iff

T (a + b) = T (a) + T (b)
T (λ · a) = λ · T (a)

Note: Points on a line remain alienated after the transformation:


T (x + λ · v ) = T (x) + λ · T (v )

Example
 
x1 + 2x2
Is T (x) = T (x1 , x2 , x3 ) =  3x3  a linear transformation?
−x1 + x3

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 8/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Linear Transformation
Centre de la Imatge i la Tecnologia Multimèdia
Some exercises

Exercises 1.1, 1.2, 1.3


Find A, subject to T (x) = Ax, for
 
x1  
x1 + x2 − 3x3
1 T (x) = T  x2 =
 It is ok
−x1 + x2
x3
 
x1  3x1 
x2
+ x 3
2 T (x) = T x2  = It is not linear
2x1 x3
x3
 
  x2
x1
3 T (x) = T = x2 + 1 Do not mantain the origin
x2
−x1

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 9/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Linear Transformation
Centre de la Imatge i la Tecnologia Multimèdia
Some exercises

Exercise 2
   
x1 1
Find x subject to T (x) = T x2  = −1 if T (x) is a
x3 1
linear transformation and
           
1 3 1 0 −1 5
T  1  = 4 , T −1 = 0 , T
       2  = −5

−1 2 0 3 3 0

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 10/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Linear transformation
Centre de la Imatge i la Tecnologia Multimèdia
Matrix form

Proposition
A Transformation T (x) is Linear ⇐⇒ it is possible to find a matrix A
s.t. T (x) = Ax

(⇐) Let A ∈ Mm×n be

.. .. ..
 
. . .
a 1
A= a2 ··· an 
.. .. ..

. . .

Then Ax is a linear transformation T : Rn → Rm such that

T (x) = Ax = x1 a 1 + x2 a 2 + · · · + xn a n ∈ Rm

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 11/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Linear transformation
Centre de la Imatge i la Tecnologia Multimèdia
Matrix form

(⇒) Is Ax always a linear transformation?


Note that, using the canonical basis:
 
x1
 x2 
x =  .  = In x = x1 e 1 + x2 e 2 + · · · + xn e n
 
 .. 
xn

Then

T (x) = x1 T (e 1 ) + x2 T (e 2 ) + · · · + xn T (e n ) ⇒

.. .. ..
 
 . . . 
T (x) =  T (e 1 ) T (e 2) · · ·  x =: Ax
T (e n )
.. .. ..

. . .

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 12/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Outline
Centre de la Imatge i la Tecnologia Multimèdia

4 Degrees of freedom in
Rotations
1 Attitude representation
5 Dualism with change of
2 Linear transformations basis

3 Rotations 6 Concatenation of Linear


transformations

7 Homework

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 13/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Rotation
Centre de la Imatge i la Tecnologia Multimèdia
What is?

Definition
A Rotation is a especial Linear Transformation in the same dimension n

R : Rn −→ Rn

that preserves
Distances (vector norm)
Angles (dot product)
Volumes (triple product)

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 14/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Rotation
Centre de la Imatge i la Tecnologia Multimèdia
An aside

Definitions
Vector norm Length of a vector
√ √
kxk = x1 + x2 + · · · xn = xT x

Dot product Angle between vectors (a.k.a. scalar product, inner


product)

x · y = x T y = x1 y1 + x2 y2 + · · · xn yn = kxkky k cos α

Triple product Volume (from vector product / cross product)

x T (y × z)

Remember: cross product wikipedia

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 15/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Outline
Centre de la Imatge i la Tecnologia Multimèdia

4 Degrees of freedom in
Rotations
1 Attitude representation
5 Dualism with change of
2 Linear transformations basis

3 Rotations 6 Concatenation of Linear


transformations

7 Homework

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 16/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

DoFs in Rotations
Centre de la Imatge i la Tecnologia Multimèdia
In R3

Rotations in R3 can be defined with 3 parameters


Let E = {e 1 , e 2 , e 3 } be an orthonormal basis of R3 and let a Rotation R
be defined as R(x) = Rx, with
 
a11 a12 a13
R = a21 a22 a23  (9 DoF)
a31 a32 a33

then {R(e 1 ), R(e 2 ), R(e 3 )} is also an orthonormal basis of R3 , so


accomplishing 6 restrictions,

R(e j )T R(e i ) = 1 if j = i , R(e j )| R(e i ) = 0 if j 6= i

leading to 3 DoF.

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 17/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

DoFs in Rotations
Centre de la Imatge i la Tecnologia Multimèdia
In R3

Equivalent restrictions
The 6 restrictions over matrix R about orthonormality are equivalent to
state that,
det(R) = 1, and
R| = R−1

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 18/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

DoFs in Rotations
Centre de la Imatge i la Tecnologia Multimèdia
An aside (II)

The Grassman rule


The Determinant of a 3 × 3 marix can be calculated using the Grassman
rule
m11 m12 m13
det(M) = |M| = m21 m22 m23 =
m31 m32 m33
m11 m22 m33 + m21 m32 m13 + m31 m12 m23 −
−(m11 m23 m32 + m21 m12 m33 + m31 m22 m13 )

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 19/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

DoFs in Rotations
Centre de la Imatge i la Tecnologia Multimèdia
Three Exercises

Geometric meaning
Let R(v ) = Rv represent a rotation of 90 degs about the z
axis.
1 What are the elements in matrix R for this case? (Hint: z
remains, x goes to y and y goes to −x)
|
2 Which are the images for the vectors, v1 = (1, 0, 0) ,
| | |
v2 = (0, 1, 0) , v3 = (0, 0, 1) , and v4 = (−1, 2, 2) ?
3 Which rotation matrix R performs the inverse rotation?

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 20/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Outline
Centre de la Imatge i la Tecnologia Multimèdia

4 Degrees of freedom in
Rotations
1 Attitude representation
5 Dualism with change of
2 Linear transformations basis

3 Rotations 6 Concatenation of Linear


transformations

7 Homework

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 21/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Dualism with change of basis


Centre de la Imatge i la Tecnologia Multimèdia
Rotations & change of basis

Change of basis
C
B2 −
→ B1

1 C is a matrix whose columns are the vectors in basis B2 seen from


B1 .
2 Cx means “I take a vector x of B2 and it goes to B1 ”

Exercise
Applying dualism, rotates vector x like in the previous
exercise, i.e. rotates 90 degs about the z axis.

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 22/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Take care I
Centre de la Imatge i la Tecnologia Multimèdia
Rotations & change of basis
Take the rotation matrix
 
1 −1 0
1
R = √ 1 1 √0 ,

2 0 0 2
| √ |
and the vector p = (1, 0, 1) , then: p 0 = Rp = √1
2
1, 1, 2

Rotations
If we are talking about rotations, we meant

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 23/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Take care II
Centre de la Imatge i la Tecnologia Multimèdia
Rotations & change of basis
Take the rotation matrix
 
1 −1 0
1 
R= √ 1 1 √0 ,

2 0 0 2
| √ |
and the vector Ap = (1, 0, 1) , then: B
p = R Ap = √1 1, 1, 2
2

Change of basis
If we are talking about change of basis, we meant

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 24/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Outline
Centre de la Imatge i la Tecnologia Multimèdia

4 Degrees of freedom in
Rotations
1 Attitude representation
5 Dualism with change of
2 Linear transformations basis

3 Rotations 6 Concatenation of Linear


transformations

7 Homework

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 25/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Concatenation
Centre de la Imatge i la Tecnologia Multimèdia
Linear transforms

Definition
Let T1 (x) = Ax and T2 (x) = Bx be linear transformations, then the
concatenation
T2 (T1 (x)) = BAx
is also a linear transformation.
Note the order!!!, BA 6= AB
The same definition applies to rotations.

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 26/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Outline
Centre de la Imatge i la Tecnologia Multimèdia

4 Degrees of freedom in
Rotations
1 Attitude representation
5 Dualism with change of
2 Linear transformations basis

3 Rotations 6 Concatenation of Linear


transformations

7 Homework

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 27/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Exercise 1
Centre de la Imatge i la Tecnologia Multimèdia
Homework

Exercise 1
Given the next two transformations, find which of them are linear
transformations and which of them are rotations and argument why.

1 T1 (x) : R3 → R3
 √ 
3
2 x1 + x2
T1 (x) = 3 − x3 + √13 
 
x1

2 T2 (x) : R3 → R3
 √ 
1 2
(x√1 + x3 ) − 2 x2
2
T2 (x) =  2
2 (x3 − x2 )
 

1 √1 x2
2 (x 1 + x 3 ) + 2

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 28/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Exercise 2
Centre de la Imatge i la Tecnologia Multimèdia
Homework

Exercise 2
Two vectors v1 and v2 have known components on two orthonormal basis
{A} and {B}
| √ |
A
v 1 = (1, 0, 0) B
v 1 = 12 √3, 1, 0 √
A | |
v 2 = (1, 1, 0) B
v 2 = 12 3 − 1, 1 + 3, 0

Calculate the components of the vector p in the frame {A}, that is


A
p , if it is known that in the frame {B} the vector is given by:
 |
B 1
p = 3, −2,
2

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 29/30


Attitude L. T. Rotations DoFs in Rotations Dualism Concatenation HW

Exercise 3
Centre de la Imatge i la Tecnologia Multimèdia
Homework

Exercise 3
The matrix  
a1 −0.2655 −0.2113
R = a2 0.9640 −0.0726
a3 a4 0.9747
represents a rotation. Which are the values of a1 , a2 , a3 and a4 ?

J. Cayero & C. Angulo — Linear Transformations & Rotation Matrices 30/30

You might also like