3-D Transformations: Figure 5.33 Geometric 3-D Transformation

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 7

3-D Transformations

A three-dimensional graphic object may undergo a transformation in its representation, construction,


manipulation and viewing. It includes geometric and coordinate transformations. Almost any
transformation is composed of a few basic transformations like translation, scaling and rotation. As
you will see, each of these transformations reduces to matrix transformation. Since matrix
manipulation can be carried out very efficiently using computer programs, transformations, therefore,
can also be coded easily.
In geometric transformation, the object itself is manipulated. Each point or the points that are
necessary to construct the object is transformed keeping the coordinate system intact (see figure
5.33).

Figure 5.33 Geometric 3-D Transformation


Alternatively, the coordinate system itself may be transformed keeping the object intact. Only the
view angle and view position changes (see figure 5.34). This approach of transformation is called
coordinate transformation.
Besides, the construction of an object and scene, no matter how complex they are, is facilitated by
the use of instance transformations. In this respect 3-D transformations are more or less direct
generalizations of those of two-dimensional transformations.
Figure 5.34 Co-ordinate 3-D Transformation
5.3.1 Geometric Transformations
From the graphics point of view, an object is a collection of points with respect to some three-
dimensional coordinate system. An object O (or the set of points comprising O) may be expressed as:
O = { (x1, y1, z1), (x2, y2, z2),…. (xn, yn, zn)}
Or
O = {P (x, y, z)}
When this object is transformed, the resulting object may be thought of as a new object (say O’)
whose points are all obtained from the points of original object O after applying geometric
transformations. Thus O’ = {P’(x’, y’, z’)} such that the points P and P’ are mapped onto each other
by some suitable transformation formulae.

5.3.1.1 Translation
In translation, all the points of the object move a distance in a given direction as shown in the
figure 5.35.

 P’(x’, y’, z’)

Figure 5.35 Translation Transformation


Let the direction and displacement of the translation be given in terms of a vector PP’.
PP’ = a î + b ĵ + c k̂
where î , ĵ and k̂ are the unit vectors along the three axes respectively. The new coordinates of a
translated point can be obtained by using the transformation given below.
x '  x  a

P '  y '  y  b
 z'  z  c

The same can be expressed in matrix form as obtained below. Converting the equations into
homogeneous form we get,

x '  1 .x  0 .y  0 .z  a .1

P '  y '  0 .x  1 .y  0 .z  b. 1
 z'  0 .x  0 .y  1 .z  c. 1

1  0 .x  0 .y  0 .z  1 .1

The corresponding matrix equation would be,


 x '  1 0 0 a x 
     
 y'   0 1 0 b y
 z'    0 0 1 a z 
     
 1  0 0 0 1  1 
    
Let us translate the point P(1, 0, 3) by the translation vector 1 î + 2 ĵ + 3 k̂ . The required
translated point P’(x’, y’, z’) will be P’(2, 2, 6) as obtained below.
 x'  1 0 0 1  1  1 .1  0 .0  0 .3  1 .1   2 
         
 y'   0 1 0 2  0   0 .1  1 . 0  0 . 3  2 . 1   2 
 z'    0 0 1 3  3    0 . 1  0 . 0  1 .3  3 . 1    6 
         
 1  0 0 0 1   1   0 .1  0 . 0  0 .3  1 . 1   1 
        

5.3.1.2 Scaling
A 3-D object may be enlarged or shrunk by a constant proportion to change its actual dimension.
This process is known as scaling. If the scale factor is more than one, the scaling is called
magnification and if less than one it is reduction (see figure 5.36).

Figure 5.36: Scaling Transformation


We will obtain the transformation matrix with respect to the origin assuming that the origin remains
fixed. Let the scaling factors along the x, y and z axes be S x, Sy and Sz respectively.
 x'  S x . x

P '  y '  S y . y
 z'  S . z
 x
Changing into homogeneous form:
x '  S x .x  0 .y  0 .z

P '  y'  0 .x  S y .y  0 .z
z'  0 .x  0 .y  S .z
 x
 x'   Sx 0 0  x 
    
 y'    0 S y 0  y 
 z'   0 0 S  z 
   z  

5.3.1.3 Rotation
Rotations in which one of the positive x, y or z coordinate axes is taken to be the axis of rotation are
called canonical rotations. In such cases the construction of the rotation transformation proceeds just
like that of a rotation in two dimensions about the origin (see figure 5.37).

y
Figure 5.37: Rotation Transformation

Rotation about the z-axis


 x'  x cos  y sin 

R . K :  y'  x sin   y cos
 z'  z

or
 cos   sin  0 
 
R  , K   sin  cos  0 
 0 0 1 

Rotation about the y-axis


x'  x cos  z sin 

R . J :  y'  y
 z'  y sin   z cos

or
 cos  0 sin  
 
R , J  0 1 0 
  sin  0 cos  
 

Rotation about the x-axis


 x'  x

R . I :  y'  y cos   z sin 
 z'  y sin   z cos

or
 1 0 0 
 
R , I   0 cos   sin  
 0 sin  cos  
 
In all these transformations, the direction of a positive angle of rotation is chosen in accordance to the
right-hand rule with respect to the axis of rotation. These canonical rotations can be used to effect any
arbitrary rotation.

Qns-

Consider a rectangular parallelepiped, which is unit distance on z-axis, 2-distance on x-axis and 3-
distance on y-axis (figure 5.41). What is the effect of scaling when scaling factor S x = ½, Sy = 1/3 and
Sz = 1?

H G
D C

x
E F
A B

Figure 5.41
0 0 1 1 A
 
2 0 1 1 B
2 3 1 1 C
 
0 3 1 1 D
X 
0 0 0 1 E
 
2 0 0 1 F
2 3 0 1 G
 
0 3 0 1  H
The vertices of the parallelepiped are A(0, 0, 1), B(2, 0, 1), C(2, 3, 1), D(0, 3, 1), E(0, 0, 0), F(2, 0,
0), G(2, 3, 0) and H(0, 3, 0). The same can be represented in homogeneous matrix from as:
The required transformation matrix for scaling is
1 / 2 0 0 0
 
0 1/3 0 0
[T ]  
 0 0 1 0
 
 0 0 0 1
Applying this transformation on the given set of points (i.e. [X]) we get the new transformed point
(i.e. [X*])
[X*] = [X] [T]
0 0 1 1 0 0 1 1 A *
   
2 0 1 1 1 0 1 1 B *
2 3 1 1  1 / 2 0 0 0  1 1 1 1 C *
    
0 3 1 1  0 1/3 0 0  0 1 1 1 D *
X 
0 0 0 1  0 0 1 0  0 0 0 1 E *
    
2 0 0 1  0 0 0 1  1 0 0 1 F *
2 3 0 1 1 1 0 1 G *
   
0 3 0 1  0 1 0 1  H *

The new transformed coordinates show that the transformed object is a unit cube as shown in figure
5.42.

H*
G*
D* C*

E* F*
A* B*

You might also like