Anda di halaman 1dari 13

3-D Transformation II

Shubhangi Shinde
The 3D Viewing Pipeline

Objects are modeled in object (modeling) space.
Transformations are applied to the objects to position
them in world space.
View parameters are specified to define the view volume
of the world, a projection plane, and the viewport on the
screen.
Objects are clipped to this View volume.
The results are projected onto the projection plane
(window) and finally mapped into the 3D viewport.
Hidden objects are then removed.
The objects are scan converted and shaded if necessary.

3D Transformations
2D coordinates 3D coordinates
x
y
x
y
z
x
z
y
Right-handed coordinate system:
3D Translation
Translation of a Point
z y x
t z z t y y t x x + = + = + = ' , ' , '
(
(
(
(

(
(
(
(

=
(
(
(
(

1 1 0 0 0
1 0 0
0 1 0
0 0 1
1
'
'
'
z
y
x
t
t
t
z
y
x
z
y
x
x
z
y
3D Scaling
Uniform Scaling

z y x
s z z s y y s x x = = = ' , ' , '
(
(
(
(

(
(
(
(

=
(
(
(
(

1 1 0 0 0
0 0 0
0 0 0
0 0 0
1
'
'
'
z
y
x
s
s
s
z
y
x
z
y
x
x
z
y
Relative Scaling
Scaling with a Selected Fixed Position

(
(
(
(

(
(
(
(

(
(
(
(

(
(
(
(

=
(
(
(
(

=
1 1 0 0 0
1 0 0
0 1 0
0 0 1
1 0 0 0
0 0 0
0 0 0
0 0 0
1 0 0 0
1 0 0
0 1 0
0 0 1
1
'
'
'
) , , ( ) , , ( ) , , (
z
y
x
z
y
x
s
s
s
z
y
x
z
y
x
z y x T s s s S z y x T
f
f
f
z
y
x
f
f
f
f f f z y x f f f
x x x
x
z
z
z z
y
y y
y
Original position Translate Scaling Inverse Translate
3D Rotation
Coordinate-Axes Rotations
X-axis rotation
Y-axis rotation
Z-axis rotation

General 3D Rotations
Rotation about an axis that is parallel to one of the
coordinate axes
Rotation about an arbitrary axis
Coordinate-Axes Rotations
Z-Axis Rotation X-Axis Rotation Y-Axis Rotation
(
(
(
(

(
(
(
(


=
(
(
(
(

1 1 0 0 0
0 1 0 0
0 0 cos sin
0 0 sin cos
1
'
'
'
z
y
x
z
y
x
u u
u u
z
y
x
(
(
(
(

(
(
(
(

=
(
(
(
(

1 1 0 0 0
0 cos sin 0
0 sin cos 0
0 0 0 1
1
'
'
'
z
y
x
z
y
x
u u
u u
(
(
(
(

(
(
(
(

=
(
(
(
(

1 1 0 0 0
0 cos 0 sin
0 0 1 0
0 sin 0 cos
1
'
'
'
z
y
x
z
y
x
u u
u u
z
y
x
z
y
x
Order of Rotations
Order of Rotation Affects Final Position
X-axis Z-axis




Z-axis X-axis
General 3D Rotations
Rotation about an Axis that is Parallel to One
of the Coordinate Axes
Translate the object so that the rotation axis
coincides with the parallel coordinate axis
Perform the specified rotation about that axis
Translate the object so that the rotation axis is
moved back to its original position
General 3D Rotations
Rotation about an Arbitrary Axis
Basic Idea

1. Translate (x1, y1, z1) to the origin
2. Rotate (x2, y2, z2) on to the z axis
3. Rotate the object around the z-axis
4. Rotate the axis to the original
orientation
5. Translate the rotation axis to the
original position
(x2,y2,z2)
(x1,y1,z1)
x
z
y
R-1
T-
1
R
T
( ) ( ) ( ) ( ) ( ) ( )T R R R R R T R o | u | o u
x y z y x
1 1 1
=
Other Transformations
Reflection Relative to the xy Plane



Z-axis Shear
x
z
y
x
z
y
(
(
(
(

(
(
(
(

=
(
(
(
(

1 1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
1
z
y
x
z
y
x
'
'
'
(
(
(
(

(
(
(
(

=
(
(
(
(

1 1 0 0 0
0 1 0 0
0 1 0
0 0 1
1
'
'
'
z
y
x
b
a
z
y
x

Anda mungkin juga menyukai