ļ‚§ 2 x 1 matrix:
ļ‚§ General Problem: [B] = [T] [A]
[T] represents a generic operator to be applied to the
points in A. T is the geometric transformation matrix.
If A & T are known, the transformed points are obtained
by calculating B.
ļ‚§ Solid body transformations – the above equation is
valid for all set of points and lines of the object being
transformed.
2x3 3x4
ļ‚§ Since A is a 2x3 matrix and B is a 3x4 matrix, the
product AB is a 2x4 matrix
ļ‚§ T= identity matrix:
a=d=1, b=c=0 => x’=x, y’=y.
ļ‚§ Scaling & Reflections:
b=0, c=0 => x' = a.x, y' = d.y; This is scaling by a in x, d in
y.
If, a = d > 1, we have enlargement (scale up) & uniform
scaling.
If, a ≠ d > 1, we have enlargement (scale up) & non
uniform scaling.
If, 0 < a = d < 1, we have compression (scale down) &
uniform scaling.
If, 0 < a ≠ d < 1, we have compression (scale down) & non
uniform scaling.
1 0
0 1
Sx
0
0
ļ‚§ Let Sx= 3, Sy=2:
ļ‚§ What if Sx and/or Sy are negative?
Get reflections through an axis or plane.
ļ‚§ Only diagonal elements are involved in scaling and
reflections. (off diagonal = 0)
ļ‚§ EX: Let Sx= 5, Sy=5:
=
X’=5X, Y’=5Y so its scale up & uniform scale.
ļ‚§ EX: Let Sx= 1/5, Sy=1/5:
=
X’=5/X, Y’=5/Y so its scale down & uniform scale.
5 0
0 5
X’
Y’
X
Y
X’
Y’
1/5 0
0 1/5
X
Y
Reflection about Matrix T
Y = X X’ = Y
Y’ = X
EX: (3,4) => (4,3)
Y = -X X’ = -Y
Y’ = -X
EX: (3,4) => (-4,-3)
Y = 0 Axis (or X Axis) X’ = X
Y’ = -Y
EX: (3,4) => (3,-4)
X = 0 Axis (or Y Axis) X’ = -X
Y’ = Y
EX: (3,4) => (-3,4)
X = 0 and Y = 0 (Y axis & X axis) X’ = -X
Y’ = -Y
EX: (3,4) => (-3,-4)
ļ‚§ Off diagonal terms are involved in Shearing.
ļ‚§ y' depends linearly on x ; This effect is called shear.
ļ‚§ Positive Rotations: counter clockwise about the origin.
ļ‚§ With clockwise.
Īø (in degrees) Matrix T
90
180
270 or -90
360 or 0
ļ‚§ Rotate the following shape by Īø=270 anticlockwise
ļ‚§ B = A + Td , where Td = [tx ty]T.
ļ‚§ x’= x + tx , y’= y + ty.
ļ‚§ Where else are translations introduced?
1. Rotations - when objects are not centered at the
origin.
2. Scaling - when objects/lines are not centered at the
origin. if line intersects the origin then no
translation.
ļ‚§ Note: we cannot directly represent translations as
matrix multiplication, as we know so far.
ļ‚§ We can represent translations in our general
transformation by using homogeneous coordinates.
ļ‚§ Use a 3 x 3 matrix:
ļ‚§ x' = ax + cy + tx
ļ‚§ y' = bx + cy + ty
ļ‚§ w’ = w
ļ‚§ Each point is now represented by a triplet: (x, y, w).
ļ‚§ (x/w, y/w) are called the Cartesian coordinates of the
homogeneous points.
ļ‚§ EX: Given 4 homogeneous points
ļ‚§ P0=(3,4,2,.5) P1=(24,32,16,4) P2=(9,12,6,1) P3=(18,24,12,3)
ļ‚§ Which of the homogeneous points represent a different 3d
point?
ļ‚§ P0= (3/.5,4/.5,2/.5)= (6,8,4)
ļ‚§ P1=(24/4,32/4,16/4)= (6,8,4)
ļ‚§ P2=(9/1,12/1,6/1)= (9,12,6)
ļ‚§ P3=(18/3,24/3,12/3)= (6,8,4)
ļ‚§ So p2 is different
ļ‚§ General Purpose 2D transformations in homogeneous
coordinate representation:
ļ‚§ Parameters involved in scaling, rotation, reflection
and shear are: a, b, c, d.
ļ‚§ For translation:
If [B]=[T][A] then p,q are
translation Parameter.
if [B]=[A][T] then m,n are
translation parameter.
ļ‚§ There are three steps for translation about an
arbitrary point in space:
1. Translate by (-Tx, -Ty).
2. Scale by Sx, Sy, where Sx = new coordinate for x/ old
Sy = new coordinate for y/ old
3. Translate back by (Tx, Ty)
ļ‚§ EX: Apply translation to the matrix according to the
shape below.
1 0 16
0 1 4
0 0 1
1 0 -2
0 1 -2
0 0 1
8 0 0
0 2 0
0 0 1
X
Y
Z
ļ‚§ There are three steps for scaling about an arbitrary
point in space:
1. Translate by (-Tx, -Ty)
2. Scale by Sx, Sy
3. Translate back by (Tx, Ty)
ļ‚§ EX: Apply Scaling up to the matrix such that Tx= 1,
Ty= 2, Sx= 4, Sy= 12.
=
= =
ļ‚§ x’= x+7w y’=y+16w w’=w
1 0 -1
0 1 -2
0 0 1
X’
Y’
Z’
4 0 0
0 12 0
0 0 1
1 0 4
0 1 12
0 0 1
X
Y
Z
1 0 3
0 1 4
0 0 1
1 0 4
0 1 12
0 0 1
X
Y
Z
1 0 7
0 1 16
0 0 1
X
Y
Z
ļ‚§ EX: Apply Scaling down to the matrix such that Tx= 1,
Ty= 2, Sx= 4, Sy= 12.
=
1 0 -4
0 1 -12
0 0 1
X’
Y’
Z’
1/4 0 0
0 1/6 0
0 0 1
1 0 1
0 1 2
0 0 1
X
Y
Z
ļ‚§ There are three steps for rotation about an arbitrary
point in space:
1. Translate by (-Px, -Py).
2. Rotate.
3. Translate back by (Px, Py)
ļ‚§ EX: Apply rotation to the matrix such that Px= 1, Py= 4
by Īø = 90 .
=
1 0 -1
0 1 -4
0 0 1
X’
Y’
Z’
0 -1 0
1 0 0
0 0 1
1 0 1
0 1 4
0 0 1
X
Y
Z
ļ‚§ There are five steps for reflection about an arbitrary
point in space:
1. Translate line to the origin.
2. Rotation about the origin.
3. Reflection matrix.
4. Reverse the rotation.
5. Translate line back.
ļ‚§ If the line pass the origin we need only 3 steps
(remove step 1 and step 5).
ļ‚§ If we want to apply a series of transformations T1, T2,
T3 to a set of points, we can do it in two ways:
1. We can calculate p'=T1*p, p''= T2*p', p'''=T3*p''
2. Calculate T=T1*T2*T3 then p'''=T*p.
ļ‚§ Translations: Translate the points by
tx1, ty1, then by tx2, ty2.
ļ‚§ Scaling: Similar to translations.
ļ‚§ Rotations: Rotate by Īø1, then by Īø2 and its done by 2
ways:
1. Replace Īø1, Īø2 by Īø=Īø1+Īø2.
2. calculate T1 for Īø1, then T2 for Īø2 then multiply
them.
ļ‚§ EX: Apply two scaling to the matrix such that Sx1= 2,
Sy1= 3, Sx2=4, Sy2=2.
ļ‚§ Way #1
ļ‚§ P’= =
ļ‚§ P’’= =
2 0 0
0 3 0
0 0 1
1 0 0
0 2 0
0 0 1
1 0 0
0 2 0
0 0 1
2 0 0
0 6 0
0 0 1
4 0 0
0 2 0
0 0 1
2 0 0
0 6 0
0 0 1
8 0 0
0 12 0
0 0 1
ļ‚§ Way #2
ļ‚§ T = =
ļ‚§ P’’= =
2 0 0
0 3 0
0 0 1
4 0 0
0 2 0
0 0 1
8 0 0
0 6 0
0 0 1
8 0 0
0 6 0
0 0 1
1 0 0
0 2 0
0 0 1
8 0 0
0 12 0
0 0 1
ļ‚§ EX: Find the new coordinate for the point (3,7,1) if you
rotate the point by 180 degree then by 90 degree with
clockwise.
ļ‚§ Composite rotation : 180 + 90 = 270 degree
ļ‚§ Since w=1 the Cartesian coordinate for the point is
(3,7)
1 0 -3
0 1 -7
0 0 1
Cos270 Sin270 0
-Sin270 Cos270 0
0 0 1
1 0 3
0 1 7
0 0 1
ļ‚§ EX: Suppose you have the point (2,4),rotate the point
by 90 degree then by 180 degree the by 45 degree then
by 45 degree then scale it by Sx=2 and Sy=4.
ļ‚§ Composite rotation : 90+180+45+45 = 360 degree
2 0 0
0 4 0
0 0 1
Cos360 Sin360 0
-Sin360 Cos360 0
0 0 1
2
4
1
ļ‚§ EX: Transform the point from left to right.
ļ‚§ Sx1= 4/2= 2, Sy1= 5/2= 2.5, Sx2= 7/4, Sy2= 8/5
ļ‚§ Sx= 2*7/4= 3.5, Sy= 2.5*8/5= 4
1 0 -2
0 1 -2
0 0 1
3.5 0 0
0 4 0
0 0 1
1 0 7
0 1 8
0 0 1
ļ‚§ EX: Transform the point from left to right.
ļ‚§ Sx= 3/1= 3, Sy= 3/1= 3
1 0 -1
0 1 -1
0 0 1
3 0 0
0 3 0
0 0 1
1 0 3
0 1 3
0 0 1
ļ‚§ Cases where T1 * T2 = T2 * T1:
T1 T2
Translation Translation
Scaling Scaling
Rotation Rotation
Uniform Scaling Rotation
ļ‚§ EX: If we scale, translate to origin then translate back
is it equivalent to translate to origin, scale then
translate back? (Sx=2, Sy=3, tx=3, tx=2)
ļ‚§ Answer: No, the order of matrix is important.
=
=
2 0 0
0 3 0
0 0 1
1 0 -3
0 1 -2
0 0 1
1 0 3
0 1 2
0 0 1
2 0 0
0 3 0
0 0 1
2 0 0
0 3 0
0 0 1
1 0 -3
0 1 -2
0 0 1
1 0 3
0 1 2
0 0 1
2 0 3
0 3 4
0 0 1
ļ‚§ EX: If we rotate the object by 90 degree then scale it
,is it equivalent to scale it then rotate it by 90 degree ?
(Sx=2, Sy=3)
=
=
0 -1 0
1 0 0
0 0 1
2 0 0
0 3 0
0 0 1
0 -3 0
2 0 0
0 0 1
0 -1 0
1 0 0
0 0 1
2 0 0
0 3 0
0 0 1
0 -2 0
3 0 0
0 0 1
ļ‚§ EX: If we rotate the object by 90 degree then scale it
,is it equivalent to scale it then rotate it by 90 degree ?
(Sx=4, Sy=4)
=
=
0 -1 0
1 0 0
0 0 1
4 0 0
0 4 0
0 0 1
0 -4 0
4 0 0
0 0 1
0 -1 0
1 0 0
0 0 1
4 0 0
0 4 0
0 0 1
0 -4 0
4 0 0
0 0 1
ļ‚§ EX: Prove that rotation then translation not equal to
translation then rotation?
=
= not equal to the
above
CosĪø -SinĪø
0
SinĪø CosĪø
0
0 0
1
1 0 -
tx
0 1 -
ty
0 0
1
CosĪø –SinĪø -txcosĪø+tysinĪø
SinĪø CosĪø -txsinĪø-tycosĪø
0 0 1
1 0 -
tx
0 1 -
ty
0 0
1
CosĪø -SinĪø
0
SinĪø CosĪø
0
0 0
1
ļ‚§ EX: Given a solid object, if we apply uniform scale
then translation to the body, is it the same as we apply
translation then uniform scale?
=
=
Sx 0
0
0 Sy
0
0 0
1
1 0
tx
0 1
ty
0 0
1
Sx Sy Sxtx
0 Sy Syty
0 0 11 0
tx
0 1
ty
0 0
1
Sx 0
0
0 Sy
0
0 0
1
Sx 0 tx
0 Sy ty
0 0 1
ļ‚§ Screen Coordinates: The coordinate system used to
address the screen (device coordinates).
ļ‚§ World Coordinates: A user-defined application specific
coordinate system having its own units of measure,
axis, origin, etc.
ļ‚§ Window: The rectangular region of the world that is
visible.
ļ‚§ Viewport: The rectangular region of the screen space
that is used to display the window.
ļ‚§ The Purpose is to find the transformation matrix that
maps the window in world coordinates to the viewport
in screen coordinates.
ļ‚§ Window: (x, y space) denoted by: xmin, ymin, xmax, ymax.
ļ‚§ Viewport: (u, v space) denoted by: umin, vmin, umax, vmax.
ļ‚§ The overall transformation:
Translate the window to the origin.
Scale it to the size of the viewport.
Translate it to the viewport location.
ļ‚§ EX: Given (xmin=3, ymin=12, xmax=8, ymax=16)
(umin=1, vmin=2, umax=2, vmax=4)
Sx=1/5,Sy=1/2
Map from window to view port.
0 0 -3
0 1 -12
0 0
1
1/5 0 0
0 1/2 0
0 0
1
1 0 1
0 1 2
0 0 1
ļ‚§ Map from window to view port.
ļ‚§ (xmin=20, ymin=10, xmax=40, ymax=50)
ļ‚§ (umin=5, vmin=4, umax=10, vmax=12)
ļ‚§ Sx=(10-5)/(40-20)= 0.25, Sy=(12-4)/(50-10)=0.2
1 0 -20
0 1 -10
0 0
1
.25 0 0
0 .2 0
0 0 1
1 0 5
0 1 4
0 0 1

Computer Graphic - Transformations in 2D

  • 2.
    ļ‚§ 2 x1 matrix: ļ‚§ General Problem: [B] = [T] [A] [T] represents a generic operator to be applied to the points in A. T is the geometric transformation matrix. If A & T are known, the transformed points are obtained by calculating B.
  • 3.
    ļ‚§ Solid bodytransformations – the above equation is valid for all set of points and lines of the object being transformed.
  • 4.
    2x3 3x4 ļ‚§ SinceA is a 2x3 matrix and B is a 3x4 matrix, the product AB is a 2x4 matrix
  • 5.
    ļ‚§ T= identitymatrix: a=d=1, b=c=0 => x’=x, y’=y. ļ‚§ Scaling & Reflections: b=0, c=0 => x' = a.x, y' = d.y; This is scaling by a in x, d in y. If, a = d > 1, we have enlargement (scale up) & uniform scaling. If, a ≠ d > 1, we have enlargement (scale up) & non uniform scaling. If, 0 < a = d < 1, we have compression (scale down) & uniform scaling. If, 0 < a ≠ d < 1, we have compression (scale down) & non uniform scaling. 1 0 0 1 Sx 0 0
  • 6.
    ļ‚§ Let Sx=3, Sy=2: ļ‚§ What if Sx and/or Sy are negative? Get reflections through an axis or plane. ļ‚§ Only diagonal elements are involved in scaling and reflections. (off diagonal = 0)
  • 7.
    ļ‚§ EX: LetSx= 5, Sy=5: = X’=5X, Y’=5Y so its scale up & uniform scale. ļ‚§ EX: Let Sx= 1/5, Sy=1/5: = X’=5/X, Y’=5/Y so its scale down & uniform scale. 5 0 0 5 X’ Y’ X Y X’ Y’ 1/5 0 0 1/5 X Y
  • 8.
    Reflection about MatrixT Y = X X’ = Y Y’ = X EX: (3,4) => (4,3) Y = -X X’ = -Y Y’ = -X EX: (3,4) => (-4,-3) Y = 0 Axis (or X Axis) X’ = X Y’ = -Y EX: (3,4) => (3,-4) X = 0 Axis (or Y Axis) X’ = -X Y’ = Y EX: (3,4) => (-3,4) X = 0 and Y = 0 (Y axis & X axis) X’ = -X Y’ = -Y EX: (3,4) => (-3,-4)
  • 9.
    ļ‚§ Off diagonalterms are involved in Shearing. ļ‚§ y' depends linearly on x ; This effect is called shear.
  • 10.
    ļ‚§ Positive Rotations:counter clockwise about the origin.
  • 11.
  • 12.
    Īø (in degrees)Matrix T 90 180 270 or -90 360 or 0
  • 13.
    ļ‚§ Rotate thefollowing shape by Īø=270 anticlockwise
  • 14.
    ļ‚§ B =A + Td , where Td = [tx ty]T. ļ‚§ x’= x + tx , y’= y + ty. ļ‚§ Where else are translations introduced? 1. Rotations - when objects are not centered at the origin. 2. Scaling - when objects/lines are not centered at the origin. if line intersects the origin then no translation. ļ‚§ Note: we cannot directly represent translations as matrix multiplication, as we know so far. ļ‚§ We can represent translations in our general transformation by using homogeneous coordinates.
  • 16.
    ļ‚§ Use a3 x 3 matrix: ļ‚§ x' = ax + cy + tx ļ‚§ y' = bx + cy + ty ļ‚§ w’ = w ļ‚§ Each point is now represented by a triplet: (x, y, w). ļ‚§ (x/w, y/w) are called the Cartesian coordinates of the homogeneous points.
  • 17.
    ļ‚§ EX: Given4 homogeneous points ļ‚§ P0=(3,4,2,.5) P1=(24,32,16,4) P2=(9,12,6,1) P3=(18,24,12,3) ļ‚§ Which of the homogeneous points represent a different 3d point? ļ‚§ P0= (3/.5,4/.5,2/.5)= (6,8,4) ļ‚§ P1=(24/4,32/4,16/4)= (6,8,4) ļ‚§ P2=(9/1,12/1,6/1)= (9,12,6) ļ‚§ P3=(18/3,24/3,12/3)= (6,8,4) ļ‚§ So p2 is different
  • 18.
    ļ‚§ General Purpose2D transformations in homogeneous coordinate representation: ļ‚§ Parameters involved in scaling, rotation, reflection and shear are: a, b, c, d. ļ‚§ For translation: If [B]=[T][A] then p,q are translation Parameter. if [B]=[A][T] then m,n are translation parameter.
  • 19.
    ļ‚§ There arethree steps for translation about an arbitrary point in space: 1. Translate by (-Tx, -Ty). 2. Scale by Sx, Sy, where Sx = new coordinate for x/ old Sy = new coordinate for y/ old 3. Translate back by (Tx, Ty)
  • 20.
    ļ‚§ EX: Applytranslation to the matrix according to the shape below. 1 0 16 0 1 4 0 0 1 1 0 -2 0 1 -2 0 0 1 8 0 0 0 2 0 0 0 1 X Y Z
  • 21.
    ļ‚§ There arethree steps for scaling about an arbitrary point in space: 1. Translate by (-Tx, -Ty) 2. Scale by Sx, Sy 3. Translate back by (Tx, Ty)
  • 23.
    ļ‚§ EX: ApplyScaling up to the matrix such that Tx= 1, Ty= 2, Sx= 4, Sy= 12. = = = ļ‚§ x’= x+7w y’=y+16w w’=w 1 0 -1 0 1 -2 0 0 1 X’ Y’ Z’ 4 0 0 0 12 0 0 0 1 1 0 4 0 1 12 0 0 1 X Y Z 1 0 3 0 1 4 0 0 1 1 0 4 0 1 12 0 0 1 X Y Z 1 0 7 0 1 16 0 0 1 X Y Z
  • 24.
    ļ‚§ EX: ApplyScaling down to the matrix such that Tx= 1, Ty= 2, Sx= 4, Sy= 12. = 1 0 -4 0 1 -12 0 0 1 X’ Y’ Z’ 1/4 0 0 0 1/6 0 0 0 1 1 0 1 0 1 2 0 0 1 X Y Z
  • 25.
    ļ‚§ There arethree steps for rotation about an arbitrary point in space: 1. Translate by (-Px, -Py). 2. Rotate. 3. Translate back by (Px, Py)
  • 27.
    ļ‚§ EX: Applyrotation to the matrix such that Px= 1, Py= 4 by Īø = 90 . = 1 0 -1 0 1 -4 0 0 1 X’ Y’ Z’ 0 -1 0 1 0 0 0 0 1 1 0 1 0 1 4 0 0 1 X Y Z
  • 28.
    ļ‚§ There arefive steps for reflection about an arbitrary point in space: 1. Translate line to the origin. 2. Rotation about the origin. 3. Reflection matrix. 4. Reverse the rotation. 5. Translate line back. ļ‚§ If the line pass the origin we need only 3 steps (remove step 1 and step 5).
  • 29.
    ļ‚§ If wewant to apply a series of transformations T1, T2, T3 to a set of points, we can do it in two ways: 1. We can calculate p'=T1*p, p''= T2*p', p'''=T3*p'' 2. Calculate T=T1*T2*T3 then p'''=T*p. ļ‚§ Translations: Translate the points by tx1, ty1, then by tx2, ty2. ļ‚§ Scaling: Similar to translations. ļ‚§ Rotations: Rotate by Īø1, then by Īø2 and its done by 2 ways: 1. Replace Īø1, Īø2 by Īø=Īø1+Īø2. 2. calculate T1 for Īø1, then T2 for Īø2 then multiply them.
  • 30.
    ļ‚§ EX: Applytwo scaling to the matrix such that Sx1= 2, Sy1= 3, Sx2=4, Sy2=2. ļ‚§ Way #1 ļ‚§ P’= = ļ‚§ P’’= = 2 0 0 0 3 0 0 0 1 1 0 0 0 2 0 0 0 1 1 0 0 0 2 0 0 0 1 2 0 0 0 6 0 0 0 1 4 0 0 0 2 0 0 0 1 2 0 0 0 6 0 0 0 1 8 0 0 0 12 0 0 0 1
  • 31.
    ļ‚§ Way #2 ļ‚§T = = ļ‚§ P’’= = 2 0 0 0 3 0 0 0 1 4 0 0 0 2 0 0 0 1 8 0 0 0 6 0 0 0 1 8 0 0 0 6 0 0 0 1 1 0 0 0 2 0 0 0 1 8 0 0 0 12 0 0 0 1
  • 32.
    ļ‚§ EX: Findthe new coordinate for the point (3,7,1) if you rotate the point by 180 degree then by 90 degree with clockwise. ļ‚§ Composite rotation : 180 + 90 = 270 degree ļ‚§ Since w=1 the Cartesian coordinate for the point is (3,7) 1 0 -3 0 1 -7 0 0 1 Cos270 Sin270 0 -Sin270 Cos270 0 0 0 1 1 0 3 0 1 7 0 0 1
  • 33.
    ļ‚§ EX: Supposeyou have the point (2,4),rotate the point by 90 degree then by 180 degree the by 45 degree then by 45 degree then scale it by Sx=2 and Sy=4. ļ‚§ Composite rotation : 90+180+45+45 = 360 degree 2 0 0 0 4 0 0 0 1 Cos360 Sin360 0 -Sin360 Cos360 0 0 0 1 2 4 1
  • 34.
    ļ‚§ EX: Transformthe point from left to right. ļ‚§ Sx1= 4/2= 2, Sy1= 5/2= 2.5, Sx2= 7/4, Sy2= 8/5 ļ‚§ Sx= 2*7/4= 3.5, Sy= 2.5*8/5= 4 1 0 -2 0 1 -2 0 0 1 3.5 0 0 0 4 0 0 0 1 1 0 7 0 1 8 0 0 1
  • 35.
    ļ‚§ EX: Transformthe point from left to right. ļ‚§ Sx= 3/1= 3, Sy= 3/1= 3 1 0 -1 0 1 -1 0 0 1 3 0 0 0 3 0 0 0 1 1 0 3 0 1 3 0 0 1
  • 36.
    ļ‚§ Cases whereT1 * T2 = T2 * T1: T1 T2 Translation Translation Scaling Scaling Rotation Rotation Uniform Scaling Rotation
  • 37.
    ļ‚§ EX: Ifwe scale, translate to origin then translate back is it equivalent to translate to origin, scale then translate back? (Sx=2, Sy=3, tx=3, tx=2) ļ‚§ Answer: No, the order of matrix is important. = = 2 0 0 0 3 0 0 0 1 1 0 -3 0 1 -2 0 0 1 1 0 3 0 1 2 0 0 1 2 0 0 0 3 0 0 0 1 2 0 0 0 3 0 0 0 1 1 0 -3 0 1 -2 0 0 1 1 0 3 0 1 2 0 0 1 2 0 3 0 3 4 0 0 1
  • 38.
    ļ‚§ EX: Ifwe rotate the object by 90 degree then scale it ,is it equivalent to scale it then rotate it by 90 degree ? (Sx=2, Sy=3) = = 0 -1 0 1 0 0 0 0 1 2 0 0 0 3 0 0 0 1 0 -3 0 2 0 0 0 0 1 0 -1 0 1 0 0 0 0 1 2 0 0 0 3 0 0 0 1 0 -2 0 3 0 0 0 0 1
  • 39.
    ļ‚§ EX: Ifwe rotate the object by 90 degree then scale it ,is it equivalent to scale it then rotate it by 90 degree ? (Sx=4, Sy=4) = = 0 -1 0 1 0 0 0 0 1 4 0 0 0 4 0 0 0 1 0 -4 0 4 0 0 0 0 1 0 -1 0 1 0 0 0 0 1 4 0 0 0 4 0 0 0 1 0 -4 0 4 0 0 0 0 1
  • 40.
    ļ‚§ EX: Provethat rotation then translation not equal to translation then rotation? = = not equal to the above CosĪø -SinĪø 0 SinĪø CosĪø 0 0 0 1 1 0 - tx 0 1 - ty 0 0 1 CosĪø –SinĪø -txcosĪø+tysinĪø SinĪø CosĪø -txsinĪø-tycosĪø 0 0 1 1 0 - tx 0 1 - ty 0 0 1 CosĪø -SinĪø 0 SinĪø CosĪø 0 0 0 1
  • 41.
    ļ‚§ EX: Givena solid object, if we apply uniform scale then translation to the body, is it the same as we apply translation then uniform scale? = = Sx 0 0 0 Sy 0 0 0 1 1 0 tx 0 1 ty 0 0 1 Sx Sy Sxtx 0 Sy Syty 0 0 11 0 tx 0 1 ty 0 0 1 Sx 0 0 0 Sy 0 0 0 1 Sx 0 tx 0 Sy ty 0 0 1
  • 42.
    ļ‚§ Screen Coordinates:The coordinate system used to address the screen (device coordinates). ļ‚§ World Coordinates: A user-defined application specific coordinate system having its own units of measure, axis, origin, etc. ļ‚§ Window: The rectangular region of the world that is visible. ļ‚§ Viewport: The rectangular region of the screen space that is used to display the window.
  • 43.
    ļ‚§ The Purposeis to find the transformation matrix that maps the window in world coordinates to the viewport in screen coordinates. ļ‚§ Window: (x, y space) denoted by: xmin, ymin, xmax, ymax. ļ‚§ Viewport: (u, v space) denoted by: umin, vmin, umax, vmax.
  • 44.
    ļ‚§ The overalltransformation: Translate the window to the origin. Scale it to the size of the viewport. Translate it to the viewport location.
  • 46.
    ļ‚§ EX: Given(xmin=3, ymin=12, xmax=8, ymax=16) (umin=1, vmin=2, umax=2, vmax=4) Sx=1/5,Sy=1/2 Map from window to view port. 0 0 -3 0 1 -12 0 0 1 1/5 0 0 0 1/2 0 0 0 1 1 0 1 0 1 2 0 0 1
  • 47.
    ļ‚§ Map fromwindow to view port. ļ‚§ (xmin=20, ymin=10, xmax=40, ymax=50) ļ‚§ (umin=5, vmin=4, umax=10, vmax=12) ļ‚§ Sx=(10-5)/(40-20)= 0.25, Sy=(12-4)/(50-10)=0.2 1 0 -20 0 1 -10 0 0 1 .25 0 0 0 .2 0 0 0 1 1 0 5 0 1 4 0 0 1