CE-201CE201_Week9-10_2010
-
Upload
chandankrdumka -
Category
Documents
-
view
215 -
download
0
description
Transcript of CE-201CE201_Week9-10_2010
![Page 1: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/1.jpg)
INDIAN INSTITUTE OF TECHNOLOGY ROORKEEDEPARTMENT OF CIVIL ENGINEERING
CE‐201: Computer Aided GraphicsWeek 09‐10
Rajat Rastogi
[email protected]@iitr.ernet.in
![Page 2: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/2.jpg)
Previous LecturePrevious Lecture
• Output PrimitivesOutput Primitives– Line
Fill– Fill
– Text
Ch t– Character
![Page 3: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/3.jpg)
Lecture outlineLecture outline
• 2‐D Geometric Transformation2 D Geometric Transformation– Basic Transformation
Composite Transformation– Composite Transformation
– Other Transformation
![Page 4: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/4.jpg)
TransformationsTransformations
• Transformation of an object means transforming allTransformation of an object means transforming all its points
• Transformation of a polygon can be achieved by p yg ytransforming its vertices
4
![Page 5: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/5.jpg)
Basic TransformationsBasic Transformations
• ScaleScale
• Rotate
l• Translate
![Page 6: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/6.jpg)
Basic Transformations…1Basic Transformations…1
ScaleModeling Coordinates
ScaleTranslatey
x
ScaleRotateTranslateTranslate
World Coordinates
![Page 7: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/7.jpg)
Basic Transformations…2Basic Transformations…2Modeling Coordinates
y
x
Initial locationat (0, 0) withx- and y-axesaligned
![Page 8: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/8.jpg)
Basic Transformations…3Basic Transformations…3Modeling Coordinates
y
x
Scale .3, .3Rotate -90Translate 5, 3
![Page 9: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/9.jpg)
Basic Transformations…4Basic Transformations…4
Modeling Coordinates
y
x
Scale .3, .3Rotate -90Translate 5, 3
![Page 10: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/10.jpg)
Basic Transformations…5Basic Transformations…5
Modeling Coordinates
y
x
Scale .3, .3Rotate -90Translate 5, 3
World Coordinates
![Page 11: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/11.jpg)
ScalingScaling
• A scaling transformation alters the size of an object.A scaling transformation alters the size of an object.
• Scaling a coordinate means multiplying each of its components by a scalar or scaling factor (sx and sy)p y g ( x y)
• Transformed coordinates will be:x’ = x . sx y’ = y . sy (1)x y y y ( )
• This can be written in matrix form as
⎤⎡⎤⎡⎤⎡ xsx 0'(2)⎥
⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡yx
ss
yx
y
x .0
0''
![Page 12: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/12.jpg)
Scaling…1Scaling…1
• Uniform scaling means this scalar is assigned the g gsame value for all the components
× 2
![Page 13: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/13.jpg)
Scaling…2Scaling…2
• Non‐uniform scaling: Different scalars are used for gthe two coordinates
X × 2,Y × 0.5
• Scaling also reposition the transformed objects with respect to the coordinate originrespect to the coordinate origin.
![Page 14: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/14.jpg)
Scaling…3Scaling…3
• A fixed point is used to control the change in positionA fixed point is used to control the change in position of an object after Scaling operation. This fixed point may be a vertex or a centre or any other position on an object. If (xf, yf) are the coordinates of a fixed point, then,
x’ = xf + (x – xf). sx y’ = yf + (y – yf). sy (3)
x’ = x . sx + (1 – sx). xfy’ = y s + (1 s ) y (4)y = y . sy + (1 – sy). yf (4)
– This is a combination of multiplicative and additive terms
![Page 15: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/15.jpg)
Scaling…4Scaling…4
• General form of a scaling matrix with respect to aGeneral form of a scaling matrix with respect to a fixed point P(h, k).
TSTS vbavPba TSTS .. ,,, −=
⎟⎞
⎜⎛
⎟⎞
⎜⎛
⎟⎞
⎜⎛ − 010001 hah
⎞⎛
⎟⎟⎟
⎠⎜⎜⎜
⎝⎟⎟⎟
⎠⎜⎜⎜
⎝⎟⎟⎟
⎠⎜⎜⎜
⎝
−=100
1010000
10010 kbk
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−−
=100
00
kbkbhaha
⎠⎝ 100
![Page 16: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/16.jpg)
2‐D Rotation2 D Rotation
• Two dimensional rotation is applied to an object byTwo dimensional rotation is applied to an object by repositioning it along a circular path in the xy plane.
• Two information are required: P΄q– Rotation angle θ– Pivot point or rotation point (xr, yr)
θ
P(Xr yr) P
• Positive values of rotation angle define counterclockwise rotation about the pivot point and negative values rotate object in clockwise direction
![Page 17: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/17.jpg)
2‐D Rotation…1
x = r cos (φ)
2 D Rotation…1
y = r sin (φ) (5)
x’ = r cos (φ + θ)y’ = r sin (φ + θ) (6)
(x’, y’)
• Trig Identity…x’ = r cos(φ) cos(θ) – r sin(φ) sin(θ)(x, y)
r x r cos(φ) cos(θ) r sin(φ) sin(θ)y’ = r sin(φ) sin(θ) + r cos(φ) cos(θ) (7)
• Substituter
r
• Substitute…x’ = x cos(θ) ‐ y sin(θ)y’ = x sin(θ) + y cos(θ) (8)
φθφ
![Page 18: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/18.jpg)
2‐D Rotation…22 D Rotation…2
• This is easy to capture in matrix form:y p
(9)( ) ( )( ) ( ) ⎥
⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡ −=⎥
⎦
⎤⎢⎣
⎡yx
yx
θθθθ
cossinsincos
''
• Even though sin(θ) and cos(θ) are nonlinear functions of θ,
( ) ( ) ⎦⎣⎦⎣⎦⎣ yy
– x’ is a linear combination of x and y– y’ is a linear combination of x and y
• If pivot point is (x y ) instead of (0 0) then• If pivot point is (xr, yr) instead of (0, 0), thenx’ = xr + (x – xr) cosθ ‐ (y – yr) sinθy’ = yr + (x – xr) sinθ + (y – yr) cosθ (10)
![Page 19: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/19.jpg)
Example 1Example 1
• Find the matrix that ⎞⎛represent rotation of an
object by 30o about origin and the new coordinates of ⎟
⎟⎟⎟⎞
⎜⎜⎜⎜⎛
−=⎥
⎦
⎤⎢⎣
⎡ −
3121
23
30cos30sin30sin30cos
and the new coordinates of a point (2, ‐4) after rotation
⎟⎞
⎜⎛ +⎟
⎞⎜⎛⎟⎟⎞
⎜⎜⎛
−
⎟⎠
⎜⎝
23221
23
22
⎟⎟⎠
⎞⎜⎜⎝
⎛
−+
=⎟⎟⎠
⎞⎜⎜⎝
⎛−
⎟⎟⎟
⎠⎜⎜⎜
⎝32123
42
23
21
22
![Page 20: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/20.jpg)
Example 2Example 2
• Describe the transformation that rotates an objectDescribe the transformation that rotates an object point, Q(x,y), θ0 about a fixed center of rotation P(h, k)– Transformation Rθ,p is done in 3 steps:
1. Translate so that the centre of rotation P is at the origin,
2. Perform a rotation of θ degrees about the origin, and
3. Translate P back to (h, k).
Find R b sing transformation• Find Rθ,p by using transformation:
Rθ,p = T‐v × Rθ × Tv
![Page 21: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/21.jpg)
Example 2…1Example 2…1
• Describe the transformation that rotates an objectDescribe the transformation that rotates an object point, Q(x,y), θ0 about a fixed center of rotation P(h, k)– General form of the matrix would be:
⎟⎞
⎜⎛
⎟⎞
⎜⎛ −
⎟⎞
⎜⎛ − 010sincos01 hh θθ
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛×⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛×⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−=
10010
1000cossin
10010, kkR p θθθ
⎟⎟⎞
⎜⎜⎛
+−−++−−
= )cossin(cossin)sincos(sincos
kkhhkh
θθθθθθθθ
⎟⎟
⎠⎜⎜
⎝ 100)(
![Page 22: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/22.jpg)
TranslationTranslation
• Translation transformation reposition an object alongTranslation transformation reposition an object along a straight line path
• Translation distance is added to the original gcoordinates to move to a new position
• A point moves from (x, y) to (x’, y’), thenp y y– x’ = x + tx, y’ = y + ty (11)
• Translation distance pair (tx, ty) isP’
T tx ycalled a translation vector or a shift vector
P
ty
tx
![Page 23: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/23.jpg)
Translation…1Translation…1
• In matrix form, it can be defined as:In matrix form, it can be defined as:
(12)⎥⎦
⎤⎢⎣
⎡+⎥
⎦
⎤⎢⎣
⎡=
⎥⎥⎦
⎤
⎢⎢⎣
⎡
y
xtt
yx
yx
'
'
• This is a rigid body transformation that moves objects without deformation.
⎦⎣⎦⎣⎥⎦⎢⎣ yyy
2
1
![Page 24: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/24.jpg)
2D Transformation2D Transformation
⎤⎡⎤⎡ +⎤⎡⎤⎡ '(x’,y’)
⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡++
=⎥⎦
⎤⎢⎣
⎡+⎥
⎦
⎤⎢⎣
⎡''
yx
byax
ba
yx
),( ba(x,y)
( ) ( )( ) ( ) ⎥
⎤⎢⎡⎥⎤
⎢⎡ −
=⎥⎤
⎢⎡ xx θθ sincos'
⎥⎤
⎢⎡⎥⎤
⎢⎡
=⎥⎤
⎢⎡ xax 0'
( ) ( ) ⎥⎦
⎢⎣⎥⎦
⎢⎣
⎥⎦
⎢⎣ yy θθ cossin'⎥
⎦⎢⎣⎥⎦
⎢⎣
⎥⎦
⎢⎣ yby 0'
scaling matrix rotation matrixscaling matrix rotation matrix
24
![Page 25: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/25.jpg)
2D Transformation…12D Transformation…1
⎤⎡⎤⎡ +⎤⎡⎤⎡ '(x’,y’) vector addition
⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡++
=⎥⎦
⎤⎢⎣
⎡+⎥
⎦
⎤⎢⎣
⎡''
yx
byax
ba
yx
),( ba(x,y)
( ) ( )( ) ( ) ⎥
⎤⎢⎡⎥⎤
⎢⎡ −
=⎥⎤
⎢⎡ xx θθ sincos'
⎥⎤
⎢⎡⎥⎤
⎢⎡
=⎥⎤
⎢⎡ xax 0'
matrix multiplicationmatrix multiplication
( ) ( ) ⎥⎦
⎢⎣⎥⎦
⎢⎣
⎥⎦
⎢⎣ yy θθ cossin'⎥
⎦⎢⎣⎥⎦
⎢⎣
⎥⎦
⎢⎣ yby 0'
scaling matrix rotation matrixscaling matrix rotation matrix
25
![Page 26: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/26.jpg)
2D Transformation…22D Transformation…2
⎤⎡⎤⎡ +⎤⎡⎤⎡ '(x’,y’) vector addition
⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡++
=⎥⎦
⎤⎢⎣
⎡+⎥
⎦
⎤⎢⎣
⎡''
yx
byax
ba
yx
),( ba(x,y)
( ) ( )( ) ( ) ⎥
⎤⎢⎡⎥⎤
⎢⎡ −
=⎥⎤
⎢⎡ xx θθ sincos'
⎥⎤
⎢⎡⎥⎤
⎢⎡
=⎥⎤
⎢⎡ xsx x 0'
matrix multiplicationmatrix multiplication
( ) ( ) ⎥⎦
⎢⎣⎥⎦
⎢⎣
⎥⎦
⎢⎣ yy θθ cossin'⎥
⎦⎢⎣⎥⎦
⎢⎣
⎥⎦
⎢⎣ ysy y0'
scaling matrix rotation matrixscaling matrix rotation matrix
⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡''
yx
yx
dcba
26
⎦⎣⎦⎣⎦⎣ yydc
translation multiplication matrix??
![Page 27: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/27.jpg)
Matrix RepresentationMatrix Representation
• Represents 2D transformation with matrixRepresents 2D transformation with matrix
– Multiply matrix by column vector to apply transformation to a pointtransformation to a point
⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡ xdbax
''
dbyaxx +=
''
• In case a sequence of transformations have to be li d th h t b d i t b t
⎥⎦
⎢⎣⎥⎦
⎢⎣
⎥⎦
⎢⎣ ydcy' dycxy +='
applied, these have to be done in step by step procedure, applying one transformation at a time
27
![Page 28: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/28.jpg)
Matrix Representation…1Matrix Representation…1
• A more efficient approach would be to combine theA more efficient approach would be to combine the transformations so that the final coordinates can be obtained directly from the initial coordinates.
• Transformations combined by multiplication
⎤⎡⎤⎡⎤⎡⎤⎡⎤⎡ ihdb'⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡yx
kjih
gfed
dcba
yx
''
– This needs replacement of a 2x2 matrix by a 3x3 matrix
28
![Page 29: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/29.jpg)
Homogeneous CoordinatesHomogeneous Coordinates
point in 2D cartesian• point in 2D cartesian
yy⎤⎡
29xx
yy⎥⎦
⎤⎢⎣
⎡yx
![Page 30: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/30.jpg)
Homogeneous Coordinates...1Homogeneous Coordinates...1
• ‘w’ is a non‐zero value
• Infinite homogenous representations
• Simplest form (x, y, 1)
– Forms a line L in 3D
All homogeneous points– All homogeneous points on L represent same 2D Cartesian point
– Example: (2,2,1) = (4,4,2) = (1,1,0.5)HomogeneousHomogeneous CartesianCartesian
30
),,( wyx hh ),(wy
wx hh
![Page 31: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/31.jpg)
Homogeneous Coordinates…2Homogeneous Coordinates…2
• The basic transformation matrices would be:The basic transformation matrices would be:
⎥⎥⎤
⎢⎢⎡ −
= 0)cos()sin(0)sin()cos(
θθθθ
otationR⎥⎥⎤
⎢⎢⎡
= 0000
y
xs
scaleS
⎥⎥⎦⎢
⎢⎣
=1000)cos()sin( θθotationR
⎥⎤
⎢⎡ 01 xt
⎥⎥⎦⎢
⎢⎣ 100
00 yscaleS
• Example: Translation⎥⎥⎥⎥
⎦⎢⎢⎢⎢
⎣
=100
10 y
xtranslationT
• Example: Translation
⎥⎥⎤
⎢⎢⎡
++
=⎥⎥⎤
⎢⎢⎡
∗+∗∗+∗
=⎥⎥⎤
⎢⎢⎡
⎥⎥⎤
⎢⎢⎡
1111
1001
byax
byax
yx
ba
31
⎥⎥⎦⎢
⎢⎣⎥
⎥⎦⎢
⎢⎣⎥
⎥⎦⎢
⎢⎣⎥⎥⎦⎢
⎢⎣ 1111000 bybyyb
![Page 32: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/32.jpg)
Homogeneous Coordinates…3Homogeneous Coordinates…3
• Add a 3rd coordinate to every 2D pointAdd a 3rd coordinate to every 2D point– (xh, yh, w) represents a point at location (xh/w, yh/w)
– (x, y, 0) represents a point at infinity
– (0, 0, 0) is not allowed
2
y
1
2 (2,1,1) or (4,2,2) or (6,3,3)
Convenient coordinate system to represent many useful transformations
1 2 x
![Page 33: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/33.jpg)
Homogeneous Coordinates…4Homogeneous Coordinates…4
• Basic 2D transformations as 3x3 matricesBasic 2D transformations as 3x3 matrices
⎥⎥⎤
⎢⎢⎡
⎥⎥⎤
⎢⎢⎡
=⎥⎥⎤
⎢⎢⎡
1001
''
yx
tt
yx
y
x
⎥⎥⎤
⎢⎢⎡
⎥⎥⎤
⎢⎢⎡
=⎥⎥⎤
⎢⎢⎡
0000
''
yx
ss
yx
y
x
⎥⎥⎦⎢
⎢⎣⎥⎥⎦⎢
⎢⎣⎥
⎥⎦⎢
⎢⎣ 11001
yy y
Translate [P’ = T(tx, ty).P]
⎥⎥⎦⎢
⎢⎣⎥⎥⎦⎢
⎢⎣⎥
⎥⎦⎢
⎢⎣ 11001
yy y
Scale [P’ = S(sx, sy).P]
⎥⎥⎤
⎢⎢⎡
⎥⎥⎤
⎢⎢⎡
ΘΘΘ−Θ
=⎥⎥⎤
⎢⎢⎡
0cossin0sincos
''
yx
yx
x y x y
⎥⎥⎦⎢
⎢⎣⎥⎥⎦⎢
⎢⎣
ΘΘ⎥⎥⎦⎢
⎢⎣ 1100
0cossin1
yy
Rotate [P’ = R(θ).P][ ( ) ]
![Page 34: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/34.jpg)
Composite TransformationsComposite Transformations
• Products of transformation matrices is termed asProducts of transformation matrices is termed as composition or concatenation of matrices
• This is formed by multiplying matrices in order, i.e. y p y g ,from right to left
• This means that each successive transformation matrix premultiplies the product of the preceding transformation matrices.
• Concatenation propertyA.B.C = (A.B).C = A. (B.C)
34
![Page 35: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/35.jpg)
Composite Transformations…1Composite Transformations…1
• TranslationTranslation– If two successive translation vectors (tx1, ty1) and (tx2, ty2) are applied, then
P’ = T (tx2, ty2). {T(tx1, ty1).P}
P’ = {T (tx2, ty2). T(tx1, ty1)}.P = {T(tx1+tx2, ty1+ty2)}.P
⎥⎥⎥⎤
⎢⎢⎢⎡
++
=⎥⎥⎥⎤
⎢⎢⎢⎡
⎥⎥⎥⎤
⎢⎢⎢⎡
=• 1001
1001
.1001
12 21
21
1
1
2
2
yy
xx
y
x
y
xtttt
tt
tt
TT⎥⎦⎢⎣⎥⎦⎢⎣⎥⎦⎢⎣ 100100100
35
![Page 36: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/36.jpg)
Composite Transformations…2Composite Transformations…2
• ScalingScaling– Similarly, two successive scaling operations are dealt as
⎤⎡⎤⎡ 0000 12 ss
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
1000000
.1000000
),().,( 1
1
2
2
1122 y
x
y
x
yxyx ss
ss
ssSssS
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
1000.000.
21
21
yy
xxss
ss
⎥⎦⎢⎣ 100
36
![Page 37: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/37.jpg)
Composite Transformations…3Composite Transformations…3
• General Fixed Point ScalingGeneral Fixed Point Scaling– Translate object so that the fixed point coincides with the coordinate origin
– Scale the object with respect to the coordinate origin
– Use inverse translation to return on the original position
( ) ( ) ( ) ( )T(xf, yf).S(sx, sy).T(‐xf, ‐yf) = S(xf, yf, sx, sy)
⎥⎤
⎢⎡ −
⎥⎤
⎢⎡ −
⎥⎤
⎢⎡
⎥⎤
⎢⎡ )1(0010001 xfxfxf sxsxsx
⎥⎥⎥
⎦⎢⎢⎢
⎣
−=⎥⎥⎥
⎦⎢⎢⎢
⎣
−⎥⎥⎥
⎦⎢⎢⎢
⎣⎥⎥⎥
⎦⎢⎢⎢
⎣ 100)1(0
10010.
10000.
10010 yfy
f
f
f
yf
fsysysy
![Page 38: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/38.jpg)
Composite Transformations…4Composite Transformations…4
• General Fixed Point ScalingGeneral Fixed Point Scaling
(xr, yr)
a b
c
a b
d
![Page 39: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/39.jpg)
Example 2Example 2
• Magnify the triangle with vertices A (0, 0), B (1, 1) and C (5, 2) g y g ( , ), ( , ) ( , )to twice its size while keeping C (5, 2) fixed
Homogeneous coordinates Transformation Matrix (TRT-1)
⎟⎟⎞
⎜⎜⎛
210510
of vertices
⎥⎥⎤
⎢⎢⎡
−−
=⎥⎥⎤
⎢⎢⎡
−−
⎥⎥⎤
⎢⎢⎡
⎥⎥⎤
⎢⎢⎡
220502
210501
020002
210501
a s o a o a ( )
⎟⎟
⎠⎜⎜
⎝ 111 ⎥⎥⎦⎢
⎢⎣⎥
⎥⎦⎢
⎢⎣⎥⎥⎦⎢
⎢⎣⎥⎥⎦⎢
⎢⎣ 100100100100
Transformation of triangle Transformed vertices
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−
−−=
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡−−
111202535
111210510
100)220
502 A (-5, -2)
B (-3, 0)⎟⎠
⎜⎝
⎟⎠
⎜⎝⎥⎦⎢⎣ 111111100 C (5, 2)
![Page 40: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/40.jpg)
Composite Transformations…5Composite Transformations…5
• RotationRotation
RR 0)21cos()21sin(0)21sin()21cos(
)().( 12 θθθθθθθθ
θθ ⎥⎥⎤
⎢⎢⎡
+++−+
=
PRP ).(
100
21'
12
θθ +=
⎥⎥⎦⎢
⎢⎣
40
![Page 41: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/41.jpg)
Composite Transformations…6Composite Transformations…6
suppose we wantsuppose we want Rotate(zRotate(z 90)90) Translate(2 3 0)Translate(2 3 0)
jFFhh
suppose we wantsuppose we want Rotate(z,Rotate(z,‐‐90)90) Translate(2,3,0)Translate(2,3,0)
jFFhh
i FFhh
FFWW
FFWW
FFhhi
j FFWW
p'=R(z,−90)p p''= T(2,3,0)p'
41
p''= T(2,3,0)R(z,−90)p = TRp
![Page 42: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/42.jpg)
Composite Transformations…7Composite Transformations…7
• General Pivot Point RotationGeneral Pivot Point Rotation– Rotation about any selected point can be generated by performing the following operations
• Translate the object from pivot point to coordinate origin
• Rotate the object about the coordinate origin
• Translate the object so that the pivot point is returned to its j p poriginal position
![Page 43: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/43.jpg)
Composite Transformations…8Composite Transformations…8
43
![Page 44: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/44.jpg)
Composite Transformations…9Composite Transformations…9
• This transformation can be expressed asThis transformation can be expressed asT(xr, yr).R(θ).T(‐xr, ‐yr) = R(xr, yr, θ)
where, T(‐xr, ‐yr) = T‐1(xr, yr)r r r r
⎥⎥⎤
⎢⎢⎡
−−
⎥⎥⎤
⎢⎢⎡ −
⎥⎥⎤
⎢⎢⎡
1001
.0cossin0sincos
.1001
θθθθ
r
r
r
ryx
yx
⎥⎤
⎢⎡ +−−
⎥⎥⎦⎢
⎢⎣⎥
⎥⎦⎢
⎢⎣⎥
⎥⎦⎢
⎢⎣
i)(isin)cos1(sincos
100100100
θθθθθθθθ rr
rr
yx
yy
⎥⎥⎥
⎦⎢⎢⎢
⎣
−−=100
sin)cos1(cossin θθθθ rr xy
![Page 45: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/45.jpg)
Composite Transformations…10Composite Transformations…10
translate p translate p to originto origin
rotate about rotate about bb θ
rotate aboutrotate aboutoriginorigin
translate p translate p backback
p = (x,y)
to originto origin
θ
p by :p by :θ originorigin backback
p ( ,y)
FFWW
T(x,y,z)R(z,θ)T(−x,−y,−z)
45
![Page 46: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/46.jpg)
Example 3Example 3
• Perform a 45o rotation of a triangle A (0, 0), B (1, 1)Perform a 45 rotation of a triangle A (0, 0), B (1, 1) and C (5, 2) about originHomogeneous coordinates Rotation Matrix
⎟⎟⎞
⎜⎜⎛
210510
of vertices
⎥⎥⎥⎥⎤
⎢⎢⎢⎢⎡
−
=⎥⎥⎤
⎢⎢⎡ −
022
022
22
045cos45sin045sin45cos
o a o a
⎟⎟
⎠⎜⎜
⎝ 111
⎥⎥⎥⎥
⎦⎢⎢⎢⎢
⎣
=⎥⎥⎦⎢
⎢⎣ 100
022
100045cos45sin
Transformation Matrix
⎟⎟⎟⎟⎟⎞
⎜⎜⎜⎜⎜⎛
=⎟⎟⎟⎞
⎜⎜⎜⎛
⎥⎥⎥⎥⎤
⎢⎢⎢⎢⎡
−
22720
22300
210510
022
22
022
22
Transformed vertices
A (0, 0), B (0, √2), C (3√2/2, 7√2/2)
⎟⎟⎟
⎠⎜⎜⎜
⎝
⎟⎠
⎜⎝
⎥⎥⎥⎥
⎦⎢⎢⎢⎢
⎣
1112
11110022
![Page 47: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/47.jpg)
Example 4Example 4
• Perform a 45o rotation of a triangle A (0, 0), B (1, 1)Perform a 45 rotation of a triangle A (0, 0), B (1, 1) and C (5, 2) about point (‐1, ‐1)Homogeneous coordinates Transformation Matrix (TRT-1)
⎟⎟⎞
⎜⎜⎛
210510
of vertices
⎥⎥⎥⎥⎤
⎢⎢⎢⎢⎡
−
−−
=⎥⎥⎤
⎢⎢⎡
−−
⎥⎥⎥⎥⎤
⎢⎢⎢⎢⎡
−
⎥⎥⎤
⎢⎢⎡
−−
)12(22
122
22
110101
022
022
22
110101
a s o a o a ( )
⎟⎟
⎠⎜⎜
⎝ 111⎥⎥⎥⎥
⎦⎢⎢⎢⎢
⎣
⎥⎥⎦⎢
⎢⎣
⎥⎥⎥⎥
⎦⎢⎢⎢⎢
⎣
⎥⎥⎦⎢
⎢⎣ 100
)12(22
100110
100
022
100110
Transformation of triangleTransformed
⎟⎟⎟⎟⎞
⎜⎜⎜⎜⎛
−−−
−−−
=⎟⎟⎞
⎜⎜⎛
⎥⎥⎥⎥⎤
⎢⎢⎢⎢⎡
−
−−
)12
29()122()12(
)12
23(11
210510
)12(22
22
122
22
Transformed vertices
A (-1, √2-1)
⎟⎟⎟⎟
⎠⎜⎜⎜⎜
⎝
⎟⎟
⎠⎜⎜
⎝
⎥⎥⎥⎥
⎦⎢⎢⎢⎢
⎣
111
)2
()()(111100
)(22 B (-1, 2√2-1)
C (3√2/2-1, 9√2/2-1)
![Page 48: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/48.jpg)
Composite Transformations…11Composite Transformations…11
• Scaling and RotationScaling and Rotation
⎥⎥⎤
⎢⎢⎡
+−−+
=− 0cossinsincos)(0sincos)(sincos
)().,().( 22
2112
122
22
1
211 θθθθ
θθθθθθ ssss
ssssRssSR
s2
• Example: s = 1 s = 2 and θ = 45o⎥⎥⎥
⎦⎢⎢⎢
⎣ 100)()(),()( 211221
θ• Example: s1 = 1, s2 = 2 and θ = 45o s1
(1/2, 3/2)(2, 2)
(0, 1) (1, 1)
(3/2, 1/2)
(0, 0) (1, 0) (0, 0)
![Page 49: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/49.jpg)
Composite Transformations…12Composite Transformations…12
• Translation, Rotation and ScalingTranslation, Rotation and Scaling
⎥⎥⎤
⎢⎢⎡
⎥⎥⎤
⎢⎢⎡
=⎥⎥⎤
⎢⎢⎡
'
'
yx
trsrsrstrsrsrs
yx xxyxx
=),,,().,,().,( yxccccyx ssyxSyxRttT θ
⎥⎥⎦⎢
⎢⎣⎥
⎥⎦⎢
⎢⎣⎥
⎥⎥
⎦⎢⎢⎢
⎣ 1.
1001ytrsrsrsy yyyyx
⎥⎥⎤
⎢⎢⎡
+−−++−−
sin)cos1(cossinsin)cos1(sincos
),,,().,,().,(
yxcycyx
xycxcyx
yxccccyx
tsxsysstsysxss
ssyxSyxtt
θθθθθθθθ
θ
⎥⎥⎦⎢
⎢⎣ 100
![Page 50: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/50.jpg)
Composite Transformations…13Composite Transformations…13
• Rigid‐body transformation matrix (involving onlyRigid body transformation matrix (involving only Translation and Rotation)
⎤⎡⎤⎡⎤⎡ ' xtrrrx
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
1.
1001
' yx
trrrtrrr
yx
yyyyx
xxyxx
⎥⎤
⎢⎡ ++−−
=
sin)cos1(sincos
),,().,(
xrr
rryx
tyx
yxRttT
θθθθ
θ⎥⎦⎢⎣
⎥⎥⎥
⎦⎢⎢⎢
⎣
+−−100
sin)cos1(cossin yrr txy θθθθ
![Page 51: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/51.jpg)
Other TransformationsOther Transformations
• ReflectionReflection
• Shear
![Page 52: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/52.jpg)
ReflectionReflection
• Reflection transformation produces a mirror image of p gan object.
• Rotation is 180o about axis of reflection• This axis may be in x‐y plane or perpendicular to that. For reflection axis perpendicular to x‐y plane, the rotation path is in x y planethe rotation path is in x‐y plane.
• Reflection about x axis keeps x coordinates same but flips y coordinate. Similarly, for reflection about y p y y, yaxis, the y‐coordinates remain the same and x‐coordinates are flipped.
![Page 53: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/53.jpg)
Reflection…1Reflection…1
• Reflection across x axisReflection across x axis
x x
– Transformation matrix
⎤⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡−
100010001
53
⎥⎦⎢⎣ 100
![Page 54: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/54.jpg)
Reflection…2Reflection…2
• Reflection across y axisReflection across y axisy y
– Transformation matrix
⎤⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡−
100010001
54
⎥⎦⎢⎣ 100
![Page 55: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/55.jpg)
Reflection…3Reflection…3
• Reflection across axis perpendicular to xy planeReflection across axis perpendicular to xy planey y
x x
– Transformation matrix
⎤⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡−
−
100010001
55
⎥⎦⎢⎣ 100
![Page 56: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/56.jpg)
Reflection…4Reflection…4y
Original y Original
positiongposition
position
Reflected position
x
Reflected
x
pos t o
y
positionOriginal positionReflection about x‐axis Reflection about y‐axis
x
Reflected position
Reflection about axis perpendicular to xy plane
![Page 57: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/57.jpg)
Reflection…5Reflection…5Reflected position
Original position
y
Original
position y
Reflected
x
Original position
x
position
x
Reflection about axisReflection about axis perpendicular to xy plane and passing through pivot point Prfl
Reflection about line y=x
⎥⎥⎤
⎢⎢⎡
001010
⎥⎥⎦⎢
⎢⎣ 100
001
![Page 58: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/58.jpg)
Reflection…6Reflection…6
• To obtain transformation matrix for reflection about the diagonal y = x, the possible sequence of transformations is – Rotate clockwise the diagonal by 45o making it equivalent to x‐axis– Perform reflection with respect to x‐axisp– Rotate counterclockwise by 45o to bring the line y = x to its original
position
• In case of any line y = mx + b, the sequence would bey y , q– Translate the line to pass through coordinate origin– Rotate the line onto one of the coordinate axis– Reflect the object about that axisReflect the object about that axis– Inverse rotate the line– Inverse translate the line back to its original position
![Page 59: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/59.jpg)
Example 5Example 5
• Reflect diamond shaped polygon whose vertices are A (‐1, 0), p p yg ( , ),B (0, ‐2), C (1, 0), D (0, 2), about y=2
Homogeneous coordinates Transformation Matrix (TRMR-1T-1)
⎟⎟⎞
⎜⎜⎛
20
02-0101-
of vertices
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡−=
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡−
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡−
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
100410001
100210
001
100010001
100010001
100010001
100210001
a s o a o a ( )
⎟⎟
⎠⎜⎜
⎝ 1111⎥⎦⎢⎣⎥⎦⎢⎣⎥⎦⎢⎣⎥⎦⎢⎣⎥⎦⎢⎣⎥⎦⎢⎣ 100100100100100100
Transformation of polygon Transformed vertices
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛=
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡−
120
111464101-
120
11102-0101-
100410001 A (-1, 4)
B (0, 6)⎟⎠
⎜⎝
⎟⎠
⎜⎝⎥⎦⎢⎣ 11111111100 C (1, 4)
D (0, 2)
![Page 60: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/60.jpg)
Example 6Example 6
• Reflect diamond shaped polygon whose vertices are A (‐1, 0), p p yg ( , ),B (0, ‐2), C (1, 0), D (0, 2), about x=2
Homogeneous coordinates Transformation Matrix (TMT-1)
⎟⎟⎞
⎜⎜⎛
20
02-0101-
of vertices
⎥⎥⎤
⎢⎢⎡−
=⎥⎥⎤
⎢⎢⎡ −
⎥⎥⎤
⎢⎢⎡−
⎥⎥⎤
⎢⎢⎡
010401
010201
010001
010201
a s o a o a ( )
⎟⎟
⎠⎜⎜
⎝ 1111 ⎥⎥⎦⎢
⎢⎣
=⎥⎥⎦⎢
⎢⎣⎥⎥⎦⎢
⎢⎣⎥⎥⎦⎢
⎢⎣ 100
010100010
100010
100010
Transformation of polygon Transformed vertices
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛=
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡−
124
11102-0345
120
11102-0101-
100010401 A (5, 0)
B (4, -2)⎟⎠
⎜⎝
⎟⎠
⎜⎝⎥⎦⎢⎣ 11111111100 C (3, 0)
D (4, 2)
![Page 61: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/61.jpg)
Example 7Example 7
• Reflect diamond shaped polygon whose vertices are A (‐1, 0), p p yg ( , ),B (0, ‐2), C (1, 0), D (0, 2), about y = x + 2
Homogeneous coordinates Transformation Matrix (TMT-1)
⎟⎟⎞
⎜⎜⎛
20
02-0101-
of vertices
⎥⎥⎤
⎢⎢⎡ −
201210
a s o a o a ( )
⎟⎟
⎠⎜⎜
⎝ 1111 ⎥⎥⎦⎢
⎢⎣ 100
201
Transformation of polygon Transformed vertices
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛=
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡ −
120
1113212-4-2-
120
11102-0101-
100201210 A (-2, 1)
B (-4, 2)⎟⎠
⎜⎝
⎟⎠
⎜⎝⎥⎦⎢⎣ 11111111100 C (-2, 3)
D (0, 2)
![Page 62: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/62.jpg)
ShearShear
• A transformation that distorts the shape of an objectA transformation that distorts the shape of an object such that the transformed shape appears as if the object were composed of internal layers that have been caused to slide over each other
• Two distinct shear transformations are:– Shifting coordinate x values
– Shifting coordinate y values
![Page 63: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/63.jpg)
Shear…1Shear…1
• Shear along x axisShear along x axis– push points to right in proportion to height if shx is positive
y y
x x
T f d di t iti d t i
x x
⎤⎡ 01 h– Transformed coordinate positions and matrix
x’ = x + shx.y y’ = y⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
10001001 xsh
63
⎦⎣
![Page 64: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/64.jpg)
Shear…2Shear…2
• Shear along x axis Sh = 1 5Shear along x axis Shx = 1.5
– Shear in x‐direction relative to other reference lines• Transformed coordinate positions
x’ = x + shx(y ‐ yref) y’ = y
⎤⎡1 hh Shx = 0.5
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡ −
100010.1 refxx yshsh x
yref = ‐1
64
⎦⎣
yref = ‐1 yref = ‐1
![Page 65: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/65.jpg)
Shear…3Shear…3
• Shear along y axis relative to line x = xrefShear along y axis relative to line x xref– Transformed coordinate positions
x’ = x y’ = y + shy(x ‐ xref)y ref
⎥⎥⎥⎤
⎢⎢⎢⎡
− .1001
refyy xshsh⎥⎥⎦⎢
⎢⎣ 100
Shy = 0.5 y xref = ‐1
65xref = ‐1
xref = ‐1
![Page 66: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/66.jpg)
Example 8Example 8
• Shear transformation on a square A (0, 0), B (1, 0), C (1, 1) and q ( , ), ( , ), ( , )D (0, 1) when shx = 2 and shy = 3
C
CD CD
B
D
A B
D
A B
D
A
D
C
B
A
D
![Page 67: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/67.jpg)
Affine TransformationsAffine Transformations
• affine transforms are combinations of ⎤⎡⎤⎡⎤⎡ b'affine transforms are combinations of– linear transformations
– translations ⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡yx
fedcba
yx
100''
translations
• properties of affine transformations– origin does not necessarily map to origin
⎥⎦⎢⎣⎥⎦⎢⎣⎥⎦⎢⎣ ww 100
origin does not necessarily map to origin
– lines map to lines
– parallel lines remain parallelp p
– ratios are preserved
– closed under composition
67
p
![Page 68: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/68.jpg)
Transformation HierarchiesTransformation Hierarchies
• Scene may have a hierarchy of coordinate systemsScene may have a hierarchy of coordinate systems– Stores matrix at each level with incremental transform from parent’s coordinate system
• Scene graphroadroad
stripe1stripe1 stripe2stripe2 ...... car1car1 car2car2 ......
68
w1w1 w3w3w2w2 w4w4
![Page 69: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/69.jpg)
Transformation Hierarchy Example 1Transformation Hierarchy Example 1
worldworld
torsotorso
headheadRUarmRUarm
RLarmRLarm
RUlegRUleg
RLlegRLleg
LUarmLUarm
LLarmLLarm
LUlegLUleg
LLlegLLleg
RhandRhandRfootRfoot LhandLhandLfootLfoot
69
trans(0.30,0,0) rot(z, )trans(0.30,0,0) rot(z, ) θ
![Page 70: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/70.jpg)
Transformation Hierarchies…1Transformation Hierarchies…1
• Hierarchies don’t fall apart when changedHierarchies don t fall apart when changed
• Transforms apply to graph nodes beneath
70
![Page 71: CE-201CE201_Week9-10_2010](https://reader033.fdocuments.us/reader033/viewer/2022051418/563dba74550346aa9aa5bfb2/html5/thumbnails/71.jpg)
ReadingsReadings
• Hearn and Baker 204‐228Hearn and Baker, 204 228
• Xiang and Plastock, 68‐88