Linear and affine transformations
• Linear Algebra Review ▪ Matrices ▪ Transformations • Affine transformations in Euclidean space
Tricky examples of nonlinear transformations (Youtube)1
Geometric transformations
• Geometric transformations map points in one space to points in another: (x',y',z') = f(x,y,z), i.e. in vector form X’ = f(X) • These transformations can be very simple, such as scaling each coordinate, or complex, such as non-linear twists and bends. • We'll focus on transformations that can be represented easily with matrix operations. • We'll start in 2D...
1 2D Affine Transformations
• An affine transformation is any transformation that preserves co-linearity (i.e., all points lying on a line initially still lie on a line after transformation) and ratios of distances (e.g., the midpoint of a line segment remains the midpoint after transformation).
3
)
LENGTHS
ONGRUENCE
(C
RESERVES
P
SOMETRY I
After any of those transformations (turn, flip or slide), the shape still has the same size, area, angles and line lengths.
2 ) When you resize a shape it gets bigger or smaller. ... but it still looks similar:
all angles are the same
ESIZING
ANGLES (R
The face and body are still in proportion
RESERVES
IMILARITY
P S
5
Affine transformation preserves parallelism,
dividing proportion, linearity and incidence. LINE Similarity and congruence can be viewed as a
special case of the affine transformation.
PROPORTION
PARALLEL
FFINITY
A
DIVIDING
RESERVES
AND P
6
3 )
ROJECTIVE The projective transformation does not
(P preserve parallelism, length, and angle. But it still preserves collinearity
and incidence.
OMOGRAPHY H
7
4 Linearity Parallel Angle Length
X X X
X X
X
9
Matrix Multiplication if A is an n × m matrix and B is an m × p matrix, their matrix product AB is an n × p matrix, in which the m entries across a row of A are multiplied with the m entries down a column of B and summed to produce an entry of AB.
A . B
November 10, 2020 10
5 Matrix Multiplication is not commutative
122044 = 3412108
201224 = 1234710
Expand vector notation for linear equations
Solution x = Ax x = Ax xx xx== , xx 21 yy = yy 01− 21 A = x =+21 x y 01− y'0=− x y
6 ◼ The linear transformation given by a matrix
Let A be an 2 2 matrix. The function T defined by T(v) = Av is a linear transformation from R2 into R2.
◼ Note: xAx = xabx = ycdy xaxby =+ ycxdy' =+
◼ The linear transformation given by a matrix
Let A be an mn matrix. The function T defined by
is a linear transformation from Rn into Rm. Rn vector Rm vector ◼ Note:
a 11 aava 121111 v 1 a 12nn va 21 n v ++ + a aava v a va v ++ + Av == 21 222221 1 22nn 22 n am 121 aava12 mmn 2 v nmmmn a van v ++ +
T(v) = Av T : Rn ⎯⎯ → Rm
7 ◼ Two representations of the linear transformation T:R3→R3 :
(1)T(x1, x2 , x3 ) = (2x1 + x2 − x3,−x1 + 3x2 − 2x3,3x2 + 4x3 )
2 1 −1x1 (2)T(x) = Ax = −1 3 − 2x 2 0 3 4 x3
◼ Three reasons for matrix representation of a linear transformation:
◼ It is simpler to write.
◼ It is simpler to read.
◼ It is more easily adapted for computer use.
Representation of 2D linear map
• We can represent a 2-D transformation M by a matrix a b M = c d • If x is a column vector, M goes on the left: x' = Mx x a b x = y c d y • If x is a row vector, MT goes on the right: xxM = T ac xyxy = bd • We will use column vectors.
8 Property of Linear Transforms
• Basis vectors map to columns of matrix. • Origin (0,0) is always fixed point. • Composition of M and M-1 gives identity. • Determinant det(M) is scaling factor of the linear transformation described by the matrix M. xMx' = xMx = xabx = abxaxby + ycdy Mx== cdycxdy +
abaabb 10 == cdccdd 01 (1, 0)
Scaling by 0.5 xMx =
M = .50 0.5
(1, 0) (0.5, 0)
(0, 1) (0, 0.5)
November 10, 2020 18
9 Scaling by 0.5 x M = x 1 y d e t( )M = y 4 0.5 0 −1 M = d e t( )M 4 = 0 0.5
−1 20 M = x 02 x
Inverse mapping = scaling by 2
Composition of M and M-1 gives identity. Determinant is scaling factor of the linear transformation described by the matrix.
Homothety - Scaling
November 10, 2020 20
10 Homothety - Scaling
Describe the transformation represented by matrix S = {{2,0},{0,2}}. Find all fixed points and directions. List all invariants. 20 S = 02 Fixed points: ';'XXXSX== xx= 2 xy==0,0 XSX= yy= 2 Only one fixed point (0, 0).
Fixed directions: v';'==vvSv xxx=−=2(2)0 vSv= yyy=−=2(2)0 = 2,,xRyR All directions are fixed.
General Scaling
xx = scaless(,)xy y y
1 scaless( xy, ) = sy
sx 0 0 sy
x x 1 sx
11 General Scaling
General Scaling
Describe the transformation represented by matrix S = {{2,0},{0,1}}. Find all fixed points and directions. List all invariants. 20 S = 01 Fixed points: X '== X ; X ' SX xx= 2 xyR=0, XSX= yy= FP= (0,ttR ),.
Fixed directions: v';== 'v vSv x=2 x x ( − 2) = 0 vS= v y= y y( − 1) = 0 =2,x R , y = 0; fd = ( t ,0) =1,x = 0, y R ; fd = (0, t ) 2 fixed directions: [(1,0)] and [(0,1)].
12 Scaling of a circle
x x = xy22+=1 xx = M a 22 −1 y xy xx= M y = +=1 b ab
y a 0 y M = 0 b
b 1 0 −1 a x M = a 1 1 x 0 b
Real image
? Driver’s eye 1m
5 m
13 Shear-x x M = x
y y
1 s 01
x x
Rotation xx = Rt()
cossin(tt) − ( ) rot (t) = sincos(tt) ( )
t sin(t) cos(t)
-sin(t)
t cos(t)
November 10, 2020 28
14 Trajectory of point A = (r, 0) in revolution xx = R
cossin() − ( ) RR==;det()1 sincos() ( ) y
xr cossin() − ( ) = y sincos() ( ) 0 xr =cos A’ yr =sin
A x GeoGebra book 2.1 Rotace
Exercise: Rotation xx = R()
Estimate parameter a so that matrix B represents revolution about origin. Find all fixed points and directions.
2 a − 2 B = cos() − sin ( ) 2 R( ) = a sin cos 2 ( ) ( )
1. method: comparing elements R and B. 22 sin= a = cos = 22 2. method: 2 det(Ba )= 1 2 + = 1 4 Matrix Representation of rotation
15 22 − 22 Rotation B = 22 Find all fixed points. 22 xxxx==B , xxx=−=BBEo ()
GeoGebra tool ReducedRowEchelonForm(M)eliminates non diagonal elements by row operations (= Gaussian elimination). 10 ()BE− 01 Using back-substitution, unknowns x, y can be solved for. Solution x = 0 and y = 0 gives only one fixed point FP = (0,0).
22 − 22 Rotation B = 22 Find all fixed directions. 22 x=B x, x = x x=B x () B − E x = o
Matrix(B-E)must be singular for non trivial solutions x, but Det(B-E)=0 has no real solution.
22 −− 22 BE−== 0 22 − 22
General rotation hasn’t fixed directions.
16 Reflection in y-axis xx = r e f y
refy = −10 01
November 10, 2020 33
Reflection in y-axis
y y
refy = −10 01
x x
November 10, 2020 34
17 Line reflection
Reflection in the line y= x
18 Composing Linear Transformations
TM11()vv= • If T1 and T2 are transformations TM22()vv= ▪ T2 T1(v) =def T2( T1(v))
• If T1 and T2 are represented by matrices M1 and M2
▪ T2 T1 is represented by M2 M1
▪ T2 T1(v) = T2( T1(v)) = (M2 M1)(v)
• Order is important! reflect(x) (rot(O,훂)): A → A’ → A’’ rot(O,훂) (reflect(x)): A → A → A’
AA'Rot=
AA''Ref'= 37
Composing Linear Transformations
• Order is important! reflect(x) (rot(O,훂)): A → A’ → A’’ rot(O,훂) (reflect(x)): A → A → A’
AAAA'= Rot '' = Ref ' cos− sin 1 0 Rot== ; Ref sin cos 0− 1 cos sin Rot*Ref = sin− cos cos− sin Ref*Rot = −−sin cos 38
19 Composition of Linear Transformations
Composition of linear transformations 39
*Decomposing Linear Transformations • Any 2D Linear Transformation can be decomposed into the product of a rotation, a scale (or line reflection), and a rotation
M = R1SR2 .
• Any 2D congruence can be decomposed into the product of 3 line reflection at the most.
Isometry (congruent transformation) • Isometry preserves length, whereas direct isometry preserves orientation and opposite does not preserve orientation • Direct Isometry |R| = 1 (Rotation) • Opposite Isometry |R| = -1 (Line Reflection)
20 Linear Transformations
• Scale, Reflection, Rotation, and Shear are all linear transformations • They satisfy: T(au + bv) = aT(u) + bT(v) ▪ u and v are vectors ▪ a and b are scalars • If T is a linear transformation ▪ T((0, 0)) = (0, 0) • What important operation does that leave out?
Linear transformation
Affine transformation
42
21 Rotation about an Arbitrary Point y y
x x
This is not a linear transformation. The origin moves.
Translation
y (x, y)→(x+a,y+b) y
(a, b)
x x
This is not a linear transformation. The origin moves.
22 Homogeneous Coordinates y Embed the xy-plane in R3 at z = 1. y (x, y) (x, y, 1)
x x X A' X= z xaaxa'0 xay11121112 + yaayaxay'0 ==+ 21222122 z '00111
2D Linear Transformations as 3D Matrices Any 2D linear transformation can be represented by a 2x2 matrix
aaa11121112 xa yx + = aaa21222122 xa yy + or a 3x3 matrix
a11 a 120 x a 11 x+ a 12 y a a0 y =+ a x a y 21 22 21 22 0 0 1 1 1
23 2D afinne transformation
Image of a point (x, y, 1)T
xefmxe' xfym1111 ++ yefnyexfyn' ==++ 2222 100111
Image of a vector (x, y, 0)T
xefmxe' xfy1111 + yefnyexfy' ==+ 2222 000100
2D afinne transformation
Image of a origin (0, 0, 1)T is 3rd column.
x'0 e11 f m m y'0 == e f n n 22 1 0 0 1 1 1
Image of a basis vectors (1, 0, 0)T, (0, 1, 0)T are 1st and 3rd columns. e f m1 e 1 1 1 e1 f 1 m 0 f 1 e f n0 = e e f n 1 = f 2 2 2 2 2 2 0 0 1 0 0 0 0 1 0 0
24 2D Linear Translations as 3D Matrices
Any 2D translation can be represented by a 3x3 matrix.
10 axxa + 01 byyb =+ 00111
With homogeneous coordinates, we can represent all 2D affine transformations as 3D linear transformations. We can then use matrix multiplication to transform objects.
Rotation 180° about an arbitrary point
Z_affine_reflectionPoint.ggb November 10, 2020 50
25 Recall that the column vectors of the matrix M are given by images of the basis vectors and origin O(0, 0).
Affine transformation
Windowing Transforms Windowing is the process of transforming co-ordinates from one space to another. It is used when scaling and transforming the view of a program. For example: when you zoom into an image, the original image data is transformed to fill the current screen. (A,B)
(a,b) translate (A-a,B-b)
scale (C,D) (C-c,D-d)
translate (c,d) November 10, 2020 53
26 Fixed point of the plane isometry
Classify the transformation A. Determine all fixed points and directions.
0 1 6− vv = 01− A = v= Av 10 A = 1 0 1 0 0 1 ( A−= E) v o
Determinant A = 1, first two orthonormal columns yields the congruent transformation. Vectors could be investigated by linear part of matrix A. Translation has no influence on vectors. AE−=+=2 10
Characteristic polynomial has only complex solution. Isometry without fixed direction is rotation.
Fixed point of the plane isometry
Classify the transformation A. Determine all fixed points.
XX = XAX= ( AEXo−=) * −1 − 1 6 − 1 − 1 6 1 0 − 2.5 ( AE−) =1 − 1 1 0 − 2 7 0 1 − 3.5 0 0 0 0 0 0 0 0 0
GeoGebra tool ReducedRowEchelonForm(M)provides Gaussian elimination with echelon form *. Using back- substitution, unknowns x, y can be solved for. Transformation has only one fixed point FP = ( 2.5, 3.5).
27 Fixed point of the plane isometry
Classify the transformation A. Determine all fixed points. * 102.50− x 013.50−= y 00010 x −=2.50 y −=3.50
GeoGebra tool ReducedRowEchelonForm(M)provides Gaussian elimination with echelon form *. Using back- substitution, unknowns x, y can be solved for. Transformation has only one fixed point FP = ( 2.5, 3.5).
3D Transformations
x Remember: x y y z z 1 A 3D linear transformation can be represented by a 3x3 matrix. aaa 0 aaa 111213 111213 aaa 0 aaa 212222 212223 aaa313233 0 aaa313233 0001
November 10, 2020 57
28 3D Affine Transformations
sx 000 000s y scale,,(sssxyz ) = 000 sz 0001
100 tx 010 t y translate,,(tttxyz ) = 001 tz 0001 58
3D Rotations
1000 0 cossin0() − ( ) rotate ( ) = x 0 sincos0() ( ) 0001 cos0() sin0 ( ) 0100 rotate ( ) = y −sin0() cos0 ( ) 0001 cos() − sin( ) 0 0 sin() cos( ) 0 0 rotate ( ) = z 0 0 1 0 0 0 0 1 59
29