Graphics Reference
In-Depth Information
which in matrix form is
·
x
y
z
1
s x 000
0 s y 00
00 s z 0
0001
x
y
z
1
=
(7.51)
The scaling is relative to the origin, but we can arrange for it to be relative
to an arbitrary point ( p x ,p y ,p z ) with the following algebra:
x = s x ( x
p x )+ p x
y = s y ( y
p y )+ p y
z = s z ( z
p z )+ p z
(7.52)
which in matrix form is
x
y
z
1
s x
s x )
0 s y 0 p y (1 − s y )
00 s z p z (1 − s z )
000
00 p x (1
x
y
z
1
·
=
(7.53)
1
7.4.3 3D Rotations
In two dimensions a shape is rotated about a point, whether it be the origin
or some arbitrary position. In three dimensions an object is rotated about an
axis, whether it be the x -, y -or z -axis, or some arbitrary axis. To begin with,
let's look at rotating a vertex about one of the three orthogonal axes; such
rotations are called Euler rotations after the Swiss mathematician Leonhard
Euler (1707-1783).
Recall that a general 2D-rotation transform is given by
x
y
1
cos( β )
sin( β )0
x
y
1
=
·
sin( β )
cos( β )0
(7.54)
0
0
1
which in 3D can be visualized as rotating a point P ( x, y, z ) on a plane parallel
with the xy -plane as shown in Figure 7.8. In algebraic terms this can be written
as
x = x cos( β )
y sin( β )
y = x sin( β )+ y cos( β )
z = z
(7.55)
Therefore, the 3D transform can be written as
x
y
z
1
cos( β )
sin( β )00
x
y
z
1
·
sin( β )
cos( β )00
=
(7.56)
0
0
1
0
0
0
0
1
Search WWH ::




Custom Search