











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












Computer GraphicsIntroduction to Transforms, 2D transforms
n Transformation changes an objects: n Position (translation) n n Size (scaling)Orientation (rotation) n Shapes (shear) n We will introduce first in 2D or (x,y) , build intuition n Later, talk about 3D and 4D? n Transform object by applying sequence of matrixmultiplications to object vertices
n We use a column matrix (2x1 matrix) to represent a 2Dpoint
n General form of transformation of a point can be written as: (x,y) to (x’,y’)
yx
x '= ax + by + c y '= dx + ey + f
n To reposition a point along a straight line n Given point (x,y) and translation distance (tx, ty) n The new point: (x’,y’) x’=x + tx y’=y + ty (x,y)
(x’,y’) or
ßHow to translate an object with multiple vertices?
Translate individualvertices
ßScale: Alter object size by scaling factor (sx, sy). i.e
(1,1)
(2,2) Sx = 2, Sy = 2 (2,2)
(4,4)
yx '' = Sx 0 Sy^0 yx
n Y coordinates are unaffected, but x cordinates are translatedlinearly with y n That is: n y’ = y n x’ = x + y * h
∗
=
0 0 1 1
0 1 0 1 0 1
y h x y x
ßh is fraction of y to be added to x
ßDefault rotation center is origin (0,0)
θ θ> 0 :^ Rotate counter clockwise
θ^ θ< 0 :^ Rotate clockwise
(x,y)
(x’,y’) θ
Matrix form? 3 x 3?
Using trig identities
(x,y)
(x’,y’) θ
= ^ − y
x y
x sin( ) cos( )
cos( ) sin( ) '
' θ θ
θ θ
0 0 1 1
sin( ) cos( ) 0
cos( ) sin( ) 0 1
'
' y
x y
x θ θ
θ θ
n To rotate about arbitrary point P = (Px, Py) by n Translate object by T(-Px, -Py) so that P coincides with origin θ : n n Rotate the object by R(Translate object back: T(Px, Py)θ) n In matrix form: T(Px,Py) R(θ) T(-Px,-Py) * P
sin( ) cos( ) 0
cos( ) sin( ) 0 0 0 1
y
x Py
Px Py
Px y
x θ θ
θ θ
ßSimilar for arbitrary scaling anchor,
n Composing transformation – applying several transformsin succession to form one overall transformation n Example: M1 X M2 X M3 X P where M1, M2, M3 are transform matrices applied to P n Be careful with the order n For example: n Translate by (5,0) then rotate 60 degrees is NOT same as n Rotate by 60 degrees then translate by (5,0)
n Hill, chapter 5.