Download presentation
Presentation is loading. Please wait.
Published byRosaline Harrell Modified over 8 years ago
1
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects from three to two dimensions Transformations include: –Translation –Scaling –Rotation –Reflections Transformations can be represented by matrices and matrix multiplication II 2D Transformation
2
II-2 Transformation of Points Representation of Points: ; Transformation of Straight Lines
3
II-3 Rotation Consider rotation about the origin by degrees –radius stays the same, angle increases by x’=x cos –y sin y’ = x sin + y cos x = r cos y = r sin x’ = r cos ( y’ = r sin (
4
II-4 The transformation for a general rotation about the origin by an arbitrary angle
5
II-5 Scaling Scaling increases or decreases the size of the object Scaling occurs with respect to the origin –If the object is not centered at the origin, it will move in addition to changing size In general, this is done with the equations: x n = s x * x y n = s y * y This can also be done with the matrix multiplication:
6
II-6 Example:
7
II-7 Reflection corresponds to negative scale factors original s x = -1 s y = 1 s x = -1 s y = -1s x = 1 s y = -1
8
II-8 The reflection about the y=x is obtained by The reflection about the y-axis (x=0) is obtained by The reflection about the x-axis (y=0) is obtained by The reflection about the y=-x is obtained by
9
II-9
10
II-10
11
II-11 Translations The amount of the translation is added to or subtracted from the x and y coordinates In general, this is done with the equations: x n = x + t x y n = y + t y This can also be done with the matrix multiplication:
12
II-12 Homogeneous Coordinates The two dimensional point (x, y) is represented by the homogeneous coordinate (x, y, 1) Some transformations will alter this third component so it is no longer 1 In general, the homogeneous coordinate (x, y, w) represents the two dimensional point (x/w, y/w) General transformation matrix:
13
II-13 Order of Transformations Matrix multiplication is not commutative so changing the order of transformation can change the result For example, changing the order of a translation and a rotation produces a different result:
14
II-14
15
II-15
16
II-16
17
II-17 Rotation about an arbitrary point through an angle
18
II-18
19
II-19
20
II-20
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.