0% found this document useful (0 votes)
9 views32 pages

Unit 3

This document covers three-dimensional transformations essential for generating images of 3D objects, including translation, scaling, rotation, reflection, shearing, and projection techniques. It explains the mathematical representation of these transformations and their applications, such as perspective and parallel projections, along with the concept of clipping in 3D space. The document also discusses anomalies that can occur during perspective projection and provides methods for handling 3D clipping using region codes.

Uploaded by

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

Unit 3

This document covers three-dimensional transformations essential for generating images of 3D objects, including translation, scaling, rotation, reflection, shearing, and projection techniques. It explains the mathematical representation of these transformations and their applications, such as perspective and parallel projections, along with the concept of clipping in 3D space. The document also discusses anomalies that can occur during perspective projection and provides methods for handling 3D clipping using region codes.

Uploaded by

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

UNIT- III

Three Dimensional Transformations


The geometric transformations play a vital role in generating images of three Dimensional
objects with the help of these transformations. The location of objects relative to others can
be easily expressed. Sometimes viewpoint changes rapidly, or sometimes objects move in
relation to each other. For this number of transformation can be carried out repeatedly.

Translation
It is the movement of an object from one position to another position. Translation is done
using translation vectors. There are three vectors in 3D instead of two. These vectors are in x,
y, and z directions. Translation in the x-direction is represented using Tx. The translation is y-
direction is represented using Ty. The translation in the z- direction is represented using Tz.
If P is a point having co-ordinates in three directions (x, y, z) is translated, then after
translation its coordinates will be (x1 y1 z1) after translation. Tx Ty Tz are translation vectors in
x, y, and z directions respectively.
x1=x+ Tx
y1=y+Ty
z1=z+ Tz
Three-dimensional transformations are performed by transforming each vertex of the object.
If an object has five corners, then the translation will be accomplished by translating all five
points to new locations. Following figure 1 shows the translation of point figure 2 shows the
translation of the cube.
Matrix for translation

Matrix representation of point translation


Point shown in fig is (x, y, z). It become (x1,y1,z1) after translation. Tx Ty Tz are translation
vector.
Example: A point has coordinates in the x, y, z direction i.e., (5, 6, 7). The translation is done
in the x-direction by 3 coordinate and y direction. Three coordinates and in the z- direction by
two coordinates. Shift the object. Find coordinates of the new position.
Solution: Co-ordinate of the point are (5, 6, 7)
Translation vector in x direction = 3
Translation vector in y direction = 3
Translation vector in z direction = 2
Translation matrix is

Multiply co-ordinates of point with translation matrix

= [5+0+0+30+6+0+30+0+7+20+0+0+1] = [8991]
x becomes x1=8
y becomes y1=9
z becomes z1=9

Scaling
Scaling is used to change the size of an object. The size can be increased or decreased. The
scaling three factors are required Sx Sy and Sz.
Sx=Scaling factor in x- direction
Sy=Scaling factor in y-direction
Sz=Scaling factor in z-direction

Matrix for Scaling

Scaling of the object relative to a fixed point


Following are steps performed when scaling of objects with fixed point (a, b, c). It can be
represented as below:
1. Translate fixed point to the origin
2. Scale the object relative to the origin
3. Translate object back to its original position.
Note: If all scaling factors Sx=Sy=Sz.Then scaling is called as uniform. If scaling is done with
different scaling vectors, it is called a differential scaling.
In figure (a) point (a, b, c) is shown, and object whose scaling is to done also shown in steps
in fig (b), fig (c) and fig (d).
Rotation
It is moving of an object about an angle. Movement can be anticlockwise or clockwise. 3D
rotation is complex as compared to the 2D rotation. For 2D we describe the angle of rotation,
but for a 3D angle of rotation and axis of rotation are required. The axis can be either x or y
or z.
Following figures shows rotation about x, y, z- axis
Following figure show rotation of the object about the Y axis
Following figure show rotation of the object about the Z axis

Rotation about Arbitrary Axis


When the object is rotated about an axis that is not parallel to any one of co-ordinate axis, i.e.,
x, y, z. Then additional transformations are required. First of all, alignment is needed, and
then the object is being back to the original position. Following steps are required
1. Translate the object to the origin
2. Rotate object so that axis of object coincide with any of coordinate axis.
3. Perform rotation about co-ordinate axis with whom coinciding is done.
4. Apply inverse rotation to bring rotation back to the original position.

Matrix for representing three-dimensional rotations about the Z axis

Matrix for representing three-dimensional rotations about the X axis


Matrix for representing three-dimensional rotations about the Y axis

Following figure show the original position of object and position of object after rotation
about the x-axis

5. Apply inverse translation to bring rotation axis to the original position.


For such transformations, composite transformations are required. All the above steps are
applied on points P' and P".Each step is explained using a separate figure.
Step1: Initial position of P' and P"is shown
Step2: Translate object P' to origin

Step3: Rotate P" to z axis so that it aligns along the z-axis


Step 4: Rotate about around z- axis

Step 5: Rotate axis to the original position


Step 6: Translate axis to the original position.

Inverse Transformations
These are also called as opposite transformations. If T is a translation matrix than inverse
translation is representing using T-1. The inverse matrix is achieved using the opposite sign.
Example1: Translation and its inverse matrix
Translation matrix
Inverse translation matrix
Backward Skip 10sPlay VideoForward Skip 10s

Example2: Rotation and its inverse matrix

Inverse Rotation Matrix

Reflection
It is also called a mirror image of an object. For this reflection axis and reflection of plane is
selected. Three-dimensional reflections are similar to two dimensions. Reflection is 180°
about the given axis. For reflection, plane is selected (xy,xz or yz). Following matrices show
reflection respect to all these three planes.
Reflection relative to XY plane

Reflection relative to YZ plane


Reflection relative to ZX plane

Shearing
It is change in the shape of the object. It is also called as deformation. Change can be in the x
-direction or y -direction or both directions in case of 2D. If shear occurs in both directions,
the object will be distorted. But in 3D shear can occur in three directions.
Matrix for shear
Projection
It is the process of converting a 3D object into a 2D object. It is also defined as mapping or
transformation of the object in projection plane or view plane. The view plane is displayed
surface.
Perspective Projection
In perspective projection farther away object from the viewer, small it appears. This property
of projection gives an idea about depth. The artist use perspective projection from drawing
three-dimensional scenes.
Two main characteristics of perspective are vanishing points and perspective foreshortening.
Due to foreshortening object and lengths appear smaller from the center of projection. More
we increase the distance from the center of projection, smaller will be the object appear.
Vanishing Point
It is the point where all lines will appear to meet. There can be one point, two point, and three
point perspectives.
One Point: There is only one vanishing point as shown in fig (a)
Two Points: There are two vanishing points. One is the x-direction and other in the y -
direction as shown in fig (b)
Three Points: There are three vanishing points. One is x second in y and third in two
directions.
In Perspective projection lines of projection do not remain parallel. The lines converge at a
single point called a center of projection. The projected image on the screen is obtained by
points of intersection of converging lines with the plane of the screen. The image on the
screen is seen as of viewer's eye were located at the centre of projection, lines of projection
would correspond to path travel by light beam originating from object.
Important terms related to perspective
1. View plane: It is an area of world coordinate system which is projected into viewing
plane.
2. Center of Projection: It is the location of the eye on which projected light rays
converge.
3. Projectors: It is also called a projection vector. These are rays start from the object
scene and are used to create an image of the object on viewing or view plane.

Parallel Projection
Parallel Projection use to display picture in its true shape and size. When projectors are
perpendicular to view plane then is called orthographic projection. The parallel projection
is formed by extending parallel lines from each vertex on the object until they intersect the
plane of the screen. The point of intersection is the projection of vertex.
Parallel projections are used by architects and engineers for creating working drawing of the
object, for complete representations require two or more views of an object using different
planes.

1. Isometric Projection: All projectors make equal angles generally angle is of 30°.
2. Dimetric: In these two projectors have equal angles. With respect to two principle
axis.
3. Trimetric: The direction of projection makes unequal angle with their principle axis.
4. Cavalier: All lines perpendicular to the projection plane are projected with no change
in length.
5. Cabinet: All lines perpendicular to the projection plane are projected to one half of
their length. These give a realistic appearance of object.
Anomalies in Perspective Projection
It introduces several anomalies due to these object shape and appearance gets affected.
1. Perspective foreshortening: The size of the object will be small of its distance from
the center of projection increases.
2. Vanishing Point: All lines appear to meet at some point in the view plane.
3. Distortion of Lines: A range lies in front of the viewer to back of viewer is appearing
to six rollers.
Foreshortening of the z-axis in fig (a) produces one vanishing point, P1. Foreshortening the x
and z-axis results in two vanishing points in fig (b). Adding a y-axis foreshortening in fig (c)
adds vanishing point along the negative y-axis.

3D Clipping
• Discarding objects that cannot possibly be seen involves comparing an objects
bounding box/sphere against the dimensions of the view volume
– Can be done before or after projection
• Objects that are partially within the viewing volume need to be clipped – just like the
2D case
3D Cohen-Sutherland Line Clipping

• Similar to the case in two dimensions, we divide the world into regions
• This time we use a 6-bit region code to give us 27 different region codes
• The bits in these regions codes are as follows:

bit 1 bit 2 bit 3 bit 4 bit 5 bit 6


Above Below Right Left Behind Front
Now we use a 6 bit out code to handle the near and far plane.
The testing strategy is virtually identical to the 2D case.
CASE – I Assigning region codes to endpoints for Canonical Parallel View Volume defined
by:
x = 0 , x = 1; y = 0, y = 1; z = 0, z = 1

The bit codes can be set to true(1) or false(0) for depending on the test for these
equations as follows:
Bit 1 ≡ endpoint is Above view volume = sign (y-1)
Bit 2 ≡ endpoint is Below view volume = sign (-y)
Bit 3 ≡ endpoint is Right view volume = sign (x-1)
Bit 4 ≡ endpoint is Left view volume = sign (-x)
Bit 5 ≡ endpoint is Behind view volume = sign (z-1)
Bit 6 ≡ endpoint is Front view volume = sign (-z)
CASE – II Assigning region codes to endpoints for Canonical Perspective View Volume
defined by:
x = -z , x = z; y = -z, y = z; z = zf , z = 1
The bit codes can be set to true(1) or false(0) for depending on the test for these
equations as follows:
Bit 1 ≡ endpoint is Above view volume = sign (y-z)
Bit 2 ≡ endpoint is Below view volume = sign (-z-y)
Bit 3 ≡ endpoint is Right view volume = sign (x-z)
Bit 4 ≡ endpoint is Left view volume = sign (-z-x)
Bit 5 ≡ endpoint is Behind view volume = sign (z-1)
Bit 6 ≡ endpoint is Front view volume = sign (zf-z)
• To clip lines we first label all end points with the appropriate region codes.
• Classify the category of the Line segment as follows
– Visible: if both end points are 000000
– Invisible: if the bitwise logical AND is not 000000
– Clipping Candidate: if the bitwise logical AND is 000000
• We can trivially accept all lines with both end-points in the [000000] region.
• We can trivially reject all lines whose end points share a common bit in any position.

You might also like