Transformations II 1. Reflection

advertisement
Computer Graphics
Transformations II
Transformations II
1. Reflection
Reflection is also known as mirror image. Reflection is useful in the
construction of the symmetric objects. The reflection transformation is
expressed as follows :
[
]
For reflection through x=0 plane ( y & z mirror ) :
[
]
For reflection through y=0 plane ( x & z mirror ):
[
]
For reflection through z =0 plane ( x & y mirror ) :
[
]
Example : reflection about coordinate origin (x,y)=(0,0) :
[
]
1
Computer Technology _ Software Dep. _ Wadhah R. Baiee _2011
Computer Graphics
Transformations II
2. Shearing :
A shearing in the x direction relative to the x axis unalters the y coordinate
while shifts the x coordinate by a value directly proportional to y coordinate.
An x direction shearing relative to the y-axis is given by:
Where
[
]
Similarly , y direction shearing relative to the x-axis is given by
[
]
2
Computer Technology _ Software Dep. _ Wadhah R. Baiee _2011
Computer Graphics
Transformations II
Example : transform the following shape using x Shearing relative to the yaxis , h = -2 .
[
]
Example : transform the following shape using x and y Shearing relative to
the x-axis and y-axis , hx = 2 ,hy=3 .
[
]
3
Computer Technology _ Software Dep. _ Wadhah R. Baiee _2011
Computer Graphics
Transformations II
3. Rotation :
Rotation is more difficult to specify than translation because we must specify
more parameters. We start with the simple example of rotating a point about
the origin in a two-dimensional plane, as shown in Figure . Having specified a
particular point—the origin—we are in a particular frame. A two-dimensional
point at (x, y) in this frame is rotated about the origin by an angle
to the
position (x', y'). We can obtain the standard equations describing this rotation
by representing (x, y) and (x', y') in polar form
,
(
) ,
(
)
Expanding these terms using the trigonometric identities for the sine and
cosine of the sum of two angles, we find :
These equations can be written in matrix form as
[ ]
[
][ ]
Note : the above rotation transformation matrix is a definition of a positive
direction of rotation in counterclockwise.
Rotation about the x-axis by an angle
by an angle
followed by rotation about the y-axis
does not give us the same result as the one that we obtain if we
reverse the order of the rotations. We can find the matrices for rotation about
the individual axes directly from the results of the two-dimensional rotation that
4
Computer Technology _ Software Dep. _ Wadhah R. Baiee _2011
Computer Graphics
Transformations II
we developed above. We saw that the two-dimensional rotation was actually a
rotation in three dimensions about the z-axis and that the points remained in
planes of constant z. Thus, in three dimensions, the equations for rotation
about the z-axis by an angle
(
are:
) ,
(
) ,
or, in matrix form,
[
]
[ ]
We can derive the matrices for rotation about the x- and y-axes through an
identical argument. If we rotate about the x-axis, then the x values are
unchanged, and we have a two-dimensional rotation in which points rotate in
planes of constant x; for rotation about the y-axis, the y values are unchanged.
The matrices are:
[
]
[
]
Suppose that we let R denote any of our three rotation matrices. A rotation
by
can always be undone by a subsequent rotation by
( )
(
; hence,
)
5
Computer Technology _ Software Dep. _ Wadhah R. Baiee _2011
Download