0% found this document useful (0 votes)
35 views43 pages

4.2 - CH 4 - 3D Transformation - Modified

Transformation

Uploaded by

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

4.2 - CH 4 - 3D Transformation - Modified

Transformation

Uploaded by

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

3D Transformation

INTRODUCTION
Here we introduce to about 3D Transformation

TRANSLATION

SHEARING ROTATION

REFLECTIONS SCALING
OBJECTIVE
To understand basic
conventions for
object
transformations in 3D

To understand
To understand
basic
other
transformations
transformations
in 3D including
like Reflection,
Translation,
Shear
Rotation, Scaling
Transformation
Transformations are a fundamental part
of the computer graphics. Transformations
are the movement of the object in
Cartesian plane .
Why we use transformation
• Transformation are used to position objects , to
shape object , to change viewing positions , and
even how something is viewed.

• In simple words transformation is used for


1) Modeling
2) viewing
Three Dimensional Transformations

When the transformation takes place on a 3D


plane , it is called 3D transformation.
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: 4×4 elements


3D Transformation
3D
3D Transformation
Transformation

Complex &
Simple Conjugate
transformation transformation

Translation Reflection

Rotation
Shearing

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

 x
 y 
 z 
3D Point Homogenous Coordinate

• We don't lose anything

• The main advantage: it is easier to


compose translation and rotation

• Everything is matrix multiplication


3D Coordinate Systems
Left Hand coordinate
system:
3D Transformation
In homogeneous coordinates, 3D
transformations are represented by 4×4
matrixes:
a b c tx 
d e f 
ty 

g h i tz 
 
0 0 0 1
TRANSLATION
3D translation
• An object is translated in 3D dimensional by
transforming each of the defining points of the
objects.
• Moving of object is called translation.
• In 3 dimensional homogeneous coordinate
representation , a point is transformed from position
P = ( x, y , z) to P’=( x’, y’, z’)
•This can be written as:-
Using P’ = T . P
3D translation
• The matrix representation is equivalent to the three equation.
x’=x+ tx , y’=y+ ty , z’=z+ tz
Where parameter tx , ty , tz are specifying translation distance for the
coordinate direction x , y , z are assigned any real value.

• Translate an object by translating each vertex in the object.


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.

fig: 3D rotation
Coordinate Axis Rotations
Obtain rotations around other axes through cyclic
permutation of coordinate parameters:
x yzx

Fig:Coordinate Axis Rotations


Coordinate Axis Rotations
Z-axis rotation: For z axis same as 2D rotation:
x’=x*cos θ-y*sin θ
Y’=x*sin θ +y*cos θ
Z’=z

P  R z ( )  P

Fig : Z-axis rotation


Coordinate Axis Rotations
X-axis rotation:
x y
Y’=y*cos θ -z*sin θ y z
Z’=y*sin θ +z*cos θ
X’=x

P  R x ( )  P

Fig : X-axis rotation


Coordinate Axis Rotations
Y-axis rotation:
x z
Z’=z*cos θ -x*sin θ y x
X’=z*sin θ +x*cos θ
Y’=y
P  R y ( )  P

Fig : Y-axis rotation


SCALING
3D Scaling
You can change the size of an object using
scaling transformation . In the scaling process ,
you either expand or compress the dimensions
of the object . Scaling can be achieved by
multiplying the original coordinates of the
object with scaling factor to get the desired
result.
3D Scaling
About origin: Changes the size of the object and
repositions the object relative to the coordinate origin.
where Sx = scale factor in the x direction, Sy = scale
factor in the y direction, and Sz = scale factor in the z
direction.

Fig: Scaling
3d scaling
• The equations for scaling :
x’ = x . sx
Ssx,sy,sz y’ = y . sy
z’ = z . sz

P  S P fig name: After scaling


3D Scaling
About any fixed point:
Scaling with respect to an arbitrary fixed point is not as
simple as scaling with respect to the origin .
The procedure of scaling with respect to an arbitrary fixed
point is:
 Translate the object so that the fixed point coincides
with the origin.
 Scale the object with respect to the origin.
 Use the inverse translation of step 1 to return the
objects to its original position.
3D Scaling
About any fixed point:

The corresponding composite


transformation matrix is:
fig : fixed point scaling

T(x f , y f , z f )  S(s x , s y , s z )  T(x f , y f ,z f )  


REFLECTIONS
3D Reflections

About an axis: equivalent to


180˚rotation about that axis.
3D reflection
• Reflection in computer graphics is used to
emulate reflective objects like mirrors and shiny
surfaces.
• Reflection may be an in x- y plane
y-z plane , and z-x plane.
•Reflection relative to a given plane are
equivalent to 180 Degree rotations to
that plane.

Fig: reflection
3d reflection
Reflection about x-y plane:-
x’=x y’=y z’=-z z y
1 0 0 0
x
0 1 0 0
0 0 -1 0
Fig: X -Y plane reflection
0 0 0 1
3d reflection
z y
Reflection about y-z plane:- x
y’=y x’=-x z’= z
Fig:Y-Z plane reflection

• The matrix for reflection about y-z plane:-


-1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
3D reflection
• Reflection about z-x plane:-
z y
x’=x y’=-y z’=z 1 0 0 0
x
0 -1 0 0
0 0 1 0
0 0 0 1 Fig: Z - X plane reflection
SHEARING
3D Shearing

A transformation that distorts the shape of


an object such that the transformed shape
appears as if the object were composed of
internal layers that had been caused to slide
over each other is called a shearing.
3D Shearing
• In two dimensions, transformations relative to
the x or y axes to produce distortions in the
shapes of objects. In three dimensions, we can
also generate shears relative to the z axis.

fig: before shearing fig: after 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 zref


SHEARING w.r.t Z AXIS
• Parameters shx and shy can be assigned any real values.
The effect of this transformation matrix is to alter x- and
y-coordinate values by an amount that is proportional to
the z value, while leaving the z coordinate unchanged.

• Boundaries of planes that are perpendicular to the z axis


are thus shifted by an amount proportional to z. An
example of the effect of this shearing matrix on a unit
cube is shown in Fig., for shearing values shx=shy=1.
Shearing matrices for the x axis and y axis are defined
similarly.
SHEARING w.r.t Z AXIS
Parameters shx and shy can be assigned any real values.
The effect of this transformation matrix is to alter x- and
y-coordinate values by an amount that is proportional
to the z value, while leaving the z coordinate
unchanged.
3D Shearing w.r.t. Z axis
x’= x + z.shx
y’= y+ z.shy
z’= z
In matrix form
𝒙′ 𝟏 𝟎 𝒔𝒉𝒙 𝟎 𝒙
𝒚′ 𝟎 𝟏 𝒔𝒉𝒚 𝟎 𝒚
=
𝒛′ 𝟎 𝟎 𝟏 𝟎 𝒛
𝟏 𝟎 𝟎 𝟎 𝟏 𝟏
SHEARING w.r.t X AXIS
The effect of this transformation matrix is to alter y-
and z-coordinate values by an amount that is
proportional to the x value, while leaving the x
coordinate unchanged.
3D Shearing w.r.t. X axis
x’= x
y’= y+ x.shy
z’= z + x.shz
In matrix form
𝒙′ 𝟏 𝟎 𝟎 𝟎 𝒙
𝒚′ 𝒔𝒉𝒚 𝟏 𝟎 𝟎 𝒚
=
𝒛′ 𝒔𝒉𝒛 𝟎 𝟏 𝟎 𝒛
𝟏 𝟎 𝟎 𝟎 𝟏 𝟏
SHEARING w.r.t Y AXIS
The effect of this transformation matrix is to alter x- and
z-coordinate values by an amount that is proportional
to the y value, while leaving the y coordinate
unchanged.
3D Shearing w.r.t. Y axis
x’= x + y.shx
y’= y
z’= z + y.shz
In matrix form
𝒙′ 𝟏 𝒔𝒉𝒙 𝟎 𝟎 𝒙
𝒚′ 𝟎 𝟏 𝟎 𝟎 𝒚
=
𝒛′ 𝟎 𝒔𝒉𝒛 𝟏 𝟎 𝒛
𝟏 𝟎 𝟎 𝟎 𝟏 𝟏
Thank you

You might also like