Two dimentional transform

Patel Punit
Patel PunitVeerayatan engg. college
Two dimentional transform
Transformation
An operation that changes one configuration into
another
Types of Transformation:
Geometric transformation
 Object itself is transformed relative to a stationary co-
ordinate
Co-ordinate transformation
 Co-ordinate system is transformed relative to an object.
 Object is held stationary
2D Geometric Transformations
A two dimensional transformation is any operation
on a point in space (x, y) that maps that point's
coordinates into a new set of coordinates (x1, y1).
Instead of applying a transformation to every point in
every line that makes up an object, the transformation
is applied only to the vertices of the object and then
new lines are drawn between the resulting endpoints.
2D Geometric Transformations
Translate
Rotate Scale
Shear
2D Translation
One of rigid-body transformation, which move objects without
deformation
Translate an object by Adding offsets to coordinates to generate
new coordinates positions
Set tx, ty be the translation distance, we have
P’=P+T
Translation moves the object without deformation
P
P’
T
xtx'x += yty'y +=






=
y
x
P 





=
y
x
t
t
T





=
'y
'x
'P
Basic 2D Translation
To move a line segment, apply the
transformation equation to each of the two
line endpoints and redraw the line between
new endpoints
To move a polygon, apply the transformation
equation to coordinates of each vertex and
regenerate the polygon using the new set of
vertex coordinates
Example
Translate a polygon with coordinates
A(2,5), B(7,10) and c(10,2) by 3 units in
x direction and 4 units in y direction
2D Rotation
Object is rotated ϴ° about the origin.
ϴ > 0 – rotation is counter clock wise
ϴ < 0 – rotation is clock wise
6
π
θ =
y
x0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
2-D Rotation
x = r cos (φ)
y = r sin (φ)
x’ = r cos (φ + θ)
y’ = r sin (φ + θ)
Trig Identity…
x’ = r cos(φ) cos(θ) – r sin(φ)
sin(θ)
y’ = r sin(φ) sin(θ) + r cos(φ)
cos(θ)
Substitute…
x’ = x cos(θ) - y sin(θ)
y’ = x sin(θ) + y cos(θ)
θ
(x, y)
(x’, y’)
φ
Basic 2D Geometric Transformations
2D Rotation matrix
P’=R·P






ΘΘ
Θ−Θ
=
cossin
sincos
R
ΦΦ
(x,y)r
r θ
(x’,y’)











 −
=





y
x
y
x
θθ
θθ
cossin
sincos
'
'
Basic 2D Geometric Transformations
2D Rotation
Rotation for a point about any specified
position (xr, yr)
x’=xr+(x - xr) cos θ – (y - yr) sin θ
y’=yr+(x - xr) sin θ + (y - yr) cos θ
Rotations also move objects without
deformation
A line is rotated by applying the rotation
formula to each of the endpoints and redrawing
the line between the new end points
A polygon is rotated by applying the rotation
formula to each of the vertices and redrawing
the polygon using new vertex coordinates
Example
A point (4,3) is rotated
counterclockwise by an angle 45°
find the rotation matrix and
resultant point.
Basic 2D Geometric Transformations
2D Scaling
Scaling is the process of expanding or compressing
the dimension of an object
Simple 2D scaling is performed by multiplying object
positions (x, y) by scaling factors sx and sy
x’ = x · sx
y’ = y · sy






⋅





=





y
x
s
s
y
x
y
x
0
0
'
'
P(x,y)
P’(x’,y’)
xsx• x
sy• y
y
2D Scaling
Any positive value can be
used as scaling factor
 Sf < 1 reduce the size of the
object
 Sf > 1 enlarge the object
 Sf = 1 then the object stays
unchanged
 If sx= sy, we call it uniform
scaling
 If scaling factor <1, then the
object moves closer to the
origin and If scaling factor >1,
then the object moves farther
from the origin
y
x
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6






1
2






1
3






3
6






3
9
Basic 2D Geometric Transformations
2D Scaling
We can control the location of the scaled object by
choosing a position called the fixed point (xf, yf)
x’ – xf = (x – xf) sx y’ – yf = (y – yf) sy
x’=x · sx+ xf (1 – sx)
y’=y · sy+ yf (1 – sy)
Polygons are scaled by applying the above formula to
each vertex, then regenerating the polygon using the
transformed vertices
Example
Scale the polygon with co-ordinates
A(2,5), B(7,10) and c(10,2) by 2 units in
x direction and 2 units in y direction
Homogeneous Coordinates
Expand each 2D coordinate (x, y) to three element
representation (xh, yh, h) called homogenous
coordinates
h is the homogenous parameter such that
x = xh/h, y = yh/h,
A convenient choice is to choose h = 1
Homogeneous Coordinates for translation
2D Translation Matrix
or, P’ = T(tx,ty)·P










⋅










=










1100
10
01
1
'
'
y
x
t
t
y
x
y
x
Homogeneous Coordinates for
rotation
2D Rotation Matrix
or, P’ = R(θ)·P










⋅










ΘΘ
Θ−Θ
=










1100
0cossin
0sincos
1
'
'
y
x
y
x
Homogeneous Coordinates for scaling
2D Scaling Matrix
or, P’ = S(sx,sy)·P










⋅










=










1100
00
00
1
'
'
y
x
s
s
y
x
y
x
Inverse Transformations
2D Inverse Translation Matrix










−
−
=−
100
10
01
1
y
x
t
t
T
Inverse Transformations
2D Inverse Rotation Matrix










ΘΘ−
ΘΘ
=−
100
0cossin
0sincos
1
R
Inverse Transformations
2D Inverse Scaling Matrix
















=−
100
0
1
0
00
1
1
y
x
s
s
S
2D Composite Transformations
We can setup a sequence of transformations as
a composite transformation matrix by
calculating the product of the individual
transformations
P’=M2·M1·P
P’=M·P
2D Composite Transformations
Composite 2D Translations










+
+
=










⋅










100
10
01
100
10
01
100
10
01
21
21
1
1
2
2
yy
xx
y
x
y
x
tt
tt
t
t
t
t
2D Composite Transformations
Composite 2D Rotations










Θ+ΘΘ+Θ
Θ+Θ−Θ+Θ
=










ΘΘ
Θ−Θ
⋅










ΘΘ
Θ−Θ
100
0)cos()sin(
0)sin()cos(
100
0cossin
0sincos
100
0cossin
0sincos
2121
2121
11
11
22
22
2D Composite Transformations
Composite 2D Scaling










⋅
⋅
=










⋅










100
00
00
100
00
00
100
00
00
21
21
1
1
2
2
yy
xx
y
x
y
x
ss
ss
s
s
s
s
Two dimentional transform










−−
+−−
=










−
−
⋅









 −
⋅










100
sin)cos1(cossin
sin)cos1(sincos
100
10
01
100
0cossin
0sincos
100
10
01
θθθθ
θθθθ
θθ
θθ
rr
rr
r
r
r
r
xy
yx
y
x
y
x
( ) ( ) ( ) ( )θθ ,,,, rrrrrr yxRyxTRyxT =−−⋅⋅
Translate Rotate Translate
(xr,yr
)
(xr,yr
)
(xr,yr
)
(xr,yr
)
Two dimentional transform










−
−
=










−
−
⋅










⋅










100
)1(0
)1(0
100
10
01
100
00
00
100
10
01
yfy
xfx
f
fx
f
f
sys
sxs
y
x
s
s
y
x
y
Translate Scale Translate
(xr,yr
)
(xr,yr
)
(xr,yr
)
(xr,yr
)
( ) ( ) ( ) ( )yxffffyxff ssyxSyxTssSyxT ,,,, ,, =−−⋅⋅
Another Example.
Scale
Translate
Rotate
Translate
Example
I sat in the car, and find the side mirror is 0.4m on
my right and 0.3m in my front
• I started my car and drove 5m forward, turned 30
degrees to right, moved 5m forward again, and
turned 45 degrees to the right, and stopped
• What is the position of the side mirror now,
relative to where I was sitting in the beginning?
Other Two Dimensional Transformations
Reflection
Transformation that produces a mirror
image of an object
Image is generated relative to an axis of
reflection by rotating the object 180°
about the reflection axis
Reflection about the line y=0 (the x axis)










−
100
010
001
Reflection about the line x=0 (the y axis)









−
100
010
001
Reflection about the origin










−
−
100
010
001
Reflection when x = y
Example
Consider the triangle ABC with co-
ordinates x(4,1), y(5,2), z(4,3). Reflect
the triangle about the x axis and then
about the line y = -x
Shear
Transformation that distorts the shape of an
object is called shear transformation.
Two shearing transformation used:
 Shift X co-ordinates values
 Shift Y co-ordinates values
X shear
y
x
(0,1) (1,1)
(1,0)(0,0)
y
x
(2,1) (3,1)
(1,0)(0,0)
shx=2










100
010
01 xsh
yy
yshxx x
=
⋅+=
'
'
Preserve Y coordinates but change the X coordinates values
Y shear
Preserve X coordinates but change the Y coordinates values
x’ = x
y’ = y + Shy . x
y
x
(0,1) (1,1)
(1,0)(0,0)
y
x
(0,1)
(1,2)
(1,1)(0,0)










100
01
001
ysh
Example
Perform x shear and y shear along on
a triangle A(2,1), B(4,3), C(2,3) sh = 2
Shear relative to other axis
X shear with reference to Y axis
x
y
1
1
yref = -1
x
shx = ½, yref = -1
1
1 2 3
yref = -1
( )x refx x sh y y
y y
′ = + −
′ =
1
0 1 0
1 0 0 1 1
x x refx sh sh y x
y y
′ − ×    
 ÷  ÷ ÷′ = ÷  ÷ ÷
 ÷  ÷ ÷
    
Shear relative to other axis
Y shear with reference to X axis
( )y ref
x x
y y sh x x
′ =
′ = + −
1 0 0
1
1 0 0 1 1
x y ref
x x
y sh sh x y
′    
 ÷  ÷ ÷′ = − × ÷  ÷ ÷
 ÷  ÷ ÷
    
x
y
1
1xref = -1
y
x
1
1
2
xref = -1
Example
Apply shearing transformation to square with
A(0,0), B(1,0), C(1,1), D(0,1).
Shear parameter value is 0.5 relative to line
Yref = - 1 and Xref = - 1
321321321 M)MM()MM(MMMM ⋅⋅=⋅⋅=⋅⋅
Associative properties
Transformation is not commutative (CopyCD!)
Order of transformation may affect transformation
position
Matrix Concatenation Properties
Transformations between 2DTransformations between 2D
Coordinate SystemsCoordinate Systems
To translate object descriptions from xy coordinates to x’y’
coordinates, we set up a transformation that superimposes
the x’y’ axes onto the xy axes. This is done in two steps:
1. Translate so that the origin (x0, y0) of the x’y’ system is
moved to the origin (0, 0) of the xy system.
2. Rotate the x’ axis onto the x axis.
x
y
x0
x’
y’
y0
θ
Translation
(x’,y’)=Tv(x,y)
x’= x – tx
y’=y-ty
Rotation about origin
(x’,y’)=Rϴ(x,y)
x’= xcosϴ + ysinϴ
y’= -xsinϴ + ycosϴ
Scaling with origin
(x’, y’)=Ssx, sy(x,y)
x’= (1/sx)x
y’= (1/sy)y
Reflection about X
axis
(x’,y’)= Mx(x,y)
x’= x
y’= -y
Reflection about Y
axis
(x’,y’)= My(x,y)
x’= -x
y’= y
Example
Find the x’y’-coordinates of the xy points (10, 20)
and (35, 20), as shown in the figure below:
x
y
30
x’
y’
10
30º
(10, 20)
(35, 20)
Example
Find the x’y’-coordinates of the rectangle shown
in the figure below:
x
y
10
x’
y’
10
60º
20
1 von 52

Más contenido relacionado

Was ist angesagt?(20)

3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals
Muhammed Afsal Villan10.4K views
2D Transformation2D Transformation
2D Transformation
ShahDhruv211.2K views
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
Mohd Arif28.5K views
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
Kongunadu College of engineering and Technology, Namakkal4.1K views
Composite transformationsComposite transformations
Composite transformations
Mohd Arif61.8K views
Modeling TransformationsModeling Transformations
Modeling Transformations
Tarun Gehlot2.9K views
3D Geometric Transformations3D Geometric Transformations
3D Geometric Transformations
Ishan Parekh25.3K views
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
Selvakumar Gna24K views
Parallel projectionParallel projection
Parallel projection
Prince Shahu3.7K views
transformation 3dtransformation 3d
transformation 3d
HiteshJain00715.1K views
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
Sanu Philip142K views
3D Transformation3D Transformation
3D Transformation
Ahammednayeem529 views
3d transformation3d transformation
3d transformation
Sehrish Asif4.4K views
Bresenham circleBresenham circle
Bresenham circle
Taher Barodawala45.8K views
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
Mani Kanth3.3K views

Destacado(20)

Geometric transformation 2d   chapter 5Geometric transformation 2d   chapter 5
Geometric transformation 2d chapter 5
geethawilliam3.8K views
Hearn and Baker 2 D transformations   Hearn and Baker 2 D transformations
Hearn and Baker 2 D transformations
Taher Barodawala8.1K views
Image capture powerpointImage capture powerpoint
Image capture powerpoint
cbottomleyct2.6K views
Lect6 transformation2dLect6 transformation2d
Lect6 transformation2d
BCET728 views
Supot37255412160Supot37255412160
Supot37255412160
Ajay Ochani880 views
Transforms UNIt 2 Transforms UNIt 2
Transforms UNIt 2
sandeep kumbhkar1.3K views
Introduction to CAD/CAMIntroduction to CAD/CAM
Introduction to CAD/CAM
DINBANDHU SINGH18.3K views
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya44.5K views
Capture a digital image   topic 1Capture a digital image   topic 1
Capture a digital image topic 1
obserbmx1.1K views
Factor analysisFactor analysis
Factor analysis
Dhruv Goel1.5K views
Introduction cadIntroduction cad
Introduction cad
PUNIT TRIVEDI444 views
PlanningPlanning
Planning
Harriet Hearn763 views
Lab lecture 2 bresenhamLab lecture 2 bresenham
Lab lecture 2 bresenham
simpleok311 views
CgmoduleCgmodule
Cgmodule
Amandeep Kaur262 views

Similar a Two dimentional transform

Unit 3 notesUnit 3 notes
Unit 3 notesBalamurugan M
147 views14 Folien
2D Transformation2D Transformation
2D TransformationAsma Tehseen
191 views9 Folien

Similar a Two dimentional transform(20)

Unit 3 notesUnit 3 notes
Unit 3 notes
Balamurugan M147 views
06.Transformation.ppt06.Transformation.ppt
06.Transformation.ppt
RobinAhmedSaikat22 views
2d transformation2d transformation
2d transformation
Sarkunavathi Aribal192 views
Unit-3 overview of transformationsUnit-3 overview of transformations
Unit-3 overview of transformations
Amol Gaikwad134 views
2D Transformation2D Transformation
2D Transformation
Asma Tehseen191 views
transformation IT.ppttransformation IT.ppt
transformation IT.ppt
ShubhamBatwani84 views
09transformation3d09transformation3d
09transformation3d
Ketan Jani594 views
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
Daffodil International University300 views
2D Translation.pdf2D Translation.pdf
2D Translation.pdf
MehulMunshi36 views
2 d transformation2 d transformation
2 d transformation
Ankit Garg22K views
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
aravindangc98 views
2D transformations2D transformations
2D transformations
vijaysharma126563 views
2d transformations2d transformations
2d transformations
rajeshranjithsingh229 views
2D-transformation-1.pdf2D-transformation-1.pdf
2D-transformation-1.pdf
bcanawakadalcollege9 views
Computer Graphics - transformations in 2dComputer Graphics - transformations in 2d
Computer Graphics - transformations in 2d
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D155 views
2-D Transformations.pdf2-D Transformations.pdf
2-D Transformations.pdf
Mattupallipardhu14 views
3 d transformation3 d transformation
3 d transformation
Mani Kanth345 views
3d transformation computer graphics 3d transformation computer graphics
3d transformation computer graphics
University of Potsdam43K views

Último(20)

Forex secret Forex secret
Forex secret
konghatatih10 views
Car license plate holder.pdfCar license plate holder.pdf
Car license plate holder.pdf
JAWADIQBAL4028 views
terms_2.pdfterms_2.pdf
terms_2.pdf
JAWADIQBAL4023 views
The Business Tycoons(May-2023) - Health Care MagazineThe Business Tycoons(May-2023) - Health Care Magazine
The Business Tycoons(May-2023) - Health Care Magazine
Global India Business Forum12 views
ZARA.pptxZARA.pptx
ZARA.pptx
merlinjenma52918 views
Muhammad Al Farizi_ParkWise.pptxMuhammad Al Farizi_ParkWise.pptx
Muhammad Al Farizi_ParkWise.pptx
Muhammad Al Farizi68 views
Effective Supervisory SkillEffective Supervisory Skill
Effective Supervisory Skill
Seta Wicaksana13 views
Ceramic Grinding Roller.pdfCeramic Grinding Roller.pdf
Ceramic Grinding Roller.pdf
TomasChien217 views
valuation firm.valuation firm.
valuation firm.
NandniDhyani9 views
Coomes Consulting Business ProfileCoomes Consulting Business Profile
Coomes Consulting Business Profile
Chris Coomes32 views
Problem Solving & Visualization ToolsProblem Solving & Visualization Tools
Problem Solving & Visualization Tools
Operational Excellence Consulting (Singapore)30 views
Corporate DeckCorporate Deck
Corporate Deck
Equinox Gold Corp.228 views

Two dimentional transform

  • 2. Transformation An operation that changes one configuration into another Types of Transformation: Geometric transformation  Object itself is transformed relative to a stationary co- ordinate Co-ordinate transformation  Co-ordinate system is transformed relative to an object.  Object is held stationary
  • 3. 2D Geometric Transformations A two dimensional transformation is any operation on a point in space (x, y) that maps that point's coordinates into a new set of coordinates (x1, y1). Instead of applying a transformation to every point in every line that makes up an object, the transformation is applied only to the vertices of the object and then new lines are drawn between the resulting endpoints.
  • 5. 2D Translation One of rigid-body transformation, which move objects without deformation Translate an object by Adding offsets to coordinates to generate new coordinates positions Set tx, ty be the translation distance, we have P’=P+T Translation moves the object without deformation P P’ T xtx'x += yty'y +=       = y x P       = y x t t T      = 'y 'x 'P
  • 6. Basic 2D Translation To move a line segment, apply the transformation equation to each of the two line endpoints and redraw the line between new endpoints To move a polygon, apply the transformation equation to coordinates of each vertex and regenerate the polygon using the new set of vertex coordinates
  • 7. Example Translate a polygon with coordinates A(2,5), B(7,10) and c(10,2) by 3 units in x direction and 4 units in y direction
  • 8. 2D Rotation Object is rotated ϴ° about the origin. ϴ > 0 – rotation is counter clock wise ϴ < 0 – rotation is clock wise 6 π θ = y x0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6
  • 9. 2-D Rotation x = r cos (φ) y = r sin (φ) x’ = r cos (φ + θ) y’ = r sin (φ + θ) Trig Identity… x’ = r cos(φ) cos(θ) – r sin(φ) sin(θ) y’ = r sin(φ) sin(θ) + r cos(φ) cos(θ) Substitute… x’ = x cos(θ) - y sin(θ) y’ = x sin(θ) + y cos(θ) θ (x, y) (x’, y’) φ
  • 10. Basic 2D Geometric Transformations 2D Rotation matrix P’=R·P       ΘΘ Θ−Θ = cossin sincos R ΦΦ (x,y)r r θ (x’,y’)             − =      y x y x θθ θθ cossin sincos ' '
  • 11. Basic 2D Geometric Transformations 2D Rotation Rotation for a point about any specified position (xr, yr) x’=xr+(x - xr) cos θ – (y - yr) sin θ y’=yr+(x - xr) sin θ + (y - yr) cos θ
  • 12. Rotations also move objects without deformation A line is rotated by applying the rotation formula to each of the endpoints and redrawing the line between the new end points A polygon is rotated by applying the rotation formula to each of the vertices and redrawing the polygon using new vertex coordinates
  • 13. Example A point (4,3) is rotated counterclockwise by an angle 45° find the rotation matrix and resultant point.
  • 14. Basic 2D Geometric Transformations 2D Scaling Scaling is the process of expanding or compressing the dimension of an object Simple 2D scaling is performed by multiplying object positions (x, y) by scaling factors sx and sy x’ = x · sx y’ = y · sy       ⋅      =      y x s s y x y x 0 0 ' ' P(x,y) P’(x’,y’) xsx• x sy• y y
  • 15. 2D Scaling Any positive value can be used as scaling factor  Sf < 1 reduce the size of the object  Sf > 1 enlarge the object  Sf = 1 then the object stays unchanged  If sx= sy, we call it uniform scaling  If scaling factor <1, then the object moves closer to the origin and If scaling factor >1, then the object moves farther from the origin y x 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6       1 2       1 3       3 6       3 9
  • 16. Basic 2D Geometric Transformations 2D Scaling We can control the location of the scaled object by choosing a position called the fixed point (xf, yf) x’ – xf = (x – xf) sx y’ – yf = (y – yf) sy x’=x · sx+ xf (1 – sx) y’=y · sy+ yf (1 – sy) Polygons are scaled by applying the above formula to each vertex, then regenerating the polygon using the transformed vertices
  • 17. Example Scale the polygon with co-ordinates A(2,5), B(7,10) and c(10,2) by 2 units in x direction and 2 units in y direction
  • 18. Homogeneous Coordinates Expand each 2D coordinate (x, y) to three element representation (xh, yh, h) called homogenous coordinates h is the homogenous parameter such that x = xh/h, y = yh/h, A convenient choice is to choose h = 1
  • 19. Homogeneous Coordinates for translation 2D Translation Matrix or, P’ = T(tx,ty)·P           ⋅           =           1100 10 01 1 ' ' y x t t y x y x
  • 20. Homogeneous Coordinates for rotation 2D Rotation Matrix or, P’ = R(θ)·P           ⋅           ΘΘ Θ−Θ =           1100 0cossin 0sincos 1 ' ' y x y x
  • 21. Homogeneous Coordinates for scaling 2D Scaling Matrix or, P’ = S(sx,sy)·P           ⋅           =           1100 00 00 1 ' ' y x s s y x y x
  • 22. Inverse Transformations 2D Inverse Translation Matrix           − − =− 100 10 01 1 y x t t T
  • 23. Inverse Transformations 2D Inverse Rotation Matrix           ΘΘ− ΘΘ =− 100 0cossin 0sincos 1 R
  • 24. Inverse Transformations 2D Inverse Scaling Matrix                 =− 100 0 1 0 00 1 1 y x s s S
  • 25. 2D Composite Transformations We can setup a sequence of transformations as a composite transformation matrix by calculating the product of the individual transformations P’=M2·M1·P P’=M·P
  • 26. 2D Composite Transformations Composite 2D Translations           + + =           ⋅           100 10 01 100 10 01 100 10 01 21 21 1 1 2 2 yy xx y x y x tt tt t t t t
  • 27. 2D Composite Transformations Composite 2D Rotations           Θ+ΘΘ+Θ Θ+Θ−Θ+Θ =           ΘΘ Θ−Θ ⋅           ΘΘ Θ−Θ 100 0)cos()sin( 0)sin()cos( 100 0cossin 0sincos 100 0cossin 0sincos 2121 2121 11 11 22 22
  • 28. 2D Composite Transformations Composite 2D Scaling           ⋅ ⋅ =           ⋅           100 00 00 100 00 00 100 00 00 21 21 1 1 2 2 yy xx y x y x ss ss s s s s
  • 34. Example I sat in the car, and find the side mirror is 0.4m on my right and 0.3m in my front • I started my car and drove 5m forward, turned 30 degrees to right, moved 5m forward again, and turned 45 degrees to the right, and stopped • What is the position of the side mirror now, relative to where I was sitting in the beginning?
  • 35. Other Two Dimensional Transformations Reflection Transformation that produces a mirror image of an object Image is generated relative to an axis of reflection by rotating the object 180° about the reflection axis
  • 36. Reflection about the line y=0 (the x axis)           − 100 010 001
  • 37. Reflection about the line x=0 (the y axis)          − 100 010 001
  • 38. Reflection about the origin           − − 100 010 001
  • 40. Example Consider the triangle ABC with co- ordinates x(4,1), y(5,2), z(4,3). Reflect the triangle about the x axis and then about the line y = -x
  • 41. Shear Transformation that distorts the shape of an object is called shear transformation. Two shearing transformation used:  Shift X co-ordinates values  Shift Y co-ordinates values
  • 42. X shear y x (0,1) (1,1) (1,0)(0,0) y x (2,1) (3,1) (1,0)(0,0) shx=2           100 010 01 xsh yy yshxx x = ⋅+= ' ' Preserve Y coordinates but change the X coordinates values
  • 43. Y shear Preserve X coordinates but change the Y coordinates values x’ = x y’ = y + Shy . x y x (0,1) (1,1) (1,0)(0,0) y x (0,1) (1,2) (1,1)(0,0)           100 01 001 ysh
  • 44. Example Perform x shear and y shear along on a triangle A(2,1), B(4,3), C(2,3) sh = 2
  • 45. Shear relative to other axis X shear with reference to Y axis x y 1 1 yref = -1 x shx = ½, yref = -1 1 1 2 3 yref = -1 ( )x refx x sh y y y y ′ = + − ′ = 1 0 1 0 1 0 0 1 1 x x refx sh sh y x y y ′ − ×      ÷  ÷ ÷′ = ÷  ÷ ÷  ÷  ÷ ÷     
  • 46. Shear relative to other axis Y shear with reference to X axis ( )y ref x x y y sh x x ′ = ′ = + − 1 0 0 1 1 0 0 1 1 x y ref x x y sh sh x y ′      ÷  ÷ ÷′ = − × ÷  ÷ ÷  ÷  ÷ ÷      x y 1 1xref = -1 y x 1 1 2 xref = -1
  • 47. Example Apply shearing transformation to square with A(0,0), B(1,0), C(1,1), D(0,1). Shear parameter value is 0.5 relative to line Yref = - 1 and Xref = - 1
  • 48. 321321321 M)MM()MM(MMMM ⋅⋅=⋅⋅=⋅⋅ Associative properties Transformation is not commutative (CopyCD!) Order of transformation may affect transformation position Matrix Concatenation Properties
  • 49. Transformations between 2DTransformations between 2D Coordinate SystemsCoordinate Systems To translate object descriptions from xy coordinates to x’y’ coordinates, we set up a transformation that superimposes the x’y’ axes onto the xy axes. This is done in two steps: 1. Translate so that the origin (x0, y0) of the x’y’ system is moved to the origin (0, 0) of the xy system. 2. Rotate the x’ axis onto the x axis. x y x0 x’ y’ y0 θ
  • 50. Translation (x’,y’)=Tv(x,y) x’= x – tx y’=y-ty Rotation about origin (x’,y’)=Rϴ(x,y) x’= xcosϴ + ysinϴ y’= -xsinϴ + ycosϴ Scaling with origin (x’, y’)=Ssx, sy(x,y) x’= (1/sx)x y’= (1/sy)y Reflection about X axis (x’,y’)= Mx(x,y) x’= x y’= -y Reflection about Y axis (x’,y’)= My(x,y) x’= -x y’= y
  • 51. Example Find the x’y’-coordinates of the xy points (10, 20) and (35, 20), as shown in the figure below: x y 30 x’ y’ 10 30º (10, 20) (35, 20)
  • 52. Example Find the x’y’-coordinates of the rectangle shown in the figure below: x y 10 x’ y’ 10 60º 20