Computer Graphics: (Lecture 8)
Computer Graphics: (Lecture 8)
(Lecture 8)
2D Transformations
Rotation changes the position and orientation of shapes by rotating
each of the points in the shape around a common point, or center of
rotation.
Rotation Proof
2D Transformations
Translation simply moves an objects position by given offset.
This is performed by adding the translation vector to the all co-
ordinates within the object.
Homogeneous Coordinates
y y y y
Shx=2 Shy=2
x x x x
3D Transformation
Elemental Transformations:
Translation
Rotation
Scaling
Shearing
Three of them are affine and linear:
Rotation, Scaling, and Shearing
One is affine but non-linear
Translation
Definitions of Transformations
Projective ⊃ Affine ⊃ Linear
Meaning that all linear transforms are also affine transforms, which are also
projective transforms.
However, not all affine transforms are linear transforms, and not all
projective transforms are affine.
Definitions of Transformations
Definitions:
Linear Transform:
Preserves parallel lines
Acts on a line to yield either a line or a point
The vector [0, 0] is always transformed to [0, 0]
Examples: scale and rotate
Affine Transform:
Preserves parallel lines
Acts on a line to yield either a line or a point
The vector [0, 0] is NOT always transformed to [0, 0]
Examples: translate
Projective Transform:
Does NOT preserve parallel lines
Acts on a line to yield either a line or a point
The vector [0, 0] is NOT always transformed to [0, 0]
Examples: perspective camera
Definitions of Transformations
3D Translation
Translation by (tx, ty, tz) is achieved using the following matrix:
1 0 0 tx
0 1 0 ty
M T (t x , t y , t z )
0 0 1 tz
0 0 0 1
Y -z
-x
(2,0,-4)
(4,0,-2)
-y
Z
Scaling with respect to a selected point
Solution:
1: Translate the object to system origin by T(-2,0,4)
2: Scale the object by S (2,1,0.5)
3:Translate the object back to (2,0,-4) by T (2,0,-4)
p’ = T-1.S.T .p
transformation
Scaling with respect to a selected point
Y -z Y -z
Y -z
-x -x
-x
-y -y -y
Z Z Z
𝑥′ 1 0 0 2 2 0 0 −4 𝑥
𝑦′ 0 1 0 0 0 1 0 0 𝑦
=
𝑧′ 0 0 1 −4 0 0 0.5 2 𝑧
1 0 0 0 1 0 0 0 1 1
𝑥′ 2 0 0 −2 𝑥
𝑦′ 0 1 0 0 𝑦
=
𝑧′ 0 0 0.5 −2 𝑧
1 0 0 0 1 1