0% found this document useful (0 votes)
112 views

3D Transformation

Three Dimensional Modeling Transformations  Methods for object modeling transformation in three dimensions are extended from two dimensional methods by including consideration for the z coordinate.

Uploaded by

sadhanamca1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views

3D Transformation

Three Dimensional Modeling Transformations  Methods for object modeling transformation in three dimensions are extended from two dimensional methods by including consideration for the z coordinate.

Uploaded by

sadhanamca1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 45

Three Dimensional

Modeling
Transformations
Dr. S.M. Malaek
Assistant: M. Younesi
Three Dimensional Modeling
Transformations
Methods for object modeling
transformation in three dimensions
are extended from two dimensional
methods by including consideration
for the z coordinate.
Three Dimensional Modeling
Transformations
Generalize from 2D by including z coordinate

Straightforward for translation and scale,
rotation more difficult

Homogeneous coordinates: 4 components

Transformation matrices: 44 elements
3D Point
We will consider points as column vectors.
Thus, a typical point with coordinates (x, y, z)
is represented as:
(
(
(

z
y
x
3D Point Homogenous Coordinate
A 3D point P is represented in
homogeneous coordinates by a 4-dim. Vect:
(
(
(
(

=
1
z
y
x
P
3D Point Homogenous Coordinate
We don't lose anything

The main advantage: it is easier to
compose translation and rotation

Everything is matrix multiplication
(
(
(
(

1
z
y
x
3D Coordinate Systems
Right Hand
coordinate system:
Left Handcoordinate
system:
3D Transformation
In homogeneous coordinates, 3D
transformations are represented by 44
matrixes:
(
(
(
(

1 0 0 0
z
y
x
t i h g
t f e d
t c b a

3D Translation
3D Translation
P is translated to P' by:
(
(
(
(

(
(
(
(

=
(
(
(
(

'
'
'
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
P T P =
'
3D Translation
An object is translated in 3D dimensional by
transforming each of the defining points of the
objects .
3D Translation
An Object represented as a set of polygon surfaces, is translated
by translate each vertex of each surface and redraw the polygon
facets in the new position.
( )
z y x
t t t T , , =
( ) z y x , ,
( ) ' , ' , ' z y x
) , , ( ) , , (
1
z y x z y x
t t t T t t t T =

Inverse Translation:

3D Rotation
3D Rotation
In general, rotations are specified by a
rotation axis and an angle. In
two-dimensions there is only one
choice of a rotation axis that leaves
points in the plane.

3D Rotation
The easiest rotation axes are those that parallel to
the coordinate axis.
Positive rotation angles produce counterclockwise
rotations about a coordinate axix, if we are looking
along the positive half of the axis toward the
coordinate origin.

Coordinate Axis
Rotations
Coordinate Axis Rotations
Z-axis rotation: For z axis same as 2D 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
P R P =
'
) (
z
Coordinate Axis Rotations
Obtain rotations around other axes through
cyclic permutation of coordinate parameters:
x z y x
Coordinate Axis Rotations
(
(
(
(

(
(
(
(

u u
u u
=
(
(
(
(

1 1 0 0 0
0 cos sin 0
0 sin cos 0
0 0 0 1
1
'
'
'
z
y
x
z
y
x
X-axis rotation:
P R P u =
'
) (
x
Coordinate Axis Rotations
(
(
(
(

(
(
(
(

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
P R P u =
'
) (
y
Y-axis rotation:

General Three Dimensional
Rotations
General Three Dimensional Rotations
Rotation axis parallel with coordinate axis (Example x axis):
P T R T P =
'

) (
1
x
An arbitrary axis (with the rotation axis projected onto the Z axis):
T R R R R R T R =

) ( ) ( ) ( ) ( ) ( ) (
1 1 1
x y z y x
General Three Dimensional Rotations
General Three Dimensional Rotations

A rotation matrix for any axis that does not coincide
with a coordinate axis can be set up as a composite
transformation involving combination of translations
and the coordinate-axes rotations:

1. Translate the object so that the rotation axis passes through the
coordinate origin
2. Rotate the object so that the axis rotation coincides with one of
the coordinate axes
3. Perform the specified rotation about that coordinate axis
4. Apply inverse rotation axis back to its original orientation
5. Apply the inverse translation to bring the rotation axis back to its
original position

T R R R R R T R =

) ( ) ( ) ( ) ( ) ( ) (
1 1 1
x y z y x

Other way to look at
rotation
Roll, Pitch, Yaw
Roll, Pitch, Yaw

Imagine three lines running through an
airplane and intersecting at right
angles at the airplane's center of
gravity.
Roll
Roll: rotation around the front-to-back
axis.
PITCH
PI TCH: Rotation around the side-to-side
axis
YAW
YAW: Rotation around the vertical axis.
An Example of the
Airplane
An Example of the Airplane
Consider the following example. An airplane is oriented
such that its nose is pointing in the positive z direction,
its right wing is pointing in the positive x direction, its
cockpit is pointing in the positive y direction. We want
to transform the airplane so that it heads in the direction
given by the vector DOF (direction of flight), is centre
at P, and is not banked.
An Example of the Airplane
First we are to rotate the positive z
p
direction
into the direction of DOF, which gives us the
third column of the rotation matrix: DOF /
|DOF|. The x
p
axis must be transformed into a
horizontal vector perpendicular to DOF that is
in the direction of yDOF. The y
p
direction is
then given by x
p
z
p
= DOF (y DOF).
(
(

=
DOF
DOF
DOF y DOF
DOF y DOF
DOF y
DOF y
R
) (
) (

3D Scaling
3D Scaling
About origin: Changes the size of the object and
repositions the object relative to the coordinate origin.
(
(
(
(

(
(
(
(

=
(
(
(
(

'
'
'
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
P S P =
'
3D Scaling
About any fixed point:
(
(
(
(

=
1 0 0 0
) 1 ( 0 0
) 1 ( 0 0
) 1 ( 0 0
) , , ( ) , , ( ) , , (
f z z
f y y
f x x
f f f z y x f f f
z s s
y s s
x s s
z y x s s s z y x T S T

Composite
3D Transformations
Composite 3D Transformations
Same way as in two dimensions:
Multiply matrices

Rightmost term in matrix product is the first
transformation to be applied

3D Reflections
3D Reflections
About an axis: equivalent to
180rotation about that axis
3D Reflections
About a plane:
A reflection through the xy plane:
(
(
(
(

(
(
(
(

=
(
(
(
(

1 1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
1
z
y
x
z
y
x
A reflections through the xz and the yz
planes are defined similarly.

3D Shearing
3D Shearing
Modify object shapes
Useful for perspective projections:
E.g. draw a cube (3D) on a screen (2D)
Alter the values for x and y by an amount
proportional to the distance from z
ref
3D Shearing
(
(
(
(



=
1 0 0 0
0 1 0 0
1 0
0 1
ref zy zy
ref zx zx
zshear
z sh sh
z sh sh
M

Transformations
Between
Coordinate Systems
Transformations Between Coordinate ystems
Translate such that the origins overlap
Rotate such that the axes overlap
) 0 , 0 , 0 (
) , , (
0 0 0
z y x
x
y
' x
' y
z
' z
'
x
u
'
y
u
'
z
u
( )
0 0 0
3 2 1
3 2 1
3 2 1
, ,
1 0 0 0
0 ' ' '
0 ' ' '
0 ' ' '
z y x T
u u u
u u u
u u u
T R
z z z
y y y
x x x

(
(
(
(

You might also like