Unit 3
Unit 3
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
= [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
Following figure show the original position of object and position of object after rotation
about the x-axis
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
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
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:
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.