Sie sind auf Seite 1von 47

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/260137371

Computer Graphics

Book · January 2010


DOI: 10.13140/2.1.1880.9920

CITATIONS READS
0 6,109

2 authors:

Pk Singh Rajendra Kumar


Madan Mohan Malaviya University of Technology, Gorakhpur (U.P.) India Vidya College of Engineering
19 PUBLICATIONS   57 CITATIONS    27 PUBLICATIONS   68 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Enhancing Latent fingerprint identification score through SIFT View project

All content following this page was uploaded by Rajendra Kumar on 12 February 2014.

The user has requested enhancement of the downloaded file.


Unit 5
Three Dimensional Graphics-I

5.1 Introduction
5.2 Three dimensional concepts
5.2.1 Three Dimensional Geometry
5.2.2 Three-Dimensional Display Methods
5.2.3 Three dimensional representation through plane equations
5.2.4 Polygon Meshes
5.2.5 Sweep Representations
5.2.6 Constructive Solid Geometry Methods
5.2.7 Quadric Surfaces
5.2.8 The Sphere
5.2.9 The Ellipsoid
5.2.10 The Torus
5.2.11 The Super Quadrics
5.2.12 The Super-ellipse
5.2.13 The Super-ellipsoid
5.2.14 The Blobby Objects
5.3 Three dimensional Representation
5.3 Bezier Curves and Surfaces
5.4 Three Dimensional Transformations
5.5 Three Dimensional Viewing
5.6 Projections
5.6.1 The Parallel Projection
5.6.2 The Isometric Projection
5.6.3 Oblique Projection
5.6.4 The Perspective Projection
5.7 Solved Examples
5.8 Summary
5.9 Key Terms
5.10 Answers to Check Your Progress
5.11 Questions and Exercises
5.12 Long-Answer Questions
5.13 Further Readings
UNIT OBJECTIVES
• Understanding three dimensional geometry
• Understanding plane equations, Polygon Meshes, Sweep Representations, Constructive Solid Geometry
Methods,
• Discussing Quadric Surfaces, Sphere, Ellipsoid, Torus, Super Quadrics, Super-ellipse, Super-ellipsoid, Blobby
Objects
• Discussing three dimensional transformations with illustrations
• Understanding the operation of composite transformations
• Discussing the types of projection (Parallel Projection, Oblique Projection, Perspective Projection)
5.1 INTRODUCTION
Using two-dimension techniques, we can show only some of the graphics applications such as Bar charts, Pie charts,
Graph but most of the natural objects can be shown only by three-dimensions. This 3D graphics allows us to check

Chapter 5 Three dimensional Graphics-I Page 1 of 46


the structure in different directions. When we discuss two-dimensional rotations in the xy-plane, we need to consider
only rotations about axes that were perpendicular to the xy-plane. We can select any spatial orientation in three
dimensions space, as a composite of three rotations, one for each of the three Cartesian axes. On the other hands, a
user can easily set up a general rotation matrix, given the orientation of the axis and the required rotation angle.
Three dimensional projection can be defined as any method of mapping three dimensional (3D) points to a two
dimensional (2D) plane. The most current methods for displaying graphical data are based on planar two-dimensional
media, therefore the use of this type of projection is widespread, especially in engineering design, computer graphics
and drafting. There are basically two methods of projection- one method shows the object as it appears, called as
Perspective Projections and another method is showing the object to its true size and shape called parallel projection.
5.2 THREE DIMENSIONAL CONCEPTS
5.2.1 Three Dimensional Geometry
The three dimensional system has three axes x, y and z axis. The orientation of co-ordinate system is determined by
two systems. In the right handed system the thumb of the right hand points in the positive z direction as one curls the
fingers of the right hand from x into y, and in the left handed system the thumb points in the negative z direction. In
our description we have used right-handed system. The figure 5.1 (a) and 5.1(b) show right-handed system and left-
handed system.
Y
-1

1
Z
Fig 5.1 (a) Right-Handed System
Y
1

-1
Z
Fig 5.1 (b) Left- Handed System
As in the case of two dimensional system, both Y and Z-coordinates change proportionately to X. it is given as:
( y − y1 ) /( x − x1 ) = ( y 2 − y1 ) /( x2 − x1 )
( z − z1 ) /( x − x1 ) = ( z 2 − z1 ) /( x2 − x1 )
where ( x1 , y1 , z1 ) and ( x2 , y 2 , z 2 ) are the two points. So we can represent the parametric form of a line as
x = (x2 - x1) u + x1
y = (y2 - y1) u + y1

Chapter 5 Three dimensional Graphics-I Page 2 of 46


z = (z2- z1) u + z1
The equation of the plane is given by :
Ax + By + Cz + D = 0
We can show that the constants may be divided out of the equation so that
A1x + y + C1z + D1 =0
where A1 = A/B
C1 = C/ B
D1 = D/B
The coordinates of the three points are ( x1 , y1 , z1 ) , ( x2 , y 2 , z 2 ) and ( x3 , y3 , z 3 ) . Then the equations of planes are
A1x1 + y1 + C1z1 + D1 = 0
A1x2 + y2 + C1z2 + D1 = 0
A1x3 + y3 + C1z3 + D1 = 0
If we solve above three equations then we get normalization as
A2 = A/D
B2 = B / D
C2 = C / D
D2 = D/ d
where d = ( A2 + B2 + C 2 )
The distance between a point (x, y, z) and the plane is given by
L = | A2x + B2y + C2z + D2 |
The sign of this indicates whether a point lies on the front or back of a plane.
5.2.2 Three-Dimensional Display Methods
For the representation of a three-dimensional scene, the world coordinates are used. In this regards the first step is to
set up the coordinate reference for the camera from which the scene will be captured. With the help of this coordinate
reference we can define the position and orientation of the plane at the camera. The object descriptions can be
transferred to the coordinates of camera reference and can be projected in to the specified plane. After this the objects
can be transferred into the wire frame model. The figure below shows how the lightening and surface rendering
techniques can be applied to the shaded visible surface.

Display plane

Fig. 5.2 Reference of coordinates to obtain a particular view of a three dimensional scene
The figure below shows the wire frame model of the object in the previous figure.

Fig. 5.3 The wire frame view of a three dimensional scene

Chapter 5 Three dimensional Graphics-I Page 3 of 46


5.2.3 Three dimensional representation through plane equations
To produce a display of a three-dimensional object, we must process the input data representation for the object
through several procedures. These processing steps include transformation of the modeling and world-coordinate
descriptions to viewing coordinates, then to device coordinates on the plane; identification of visible surfaces of the
object; and the application of surface-rendering methods. For some of these processes, we need information about the
spatial orientation of the individual surface components or the object. This information is obtained from the vertex
coordinate values and equations that describe the polygon planes. The equation for a plane surface can be expressed in
the form
Ax + By + Cz + D = 0 5.1
such that (x, y, z) is any point in the three dimensional plane, and the coefficients A to D are constants described in
spatial properties of the plane. The values of A, B, C, and D can be obtained by solving a set of three plane equations
using the coordinate values for three non-collinear points in the plane. For this purpose, three successive polygon
vertices (x1, y1, z1), (x2, y2, z2), and (x3, y3, z3) can be selected, and the following set of simultaneous linear plane
equations for the ratios A/D, B/D, and C/D can be solved:
(A/D)xi + (B/D)yi + (C/D)zi = -1, for i = 1, 2, 3 5.2
The solution for this set of equations can be obtained in determinant form, using Cramer’s rule, as:
1 y1 z1   x1 1 z1 
A = 1 y 2 z 2  , B =  x 2 1 z 2  ,
1 y 3 z 3   x3 1 z 3 
5.3
 x1 y1 1  x1 y1 z1 
C =  x 2 y 2 1 , and D =  x 2
 y2 z 2  ,
 x3 y 3 1  x3 y3 z 3 
Expanding the determinants, we can write the calculations for the plane coefficients in the form:
A = y1 ( z 2 − z 3 ) + y 2 ( z 2 − z1 ) + y 3 ( z1 − z 2 )
B = z1 ( x 2 − x3 ) + z 2 ( x 2 − x1 ) + z 3 ( x1 − x 2 )
5.4
C = x1 ( y 2 − y 3 ) + x 2 ( y 2 − y1 ) + x3 ( y1 − y 2 )
D = − x1 ( y 2 z 3 − y 3 z 2 ) − x 2 ( y 3 z1 − y1 z 3 ) − x3 ( y1 z 2 − y 2 z1 )
The values for A, B, C, and D are calculated for each polygon and stored with the other polygon data as vertex values
and other information are entered into the polygon data structure,. Orientation of a plane surface in space can be
described with the normal vector to the plane, as shown in figure 5.4.
Y
N = (A, B, C)

Z
Fig. 5.4 The vector N normal to the surface of plane represented by
Ax + By + Cz + D = 0 having Cartesian components A, B, and C

Chapter 5 Three dimensional Graphics-I Page 4 of 46


This surface normal vector has Cartesian components (A, B, C), where parameters A, B, and C are the plane
coefficient calculated in equation 5.4. Now, we need to distinguish between the two sides of the surface. The side of
the plane that faces the object interior is called the “inside face”, and the visible or outward side is the “outside face”.
If polygon vertices are specified in a counterclockwise direction, then viewing the outer side of the plane in a right-
handed coordinate system, the direction of the normal vector will be from inside to outside. This is demonstrated for
one plane of a unit cube in figure 5.5.
To determine the components of the normal vector for the shaded surface shown in Figure 5.5, we select three of the
four vertices along the boundary of the polygon. These points are selected in a counterclockwise direction as we view
from outside the cube toward the origin. Coordinates for these vertices, in the order selected, can be used in equation
5.4 to obtain the plane coefficients: A = 1, B = C = 0, D = -1. Thus, the normal vector for this plane is in the direction
of the positive x-axis.
The elements of the plane normal can also be obtained using a vector cross product calculation. We again select three
vertex positions, V1, V2, and V3, taken in counterclockwise order when viewing the surface from outside to inside in a
right-handed Cartesian system. Forming two vectors, one from V1 to V2 and the other from V1 to V3, we calculate N as
the vector cross product:
N = (V2 − V1 ) × (V3 − V1 ) 5.5
Y

1 X
1

Z
Fig. 5.5 The shaded polygon surface of unit cube with plane equation x - 1 = 0 and normal vector N = (1, 0, 0)
This generates values for the plane parameters A, B, and C. We can then obtain the value for parameter D by
substituting these values and the coordinates for one of the polygon vertices in plane equation 5.1 and solving for
parameter D. The plane equation can be expressed in vector form using the normal N and the position P of any point
in the plane as
N .P = − D 5.6
Plane equations are used also to identify the position of spatial points relative to the plane surfaces of an object. For
any point ( x, y , z ) not on a plane with parameters A, B, C, D, we have
Ax + By + Cz + D ≠ 0
We can identify the point as either inside or outside the plane surface according to the sign (negative or positive) of
Ax + By + Cz + D :
if Ax + By + Cz + D < 0, the point ( x, y , z ) is inside the surface
if Ax + By + Cz + D > 0, the point ( x, y , z ) is outside the surface.
These equality tests are valid in a right-handed Cartesian system, provided the plane parameters A, B, C, and D were
calculated using vertices selected in a counterclockwise order when viewing the surface in an outside-to-inside
direction. For example, in figure 5.5 any point outside the shaded plane satisfies the inequality x - 1 > 0, while any
point inside the plane has an x-coordinate value less than 1.
5.2.4 Polygon Meshes

Chapter 5 Three dimensional Graphics-I Page 5 of 46


Some graphics packages provide several polygon functions for modeling objects. A single plane surface can be
specified with a function such as fillArea. But when object surfaces are to be tiled, it is more convenient to
specify the surface facets with a mesh function. One type of polygon mesh is the triangle strip. This function produces
n - 2 connected triangles, as shown in figure 5.6, given the coordinates for n vertices. Another similar function is the
quadrilateral mesh, which generates a mesh of (n - 1) × (m - 1) quadrilaterals, given the coordinates for an n × m array
of vertices.

Fig. 5.6 A triangle strip formed with 13 vertices to form different 11 triangles.
The figure 5.7 shows 20 vertices forming a mesh of 12 quadrilaterals.

Fig. 5.7 A structure with 20 vertices forming a mesh of 12 quadrilaterals


When polygons are specified with more than three vertices, it is possible that the vertices may not all Lie in one plane.
This can be due to numerical errors or errors in selecting coordinate positions for the vertices. One way to handle this
situation is simply to divide the polygons into triangles. Another approach that is some times taken is to approximate
the plane parameters A, B, and C. We can do this with averaging methods or we can project the polygon onto the
coordinate planes. Using the projection method, we take A proportional to the area of the polygon projection on the
yz-plane, B proportional to the projection area on the xz-plane, and C proportional to the projection area on the xy-
plane. High quality graphics systems typically model objects with polygon meshes and set up a database of geometric
and attribute information to facilitate processing of the polygon facets. Fast hardware-implemented polygon renderers
are incorporated into such systems with the capability for displaying hundreds of thousands to one million or more
shaded polygons per second (usually triangles), including the application of surface texture and special lighting
effects.
5.2.5 Sweep Representations
The sweep representation of an object refers to the three dimensional representation through linear, circular or some
other representation. As we see in following figure (figure 5.8) a rectangular shape is rotated along the given vertical
line. The shape after rotation is also represented by the diagram.

Chapter 5 Three dimensional Graphics-I Page 6 of 46


Fig. 5.8 Sweep representation
5.2.6 Constructive Solid Geometry Methods
The Constructive Solid Geometry Methods refers to the shapes created by union, intersection and difference of given
shapes. The following diagram has two input shapes A (a cube) and B (a cylinder). The A-B refers to the elimination
of a part from shape ‘A’ equal to the volume of shape B. Similarly the intercession (the common volume) A∩B is also
shown in figure 5.9.

Fig. 5.9 Solid geometry construction representation


5.2.7 Quadric Surfaces
Most commonly used class of objects is the quadric surfaces that are described with second-degree equations (called
quadratics). They include spheres, ellipsoids, paraboloids, hyperboloids, etc. Quadric surfaces (particularly spheres
and ellipsoids), are common elements of graphics scenes, and they are often used in graphics packages as primitives
components by which more complex objects can be constructed. The following figure shows the parametric
coordinate position (r, θ, ϕ) on the surface of a sphere with radius r.

P (x, y, z)

ϕ X

θ
Z

Fig. 5.10 Parametric coordinate position (r, θ, ϕ) on the surface of a sphere with radius r
The following figure shows the spherical coordinate parameters (r, θ, ϕ) using colatitudes for angle ϕ.

Chapter 5 Three dimensional Graphics-I Page 7 of 46


Y

P (x, y, z)

Z
Fig. 5.11 Spherical coordinate parameters (r, θ, ϕ) using colatitudes for angle ϕ
5.2.8 The Sphere
A spherical surface with radius r centered on the coordinate origin is defined as the set of points (x, y, z) is in
Cartesian coordinates that satisfy the equation
x2 + y2 + z2 = r 2 5.7
We can also describe the spherical surface in parametric form, using latitude and longitude angles (as shown in figure
5.10):
x = r cos ϕ cos θ , where, − π / 2 ≤ ϕ ≤ π / 2
y = r cos ϕ sin θ , where, − π ≤ θ ≤ π 5.8
z = r sin ϕ
The parametric representation in Equation 5.8 provides a symmetric range for the angular parameters θ and ϕ.
Alternatively, we could write the parametric equation using standard spherical coordinates, where angle ϕ is specified
as the co latitude (Figure 5.11). Then, ϕ is defined over the range 0 ≤ ϕ ≤ π, and θ is often is often taken in the range
0 ≤ θ ≤ 2π. A set up can also be represented by using parameters u and v, defined over the range from 0 to 1 by
substituting ϕ = πu and θ = 2πv.
5.2.9 The Ellipsoid
The surface of an ellipsoid can be described as an extension of a spherical surface, where the radii in three mutually
perpendicular directions can have different values (see figure 5.12). The Cartesian representation of points over the
surface of an ellipsoid centered on the origin is expressed as
2 2 2
x   y  z
  +   +  =1
 r 
5.9

 rx   ry   z
Y

ry

rx X
rz

Z
Fig. 5.12 An ellipsoid with radii rx, ry and rz whose centre is (0, 0, 0)

Chapter 5 Three dimensional Graphics-I Page 8 of 46


And a parametric representation for the ellipsoid in terms of the latitude angle ϕ is figure 5.12 and the longitude angle
θ in figure 5.10 is
x = rx cos ϕ cos θ , where,−π / 2 ≤ ϕ ≤ π / 2
y = ry cos ϕ sin θ , where,−π ≤ ϕ ≤ π 5.10
z = rz sin ϕ
5.2.10 The Torus
A torus can be defined as doughnut-shaped object, as shown in figure 5.13. By rotating a circle or other conic about a
specified axis, a torus can be generated. We can write the Cartesian representation for points over the surface of a
torus in the form
2
 2 2  2
 x   y   z
r −   +   +   = 1 5.11
 r    rz 
 rx   y 
 
where r is any given offset value. Parametric representations for a torus are similar to those for an ellipse, except that
angle ϕ extends over 360°. Using latitude and longitude angles ϕ and θ, we can describe the toms surface as the set of
points that satisfy
x = rx (r + cos ϕ ) cos θ , where, − π ≤ ϕ ≤ π
y = ry (r + cos ϕ ) sin θ , where, − π ≤ θ ≤ π 5.12
z = rz sin ϕ

rz
P (x, y, z)
ϕ

rx = ry

P (x, y, z)

Fig. 5.13 A torus with a circular cross section centered on the coordinate origin.
5.2.11 The Super Quadrics
Super-quadrics is the class of objects as generalization of the quadric representations. Super-quadrics can be formed
by incorporating additional parameters into quadric equations to provide additional flexibility for adjusting object
shapes. The dimension of the object is equal to the number of additional parameters used: two parameters for surfaces
and one parameter for curves.

Chapter 5 Three dimensional Graphics-I Page 9 of 46


5.2.12 The Super-ellipse
We obtain a Cartesian representation for a super-ellipse from the corresponding equation for an ellipse by allowing
the exponent on the x and y terms to be variable. One way to do this is to write the Cartesian super-ellipse equation is,
the form
2/s 2/s
x   y 
  +  =1 5.13
r 
 rx   y 
where parameter s can be assigned any real value. When s = 1, we get an ordinary ellipse. Corresponding parametric
equations for the super-ellipse of equation 5.13 can be expressed as
x = rx cos s θ , where, −π ≤θ ≤ π
s
y = ry sin θ , 5.14
The figure 5.14 illustrates super-circle shapes that can be generated using various values for parameters.

0.5 1.0 2.0 2.0 3.0


Fig. 5.14 Super-ellipses plotted with different values for parameter s and with rx = ry
5.2.13 The Super-ellipsoid
A Cartesian representation for a super-ellipsoid is obtained from the equation for an ellipsoid by incorporating two
exponent parameters:
s 2 / s1
 x 
2 / s2
 y 
2 / s2
 z 
2 / s1

  +   +   =1 5.15
 rx 
r
 y

   rz 
 
For s1= 1, and s2 = 1, we get an ordinary ellipsoid. We can then write the corresponding parametric representation for
the super-ellipsoid of equation 5.15 as
π π
x = rx cos s1 ϕ cos s2 θ , where, − ≤ϕ ≤
2 2
s1 s2
y = ry cos ϕ sin θ , where, −π ≤θ ≤ π 5.16
s1
z = rz sin ϕ
5.2.14 The Blobby Objects
Some objects do not maintain a fixed shape, but change their surface characteristics in certain motions or when in
proximity to other objects. Examples in this class of objects include molecular structures, water droplets and other
liquid effects, melting objects, and muscle shapes in the human body. These objects can be described as exhibiting
“blobbiness” and are often simply referred to as blobby objects, since their shapes show a certain degree of fluidity. A
molecular shape, for example, can be described as spherical in isolation, but this shape changes when the molecule
approaches another molecule. This distortion of the shape of the electron density cloud is due to the “bonding” that
occurs between the two molecules. The figure 5.16 illustrates the stretching, snapping, and contracting effects on
molecular shapes when two molecules move apart. These characteristics cannot be adequately described simply with
spherical or elliptical shapes. Similarly, figure 5.17 shows muscle shapes in a human am, which exhibit similar
characteristics. In this case, we want to model surface shapes so that the total volume remains constant. Several
models have been developed for representing blobby objects as distribution functions over a region of space. One
method to perform this is to construct model objects as combinations of Gaussian density functions, or “bumps” (see
figure 5.18). A surface function can then be defined as

Chapter 5 Three dimensional Graphics-I Page 10 of 46


f ( x, y, z ) = ∑ bk e − ak
−1
−T = 0 5.17
k

2 2 2 2
where rk = x k + y k + z k parameter T is some specified threshold, and parameters a and b are used to adjust
the quantity of blobbiness of the individual object.. Negative values for ‘b’ can be used to produce spots instead of
bumps. Figure 5.19 illustrates the surface structure of a composite object modeled with four Gaussian density
functions. At the threshold level, numerical root-finding techniques are used to locate the coordinate intersection
values. The cross sections of the individual objects are then modeled as circles or ellipses. If two cross sections are
near to each other, they are merged to form one blobby shape, as in figure 5.16, whose structure depends on the
separation of the two objects.

Fig. 5.15 Molecular bonding, by moving molecules away from each other, the surface shapes stretch, snap

Fig. 5.16 Molecular bonding finally contract into spheres

Fig. 5.17 Blobby muscle shapes in a human arm


Other method for generating blobby objects is to use density functions which fall off to 0 in a finite interval, instead of
exponentially. The “metaball” model describes composite objects as combinations of quadratic density functions of
the form

Chapter 5 Three dimensional Graphics-I Page 11 of 46


  3r 2  d
b1 − 2 , if 0<r≤
  d  3
 3  r
2
d
f (r ) =  b1 −  , if <r≤d 5.18
2  d  3
 0, if r > d


And the “soft object” model uses the function
 22r 2 17r 4 4r 6

f (r ) = 1 − 9d 2 + 9d 4 − 9d 4 , if 0 < r ≤ d 5.19
 0, if r>d
Some design and painting packages now provide blobby function modeling for handling applications that cannot be
adequately modeled with polygon or spline functions alone.
b

-a 0 a

Fig. 5.18 A three-dimensional Gaussian bump centered at origin, having height band standard deviation a

Fig. 5.19 The composite blobby object constructed with five Gaussian bumps

5.3 BEZIER CURVES AND SURFACES


Bezier curve is the spline approximation method that was developed by the French engineer Pierre Bezier for use in
the design of automobile bodies. Bezier spline has a number of properties that make them highly useful and
convenient for surface and curve design. Bezier curves and surfaces are easy to implement. For these reasons, Bezier
splines are widely available in various graphics packages like Computer Aided Design (CAD) systems, and in
assorted drawing and painting softwares.
Practically, a section of a Bezier curve can be fitted to any number of control points. The number of control points to
be approximated and their relative position determines the degree of the Bezier polynomial. Similar with the
interpolation splines, a Bezier curve can be specified with boundary conditions, with blending functions, or with a
characterizing matrix. In case of general Bezier curves, the blending-function specification is the most convenient
function. Suppose we are given n + 1 control-point positions: pk = (xk, yk, zk), with k varying from 0 to n. These
coordinate points can be blended to produce the following position vector P(u), which describes the path of an
approximating Bezier polynomial function between P0 and Pn.
n
P(u ) = ∑ Pk .BEZ k ,n (u ), 0 ≤ u ≤1 5.25
k =0
The Bezier blending functions BEZk, n(u) are the Bernstein polynomials defined as:

Chapter 5 Three dimensional Graphics-I Page 12 of 46


BEZ k ,n (u ) = C (n, k )u k (1 − u ) n −k 5.26

where the C(n, k) are the binomial coefficients defined as:


n!
C (n.k ) = 5.27
k!(n − k )!
Equivalently, we can define Bezier blending functions with the recursive calculation
BEZ k ,n (u ) = (1 − u ) BEZ k ,n −1 (u ) + uBEZ k −1,n −1 (u ), n > k ≥ 1 5.28
with BEZk, k = uk, and BEZ0, k = (1 - u)k. The vector equation 5.25 represents a set of three parametric equations for the
individual curve coordinates:
n
x(u ) = ∑ x k BEZ k ,n (u )
k =0
n
y (u ) = ∑ y k BEZ k ,n (u ) 5.29
k =0
n
z (u ) = ∑ z k BEZ k ,n (u )
k =0
As a rule, a Bezier curve is a polynomial of degree one less than the number of control points used: Three points
generate a parabola, four points a cubic curve, and so forth. The figure 5.20 demonstrates the appearance of some
Bezier curves for various selections of control points in the xy-plane (z = 0). With certain control-point placements,
however, we obtain degenerate Bezier polynomials. For example, a Bezier curve generated with three collinear
control points is a straight-line segment. And a set of control points that are all at the same coordinate position
produces a Bezier “curve” that is a single point. The Bezier curves are commonly applied in painting and drawing
packages, as well as CAD systems, since they are easy to implement and they are reasonably powerful in curve
design. Efficient methods for determining coordinate positions along a Bezier curve can be set up using recursive
calculations. For example, successive binomial coefficients can be calculated as
n − k +1
C ( n, k ) = C (n, k − 1)
k
Pb Pb Pd

Pb Pc

Pd Pc
Pa Pc Pa Pa
(a) (b) (c)

Pc Pb Pc

Pa

Pb Pd Pa Pc Pd

(d) (e)
Fig. 5.20 Examples of two-dimensional Bezier curves generated from three, four, and five control points.
Dashed lines connect the control-point positions

Chapter 5 Three dimensional Graphics-I Page 13 of 46


The following example program illustrates a method for generating Bezier curves.
#include <stdio.h> /* Header file for standard input output functions */
#include <graphics.h>
/* Header file for standard graphicsinput output functions */
#include <bios.h> /* Header file for basic input output system functions */
#include <stdlib.h> /* Header file for standard library functions */
typedef double CoArr[4];
char buf[20];/* function definition for drawing Bezier curve */
void Bezier_Curve(CoArr x, CoArr y, int n, int value)
{
int i, a, b;
double delta = 1.0/n;
double t = 0, T;
setcolor(8); //defining color for curve
for(i = 0; i < 4; i++)
line(x[i], y[i], x[(i+1) % 4], y[(i+1) % 4]);
for(i = 0; i < n; i++)
{
t = t + delta;
T = 1 - t;
a = x[0] * T * T * T + 3 * t * T * T * x[1] +
3 * t * t * T * x[2] +
t * t * t * x[3];
b = y[0] * T * T * T + 3 * t * T * T * y[1] +
3 * t * t * T * y[2] + t * t * t * y[3];
putpixel(a, b, value);
}
}
main()
{
CoArr x, y;
int val;
int gd = DETECT, gmode;
int key;
int flag = 1;
double *movey;
double *movex;
char *str;
x[0] = 100; y[0] = 100;
x[3] = 400; y[3] = 100;
x[1] = 200; y[1] = 50;
x[2] = 300; y[2] = 50;
initgraph(&gd, &gmode, "c:\tc\bgi");
/* function calling for drawing Bezier curve */
Bezier_Curve(x, y, 1000, 15);
movex = &x[1];
movey = &y[1];
while((key = bioskey(0)) != 283)
{
cleardevice();
switch(key)
{

Chapter 5 Three dimensional Graphics-I Page 14 of 46


case 3849:
if(flag == 0)
{
flag = 1;
movex = &x[0]; movey = &y[0];
}
else if(flag == 1)
{
flag = 2;
movex=&x[1]; movey = &y[1];
}
else if(flag == 2)
{
flag = 3;
movex = &x[2]; movey = &y[2];
}
else if(flag == 3)
{
flag = 0;
movex = &x[3]; movey = &y[3];
}
break;
case 18432: *movey = *movey - 5; break;
case 20480: *movey = *movey + 5; break;
case 19200: *movex = *movex - 5; break;
case 19712: *movex = *movex + 5; break;
}
if(flag ==0)
{
setcolor(4);
circle(x[3], y[3], 3);
}
else if(flag == 1)
{
setcolor(4);
circle(x[0],y [0], 3);
}
else if(flag == 2)
{
setcolor(GREEN);
circle(x[1], y[1], 3);
}
else if(flag == 3)
{
setcolor(GREEN);
circle(x[2], y[2], 3);
}
value = (int)x[1];
itoa(val, str, 10);
setcolor(4);
outtextxy(50, 50, str);
value = (int)y[1];
itoa(val, str, 10);
setcolor(4);
outtextxy(80, 50, str);
value = (int)x[2];
itoa(val, str, 10);
setcolor(4);
outtextxy(50, 80, str);

Chapter 5 Three dimensional Graphics-I Page 15 of 46


value = (int)y[2];
itoa(val, str, 10);
setcolor(4);
outtextxy(80, 80, str);
Bezier_Curve(x, y, 1000, 15);
}
return 0;
}
Properties of Bezier Curves
A very useful property of a Bezier curve is that it always passes through the first and last control points. That is, the
boundary conditions at the two ends of the curve are:
P(0) = P0
P(1) = Pn 5.30
Values of the parametric first derivatives of a Bezier curve at the endpoints. Three-Dimensional points can be
calculated from control-point ordinates as:
P' (0) − np 0 + np1
P' (1) − np n −1 + np n 5.31
Thus, the slope at the starting of the curve is across the line joining the first two control points, and the slope at the
end of the curve is across the line joining the last two control points. In the same way, the parametric second
derivatives of a Bezier curve at the endpoints are calculated as:
P' ' (0) = n(n − 1){( p 2 − p1 ) − ( p1 − p 0 )
P' ' (1) = n(n − 1){( p n − 2 − p n − 1 ) − ( p n − 1 − p n ) 5.32
Another important property of any Bezier curve is that lies within the convex hull (convex polygon boundary) of the
control points. This follows from the properties of Bezier blending functions: They are all positive and their sum is
always 1,
n

∑ BEZ
k =0
k ,n (u ) = 1 5.33

so that any curve position is simply the weighted sum of the control-point positions. The convex-hull property for a
Bezier curve ensures that the polynomial smoothly follows the control points without erratic oscillations.
P3

P2

P1 P0, P4
Fig. 5.21 A closed Bezier Curve generated with same starting and end point

Chapter 5 Three dimensional Graphics-I Page 16 of 46


P1, P2 P3

P0 P4
Fig. 5.22 A Bezier curve is made to pass closer to a given
coordinate by assigning multiple (P1, P2) control points
Design Techniques Using Bezier Curves
Closed Bezier curves are generated by specifying the first and last control points at the same position, as in the
example shown in figure 5.21. Also, specifying multiple control points at a single coordinate position gives more
weight to that position. In figure 5.22, a single coordinate position is input as two control points, and the resulting
curve is pulled nearer to this position. A Bezier curve can be fit to any number of control points, but this requires the
calculation of polynomial functions of higher degree. When complicated curves are to be generated, they can be
formed by piecing several Bezier sections of lower degree together. Piecing together smaller parts also gives us better
control over the shape of the curve in small regions. Since Bezier curves pass through endpoints, it 1s easy to match
curve sections (zero order continuity). Additionally, Bezier curves have the important property that the tangent to the
curve at an endpoint is across the line joining that control point to the adjacent control point. Therefore, to obtain first-
order continuity between curve sections, we can pick control points P0' and P' of a new section to be along the same
straight line as control points Pn and P1 of the previous section (see figure 5.23). When the two curve sections have
the same number of control points. We obtain C1 continuity by choosing the first control point of the new section as
the last control point of the previous section and by positioning the second control point of the new section at position.
P1

P3′

P0′

P0
P1′ P2′
Fig. 5.23 Piecewise approximation curve formed with two Bezier sections, zero-order and first-order
continuity are attained between curve sections by setting P0′ = P2 and by making points P1, P2 and P1′ collinear.
Thus, the three control points are collinear and equally spaced. We obtain continuity between two Bezier sections by
calculating the position of the third control point of a new section in terms of the positions of the last three control
points of the previous section as Pn −2 + 4( Pn − Pn −1 ) . Requiring second-order continuity of Bezier curve sections can
be unnecessarily restrictive. This is especially true with cubic curves, which have only four control points per section.
In this case, second-order continuity fixes the position of the first three control points and leaves us only one point
that we can use to adjust the shape of the curve segment.
The Cubic Bezier Curves
Many graphics packages make available only cubic spline functions. This facilitates reasonable design flexibility
while avoiding the increased calculations required with higher-order polynomials. The cubic Bezier curves can be
generated with four control points. The four blending functions for cubic Bezier curves are given below that are
obtained by substituting n = 3, for k = 0, 1, 2, 3 into equation 5.26:

Chapter 5 Three dimensional Graphics-I Page 17 of 46


BEZ 0,3 (u ) = (1 − u ) 3
BEZ 1,3 (u ) = 3u (1 − u ) 2
5.34
BEZ 2,3 (u ) = 3u 2 (1 − u )
BEZ 3,3 (u ) = u 3
The form of the blending functions determine how the control points influence the shape of the curve for values of
parameter u over the range from 0 to 1. At u = 0, the only nonzero blending function is BEZ0, 3 which has the value 1.
At u = 1, the only nonzero function is BEZ3, 3 with a value of 1 at that point. Thus, the cubic Bezier curve will always
pass through control points p0 and p3. The other functions, BEZ1, 3 and BEZ2, 3, influence the shape of the curve, at
intermediate values of parameter u, so that the resulting curve tends toward the points p1, and p2. Blending function
1 2
BEZl, 3 is maximum at u = , and BEZ2, 3 is maximum at u = .
3 3
The Bezier Surfaces
We can use two sets of orthogonal Bezier curves to design an object surface by specifying by an input mesh of control
points. The parametric vector function for the Bezier surface is formed as the Cartesian product of Bezier blending
functions:
m n
P(u, v) = ∑∑ p j ,k BEZ j ,m (v) BEZ k ,n (u ) 5.35
j =0 k =0

with pj, k specifying the location of the (m + 1) by (n + 1) control points. Figure 5.24 illustrates two Bezier surface
plots. The control points at the surface are connected by dashed lines, and the solid lines show curves of constant
values u and v. Each curve of constant u is plotted by varying v over the interval from 0 to 1, with u fixed at one of the
values in this unit interval. Curves of constant v are plotted similarly.

(a) (b)
Fig. 5.24 Bezier surfaces constructed for (a) m = 3, n = 3, and
(b) m = 4, n = 4. Dashed lines connect the control points
Bezier surfaces have the same properties as Bezier curves, and they provide a convenient method for interactive
design applications. For each surface patch, we can select a mesh of control points in the xy “ground” plane, then we
choose elevations above the ground plane for the z-coordinate values of the control points. Patches can then be pieced
together using the boundary constraints.
Figure 5.25 illustrates a surface formed with two Bezier sections. As with curves, a smooth transition from one
section to the other is assured by establishing both zero-order and first-order continuity at the boundary line. Zero-
order continuity is obtained by matching control points at the boundary. First-order continuity is obtained by choosing
control points along a straight line across the boundary and by maintaining a constant ratio of collinear line segments
for each set of specified control points across section boundaries.

Chapter 5 Three dimensional Graphics-I Page 18 of 46


Fig. 5.26 An illustration of a composite Bezier surface constructed with two Bezier sections,
joined at the indicated boundary line. The dashed lines in the figure connect specify control points.
5.4 THREE DIMENSIONAL TRANSFORMATIONS
As in two dimensional transformations, there are three basic transformations for three-dimensional geometry.
(a) Translation (b) Rotation (c) Scaling
5.4.1 Translation
In 3-D homogenous co-ordinates representation a transformation matrix for the translation of P = (x, y, z) to the
position P ′ = ( x1 , y1 , z1 ) is given by

1 0 0 0
0 1 0 0
[x1, y1, z1] = [x, y, z, 1]  5.36
0 0 1 0
 
t x ty tz 1
where tx, ty and tz translation factors. So
x1= x + tx
y1 = y + t y
z1 = z + t z
We can determine the inverse of this by making negative the values of tx, ty and tz which produces a translation in the
opposite direction, and the product of a translation matrix and its inverse produces the identity matrix.
Y P′ (x′, y′, z′)

P (x, y, z)

V
X

Z
Fig. 5.26 Three Dimensional Translation
5.4.2 Scaling

Chapter 5 Three dimensional Graphics-I Page 19 of 46


The two dimensional scaling is used to change the size of an object. Scaling transformation matrix will be represented
as
s x 0 0 0
0 sy 0 0
[x' y' z' 1] = [x y z 1]  5.37
0 0 sz 0
 
0 0 0 1
Y

Z
Fig. 5.27 Three dimensional scaling
Or we can write the scaling in the form of equation as
x′ = x * s x
y′ = y * sy , and
z′ = z * sz
5.4.3 Rotation
As rotation about the origin in two dimensional geometry we have considered an angle of rotation and a centre of
rotation. But rotation in three dimensional geometry is more complex than that of two-dimensional. Because, in this
case we consider the angle of rotation and an axis of rotation. Therefore there can be three cases from where we select
one of the positive x-axis, y-axis and z-axis as an axis of rotation.
(a) Rotation about x-axis
We can see from the following diagram (figure 5.28) that is
x′ = x
y′ = r cos (α + θ) = r cosα cosθ – r sinα sinθ
Since r cosα = y and r sinα = z then the equation becomes
y′ = y cosθ – z sinθ
and z′ = r sin (α + θ) = r sinα cosθ + r cosα sinθ
z′ = z cosθ + y sinθ
So the equation becomes
x′ = x
y′ = y cosθ – z sinθ
z′ = y sinθ + z cosθ
or the equations can be written in the matrix form as follows

Chapter 5 Three dimensional Graphics-I Page 20 of 46


 x'  1 0 0 0 x 
 y ' 0 cos θ - sinθ 0  y
  =    5.38
z'  0 sinθ cosθ 0 z 
     
1  0 0 0 1 1 

α θ
P′ (0, y′, z′)

Z
P (0 y, z)
Fig. 5.28 Rotation about x-axis

(b) Rotation about y-axis


When we rotate the object about the y-axis, then the equations become
x′ = x cosθ + z sinθ
y′ = y
z′ = -x sinθ + z cosθ
or we can write the above equation in the matrix form as
 x'   cos θ 0 sin θ 0 x 
 y '  0 1 0 0  y
  =    5.39
 z '  − sin θ 0 cos θ 0 z 
     
1   0 0 0 1 1 

α θ
P′ (x′, 0, z′)

Z
P (x, 0, z)
Fig. 5.29 Rotation about y-axis
(c) Rotation about z-axis
The figure 5.30 illustrates the rotation of a point about the z-axis.

Chapter 5 Three dimensional Graphics-I Page 21 of 46


Z

α θ
P′ (x′, y′, 0)

Y
P (x, y, 0)
Fig. 5.30 Rotation about z-axis
The equations about the z-axis rotation can be written as :
x′ = x cosθ - y sinθ
z′ = z
y′ = z sinθ + y cosθ
or the equations can be written in the matrix form as
 x'  cos θ − sin θ 0 0 x 
 y '  sin θ cos θ 0 0  y
  =    5.40
z'   0 0 1 0 z 
     
1   0 0 0 1 1 
5.4.4 Rotations about an arbitrary line
A rotation matrix for any axis that does not overlap with a coordinate axis can be setup as a composite transformation.
This involves combinations of the coordinate axis rotations and translations in either sequence. In the special case
where an object is to be rotated about an axis (parallel to one of the coordinate axis), we can achieve the desired
rotation by following transformation sequence as below:
1. Translating the object by rotating axis coinciding with the parallel coordinate axis,
2. Performing the specified rotation about the axis,
3. Translating the object by moving the rotation axis back to its original position.
The above steps can be defined in the following diagram (figure 5.31):

Y Y

Rotation axis

X X
Z Z
(a) (c)

Chapter 5 Three dimensional Graphics-I Page 22 of 46


Y Y

Rotation axis

X X

Z Z
(b) (d)
Fig. 5.31 Sequence of transformations for rotation of the object about axis parallel to x-axis
Any coordinate position P on the object is transformed with the sequence as
P′ = T -1 . Rx (θ). T. P
which is same as the two-dimensional transformation sequence for rotation about an arbitrary point. When we wish to
rotate an object about an axis that is not parallel to one of the coordinate axes, we need to perform a sequence of
additional transformations. The sequence also includes rotations to align the axis with a selected coordinate axis and
finally, to bring the axis back to its original orientation. We can perform the required rotation in the following steps:
1. Translation of the object so that the rotation axis passes through the coordinate origin.
2. Rotation of the object so that the axis of rotation coincides with one of the coordinate axes.
3. Performing the specified rotation about the axis
4. Performing inverse rotations to bring the rotation axis back to its original orientation.
5. Performing the inverse translation to bring the rotation axis back to its original position
The parametric equation for the line is
x2 = x1 + Au
y2 = y1 + Bu
z2 = z1 + Cu
( x1 , y1 , z1 ) is the point on the line and (A, B, C) vector gives the direction.
Step1: Translation
 1 0 0 0
 0 1 0 0
T= 
 0 0 1 0
 
− x1 − y1 − z1 1
So the point (x1, y1, z1) moves to the origin. Now
1 0 0 0
0 1 0 0
T1 = 
0 0 1 0
 
 x1 y1 z1 1
T1 gives a translation in the opposite direction.
Step 2: In this step we have to align a axis on the Z-axis. For this we follow two steps:
1. Rotation about x-axis by an angle k such that the shadow lies on z-axis
2. Rotate about y-axis by an angle L so that an axis will be aligned on the z-axis.

Chapter 5 Three dimensional Graphics-I Page 23 of 46


Y

(0, B, C) (A, B, C)

X
k

Z
Fig. 5.32 Rotation about x-axis by an angle k
Now we find the transformation matrix for each case.
(i) The axis (A, B, C) translated to the origin having its shadow in the yz-plane. So A = 0. The shadow is (0, B, C). The
length of an axis is
U = (A2 + B2 + C2)0.5
And the length of a shadow is
V = (B2 + C2)0.5
Rotate about x-axis by an angle k so that shadow will be on z-axis. From the above diagram we can calculate sin k and
cos k
sin k = B/V, and cos k = C/V
The rotation about an axis by an angle k is given by a transformation matrix.
1 0 0 0 1 0 0 0
0 cos k sin k 0 0 C / V B /V 0
Rx =  = 
0 − sin k cos k 0 0 − B / V C /V 0
   
0 0 0 1 0 0 0 1
And rotation about an x-axis in reverses direction Rx1
1 0 0 0
0 C / V − B /V 0
Rx1 =  5.41
0 B / V C /V 0
 
0 0 0 1
Y

V U
L

Z A
Fig. 5.33 Rotation about y-axis by an angle L

Chapter 5 Three dimensional Graphics-I Page 24 of 46


(ii). Now we will rotate about y-axis so that it align on z-axis by an angle L
sin L = A/U
cos L = V/U
The rotation matrix will be
 cos L 0 sin L 0  V / U 0 A /U 0
 0 1 0 0  0 1 0 0
Ry =  =
− sin L 0 cos L 0 − A / U 0 V /U 0
   
 0 0 0 1  0 0 0 1
and
V / U 0 − A /U 0
 0 1 0 0
Ry1 =  5.42
A /U 0 V /U 0
 
 0 0 0 1
After this the arbitrary axis aligned on the z-axis as shown in the below diagram:
Y

X
U

Z
Fig 5.34 Align of the arbitrary axis on z-axis
Step 3: Finally we rotate by an angle A about z-axis because we aligned an arbitrary axis with the z-axis. The rotation
about z-axis by an angle A is given by
 cos A sin A 0 0
− sin A cos A 0 0
Rz =   5.43
 0 0 1 0
 
 0 0 0 1
Step 4: Now inverse rotation about a y and z-axis
Step 5: Inverse translation. So the result will be
RA = T.Rx. Ry. Rz. Rx1. Ry1. T1
where Rx1, Ry1, T1 are the inverse of Rx, Ry, T matrices. And RA is the rotation about an arbitrary axis.
5.4.5 Composite Transformations
As with two-dimensional transformations, we make a composite three-dimensional transformation by multiplying the
matrix representations for the individual operations in the transformation sequence. This concatenation is carried out
from right to left, where the rightmost matrix is the first transformation which is applied to an object and the leftmost
matrix is the last transformation to be applied. In this a sequence of basic, three-dimensional geometric
transformations are combined to produce a single composite transformation, which is then applied to the coordinate
definition of an object. The example of composite transformations can be given as when we rotate the object about an
arbitrary axis then we have to take several steps to follow it which is given as above.

Chapter 5 Three dimensional Graphics-I Page 25 of 46


There are also some other transformations, which can be applied to the three dimensional object. These
transformations can be given as follows reflection and shear.
5.4.6 Reflection
Reflection in three dimensional (3D) coordinate system is the reflection of a point/object relative to a plane. The
reflection about xy plane changes a right hand side system to left hand side one.
1 0 0 0
0 1 0 0
Mxy = 
0 0 −1 0
 
0 0 0 1
Mxy is the matrix of mirror reflection relative to xy-plane. Similarly we can define the matrix relative to the yz and zx-
plane as follows
− 1 0 0 0
0 1 0 0
Myz = 
0 0 1 0
 
0 0 0 1

1 0 0 0
0 − 1 0 0
Mzx = 
0 0 1 0
 
0 0 0 1
Shear
Shearing can be done with respect to an axis. This transformation keeps the value corresponding to that axis co-
ordinate unchanged. The z-axis shear is given as
1 0 0 0
0 1 0 0
SHZ = 
a b 1 0
 
0 0 0 1
Parameters a and b can take any real values. The effect of this transformation matrix is to change x and y coordinate
values by an amount that is proportional to the z value, while leaving the z co-ordinate unchanged. Similarly
1 a b 0 1 0 0 0
0 1 0 
0 a 1 b 0
SHX =  and SHy = 
0 0 1 0 0 0 1 0
   
0 0 0 1 0 0 0 1

5.5 THREE DIMENSIONAL VIEWING


The figure below, shows the axis Xvc, Yvc, Zvc coordinates relative to world coordinate scenes.

Chapter 5 Three dimensional Graphics-I Page 26 of 46


Yvc
Ywc

Xvc

Xwc
Zvc
P0 = (x0, y0, z0)

Zwc
Fig. 5.35 Coordinate system for right handed viewing
Viewing coordinates
An approach similar to the photographing the object is applied to generate the view of an object in three dimensions.
The view of such scene can be analyzed from any angle, from any distance, and also from any orientation of the
camera. The type of lens determines the quality of the captured image. To incorporate this idea into three dimensional
graphics applications, the views of a scene can be generated by specifying the spatial position, and aperture size of the
camera.
Specification of view plane
Particular view for a scene can be chosen by first accomplishing the viewing coordinate system that allows us to view
reference coordinate system. Such a system is illustrated in figure below. It contains a view plane (also called a
projection plane), and a perpendicular set up to viewing Z axis. A viewing plane can be thought as a film p-lane in a
camera that can be positioned and oriented to a particular snap shot of the viewing scene. The position in the world
coordinates in a scene can be transformed to view the coordinates. The viewing coordinates can be projected on to the
viewing plane.
Ywc Viewing plane Ywc

Xwc Xwc

Viewing plane
Zwc Zwc

Fig. 5.36 Specification of normal vector coordinates by orientation


This figure shows the coordinates of the viewing plane for specification of normal vector coordinates relative to the
world origin point.

V
θi
N

Fig. 5.37 Specification of the viewing up vector by an angle θi

Chapter 5 Three dimensional Graphics-I Page 27 of 46


Yvc Xvc
Ywc
Zvc
N
P P0
Xwc

Zwc
Fig. 5.38 Viewing plane orientation of a specific look-at point relative to the viewing coordinate origin
The figure below shows the illustration of the viewing plane positioning. For this purpose we can set the viewing
plane distance to the value zero, the uv plane (here xvyv) of the viewing coordinates is the view plane for the
transformation projection. Some times the term uv-plane is also used to refer the viewing plane. It does not matter
whether it is positioned in the relation to xvyv plane.

Yv

Xv

Fig. 5.39 positioning along the axis in the view plane


A series of view of scene can be obtained by keeping the view reference point and by changing the direction of N.
This illustration is given shows the view of a three dimensional object from three different dictions. The figure below
shows the left, right, and the top view of the scanner (the three dimensional object) in the viewing plane.

Figure 5.40 Viewing a scene from different directions with a fixed view-reference point.

Chapter 5 Three dimensional Graphics-I Page 28 of 46


Fig. 5.41Changing the viewing reference point position by moving around
5.6 PROJECTIONS
With the help of projection, we can take a view of an object from different directions and different distances. In this
section we will see important types of projects.
5.6.1 The Parallel Projection
Parallel projection shows the true image, size and shape of the object. The angle made by the direction of projecting
lines with the projection plane or view plane. Projection rays (projectors) emanate from a COP (Center of Projection)
and intersect Projection Plane. The center of projection for parallel projectors is at infinity. The length of a line on the
projection plane is the same as the “true Length”.
P2

P2′

P1

P2′

Parallel lines
Fig.5.42 Illustration of parallel projection
There exist two different types of parallel projections in practice. In orthographic projection the direction of projection
is perpendicular to the projection plane. In case of oblique projection the direction of projection is not perpendicular
to the projection plane. Let us consider figure 5.43 that illustrates the parallel projection of a point (x, y, z). The
projection plane is across the line z = 0. The values x, y represent the orthographic projection values and the values xp,
yp are the oblique projection values.
Y

(x, y, z) (xp, yp)


α
Z X
Φ

(x, y)

Projection plane
Fig.5.43 Illustration of orthographic projection

Chapter 5 Three dimensional Graphics-I Page 29 of 46


If we look at orthographic projection, it just discards the z coordinates. Drawings in Engineering frequently use top,
front, side orthographic views of an object. Following diagram illustrates three orthographic views of an object (See
figure 5.44)
Orthographic projections that show more than one side of an object are called axonometric orthographic projection.
The most common axonometric projection can be considered as an isometric projection where each coordinate axis is
intersected by the projection plane in the model coordinate system at an equal distance.

Top View

Side View

Front View
Fig. 5.44 Orthographic view of an object
5.6.2 The Isometric Projection
This is the projection in which projection plane intersects the x-, y-, and z-axes at equal distances and the projection
plane Normal makes an equal angle with the three axes. To obtain an orthographic projection we assume xp = x, yp = y,
and zp = 0. this projection is illustrated by figure 5.45.
Y

Z
Fig.5.45 Illustration of Isometric Projection
5.6.3 Oblique Projection

Chapter 5 Three dimensional Graphics-I Page 30 of 46


Y

(x, y, z) (xp, yp)


α
Z X
Φ

(x, y)

Projection plane
Fig. 7.46 Illustration of Oblique Projection
Case (i) If A = 45°, then tan A = 1 ⇒ L1 = 1. This is the case of Cavalier projection such that all lines the projectors
are not perpendicular to the projection plane but are parallel from the object to the projection plane The projectors are
defined by two angles A and d where: A = angle of line (x, y, xp, yp) with projection plane, d = angle of line
( x, y, x p , y p ) with x-axis in projection plane L = Length of Line ( x, y, x p , y p ) , then:
cos d = (xp - x)/L ⇒ xp = x + L cos d,
sin d = ( y p − y ) / L ⇒ yp = y + L sin d,
tan A = z / L
Now we define
L1 = L/z ⇒ L = L1z,
Therefore,
tan A = z / L = 1 / L1
xp = x + z(L1cos d), and
yp = y + z(L1sin d)
 1 0 0 0
 0 1 0 0
P=
 L1 cos q L1 sin q 1 0
 
 0 0 0 1
Now if the angle A = 90° (the projection line is perpendicular to Projection Plane) then tan A = ∞ ⇒ L1 = 0, so we
have an orthographic projection. There are two special cases of oblique projection (perpendicular to the projection
plane) that are projected with no change in length.
L1 = L2

L1
L2 45° 30°

Fig .5.47 Two cubes cavalier Projection

Chapter 5 Three dimensional Graphics-I Page 31 of 46


1
Case (ii) If tan A = 2, then A = 63.40°, L1 = . The lines that are perpendicular to the projection plane are projected at
2
1
length. This is also called a Cabinet projection.
2
L1 = ½ L2

L1
L2

Fig.5.48 Illustration of Cabinet projection


5.6.4 The Perspective Projection
The Perspective viewing projection has a Center of Projection (COP) at a finite distance from the projection plane as
shown in figure 5.49 (see below):
Projectors

Center of Projection

L1 L1

Fig.5.49 Illustration of Perspective projection


The distance of a line from the projection plane determines its size on the projection plane that means further the line
is from the projection plane, the smaller its image on the projection plane. As we see in the two images above, there is
the projection of L1 = L2 but the actual length of L1 is not equal to L2. The perspective projection is more practical
because the distant objects appear smaller.
Computing the Perspective Projection

Y
P (x, y, z)
X

(xp, yp)
Z

Fig.5.50 Perspective projection


Let us look at above diagram from y-axis, we have

Chapter 5 Three dimensional Graphics-I Page 32 of 46


X

Z xp COP
z d

PP
Fig.5.51 Perspective projection

Now,
xp
x/(z + d) =
d
d
xp = x[ ] , and
z+d
xp = x/(z/d + 1)

The same calculation is done for y (look down the x-axis) to get yp = y/(z/d + 1), zp = 0. Note that we can increase the
perspective effect by decreasing d (moving closer). We can represent this in matrix form by using homogeneous
coordinates as follows:
1 0 0 0
0 1 0 0 
[xh yh zh w] = [x y z 1]  1
0 0 0 
 d
0 0 0 1 
where, xh = x, yh= y zh = 0 w = (z/d) + 1
xh yh zh
and Points on the projection plane are [ xp yp zp 1] = [ 1] .
w w w
This leads to the same xp, yp as before. The major problem with the perspective transformation is that it does not
safeguard straight lines or planes, that means straight lines can not be transformed into straight lines. Let us look at
example of a three dimensional line in object space from:
P1 (x1 = 2, y1 = 5, z1 = 6) to P2 (x2 = 8, y2 = 7, z2 = 12)
In parametric form this line is represented as:
x(t) = 2 + 6 × t
y(t) = 5 + 2 × t
z(t) = 6 + 6 × t
Let us apply an arbitrary value of t (for example, t = 0.40) and compute the x, y, z values
x = 2 + 2 × 0.40 = 4.40
y = 5 + 2 × 0.40 = 5.80, so Pi (t = 0.40) = (4.40, 5.80, 8.40)
z = 6 + 6 × 0.40 = 8.40
Let us now perform the perspective transformation (let us assume d = 10.0) for P1, Pi, P2. Then we get:
P1(x = 1.25, y = 3.125, z = 6.0),
Pi (x = 2.39, y = 3.15, z = 8.4), and
P2(x = 3.64, y = 3.18, z = 12.0)

Chapter 5 Three dimensional Graphics-I Page 33 of 46


If this is still a straight line then all three coordinates of point Pi must have the same value of the parameter t. So for x
we get
2.39 = 1.25 + t × (2.39) ⇒ t = 0.48
for y we get 3.15 = 3.12 + t × (0.57) ⇒ t = 0.48
for z we get t = 0.40 which is unchanged, therefore the points are not collinear. For maintaining linearity a perspective
depth transformation can be done as:
Zp = Z / (D + Z)
Then for point 1
Zp = 6 / (10 + 6) = 0.375
For point 2
Zp = 12 / (10 + 12) = 0.545
For point i
Zp = 8.4 / (10 + 8.4) = 0.457
Now check with t value for point i
0.457 = 0.375 + t * (0.170) = 0.48
This is the same value of t we calculated for point i, x and y. Therefore points 1, 2, and i are still collinear after
applying perspective depth transformation.
The point to be noted is that the relative z depth values remain unchanged, that means if Z2 > Z1 then there exists a
relation Z2 / (Z2 + d) >Z1 / (Z1 + d) as shown below:
Z2 > Z1
Z2 × d > Z1 × d (by multiplying both sides by d)
(Z1 × Z2 + Z2 × d) > (Z1 × Z2 + Z1 × d) (by adding Z1 × Z2 to both sides)
Z2 × (Z1 + d) > Z1 × (Z2 + d)
Z2 /(Z2 + d)> Z1 /(Z1 + d)
for Zp = Z / (Z + d) ⇒ 0 if d is much greater than Z and ⇒ 1.0 if Z is much greater than d, therefore
0.0 ⇐ Zp ⇐1.0
Thus to maintain linearity we will have to transform Z as well as X and Y.
5.7 SOLVED EXAMPLES
Example 5.1 A cubic Bezier curve is defined over the control points (1, 1), (2, 3), (4, 4) and (6, 1). Calculate the
parametric mid points of this curve and show that its gradient dy/dx is 1/5.
Solution. The blending functions for these control points are:
B0,3 (u ) = (1 − u ) 3
B1,3 (u ) = 3u (1 − u ) 2
B2,3 (u ) = 3u 2 (1 − u )
B3,3 (u ) = u 3
The x-coordinate of the Bezier curve are
x(u ) = x 0 B0,3 (u ) + x1 B1,3 (u ) + x 2 B2,3 (u ) + x3 B3,3 (u )
= (1 − u ) 3 + 6u (1 − u ) 2 + 12u (1 − u ) + 6u 3
Similarly the, y-coordinates of the Bezier curve are:
y (u ) = (1 − u ) 3 + 9u (1 − u ) 2 + 12u (1 − u ) + u 3

Chapter 5 Three dimensional Graphics-I Page 34 of 46


The parameter u lies between 0 and 1, therefore the midpoint of the curve is u = ½. By putting this value in x(u) and
y(u) equations we get parametric midpoint coordinates as (27/8, 23/8).
By differentiating the x(u) equation with respect to u we get,
dx
= −3(1 − u ) 2 − 12u (1 − u ) + 6(1 − u ) 2 − 12u 2 + 24u (1 − u ) + 18u 2
du
Similarly by differentiating the y(u) equation with respect to u we get,
dy
= −3(1 − u ) 2 u (1 − u ) + 9(1 − u ) + 9(1 − u ) 2 − 12u 2 + 24(1 − u )u + 3u 2
du
The gradient at any point is given by:
 dy 
 
 dy   du  u
  =
 dx  u  dx 
 
 du  u
The gradient at midpoint for u = ½ is
 dy  3
  =
 du  u =1 / 2 4
and
 dx  21
  =
 du  u =1 / 2 4
 dy  1
Then we have   = which is equal to the given gradient.
 dx  u =1 / 2 7
The cubic Bezier curve is given by following diagram:

(4, 4)

(2, 3)

(1, 1) (6, 1)

Fig. 5.52 The cubic Bezier curve of example 5.1


Example 5.2 Find the scaling transformation matrix to scale by sx, sy, sz units with respect a fixed point P(x, y, z).
Solution. Scaling with respect to a fixed point can be performed by the following sequence
1. translation
2. Scaling
3. Inverse translation
The scaling transformation matrix will be
S = T * SXYZ * T1
 1 0 0 0
 0 1 0 0
where T = 
 0 0 1 0
 
− x − y − z 1

Chapter 5 Three dimensional Graphics-I Page 35 of 46


 1 0 0 0 s X 0 0 0
 0 1 0 0 0 SY 0 0
T1 =   and SXYZ = 
 0 0 1 0 0 0 sZ 0
   
 x y z 1 x y z 1
So we get S as,
 sX 0 0 0
 0 SY 0 0
S= 
 0 0 sZ 0
 
(1 − s X ) x (1 − S Y ) y (1 − s Z ) z 1

Example 5.3 Find the alignment transformation AN which aligns a given vector aI + bJ + cK to the positive z-axis.
Solution. First rotate about x-axis and then rotate about y-axis.
Y

(0, b, c)
N = aI + bJ + cK

V
b X
I

Z
Fig. 5.53 Diagram of example 5.3
V= (b 2 + c 2 )
I = (a 2 + b 2 + c 2 )
cos I = c / V
sin I = b / V
Now rotate the given vector about x-axis by an angle I
1 0 0 0 1 0 0 0
0 cos I sin I 
0  0 c /V b /V 0
Rx =  = 
0 − sin I cos I 0 0 − b / V c /V 0
   
0 0 0 1 0 0 0 1
Rotate vector N about y-axis by an angle J so we get vector N align of positive z-axis
cos J = V/L, and sin J = a/L
 cos J 0 sin J 0 V /L 0 a/L 0
 0 1 0 
0  0 1 0 0
Ry =  = 
− sin J 0 cos J 0 − a / L 0 V /L 0
   
 0 0 0 1  0 0 0 1

Chapter 5 Three dimensional Graphics-I Page 36 of 46


So we get,
 V /L 0 a/L 0
− ba / VL c / V b/ L 0
AN = 
 − ca / VL − b / V c/L 0
 
 0 0 0 1

J
V L
a
Z
Fig. 5.54 Diagram of example 5.3

Example 5.4 The pyramid defined by the coordinates A(0, 0, 0), B(1, 0, 0), C(0, 1, 0) and D(0, 0, 1) is rotated 90°
about the line L that has direction vector V = i +j + k and passing through the origin. Find the coordinates after
rotation?

Solution: Because the direction vector V does not along the normal vector, so align it with normal vector k, then
rotate by an angle 90° then align it with the original direction. So

Rθ,L = Av-1 Rθ,L Av


Here a = b = c = 1 then | V| = 12 + 12 + 12 = 3
 2 −1 −1   2 1 
 0  0 0
 3 6 6   3 3 
 0
1 −1
0  −1 1 1
0
Av =  2 2  and Av-1 =  6 2 3 
 1 1 1   1 1 1 
 0 − − 0
 3 3 3   6 2 3 
 0 0 0 1   0 0 0 1

0 − 1 0 0
1 0 0 0
R 90,k = 
0 0 1 0
 
0 0 0 1

Chapter 5 Three dimensional Graphics-I Page 37 of 46


 2 1   2 −1 −1 
 0 0  0
 3 3  0 − 1 0 0  3 6 6 
 − 1 0 0 −1
0  0
1 1 1 0 1
 0
Then Rθ,L =  6 2 3 . .  2 2 
 1  0 0 1 0  
1 1   1 1 1
− − 0  0
 6 2 3  0 0 0 1
 3 3 3 
 0 0 0 1  0 0 0 1 
 1 1− 3 1+ 3 
 0
 3 3 3 
1 + 3 1 1− 3
0
=  3 3 3 
1 − 3 1 + 3 1 
 0
 3 3 3 
 0 0 0 1
So the points after rotation can be obtained by
P′(A′,B′,C′,D′) = R90,L . P(A, B, C, D)

 1 1− 3 1+ 3   1 1− 3 1+ 3 
 0 0 
 3 3 3  0 1 0 0  3 3 3 
1 + 3 0 
0 . 1 0  0
1 1− 3 0 1 + 3 1 1− 3 
 3   = 
3 3 0 0 0 1  3 3 3 
1 − 3  1 

1+ 3 1
0   0 1 − 3 1+ 3

 3 3 3  1 1 1 1
 3 3 3 
 0 0 0 1 1 1 1 1 

Example 5.5 The pyramid defined by the coordinates A(0, 0, 0), B(1, 0, 0), C( 0, 1, 0 ) and D(0, 0, 1) is rotated 45°
about line L that has the direction V = j+k and passing through the point C(0,1,0). Find the coordinates of the pyramid
after rotation.
Solution. Since line is passing through an arbitrary point so translate it the origin when rotate and then translate back
to the original position. Therefore, the equation will be

R = T. (AV)-1.Rθ.AV.T-1
1 0 0 0  1 1 
1 0 0 0  2 − 0 0
 1 1  2
0 −  
0 − 1 0 0
1 1 1
T = , AV = 
2 2  , Rθ =  0 0
0 0 1 0 0 1 1
0  2 2 
   2 2   0 0 1 0
0 0 0 1
0 0 0 1  
 0 0 0 1
1 0 0 0
 1 1  1 0 0 0
0 0 0 1 0 1
−1 2 2  , and T −1 = 
AV =
0 − 1 1
0 0 0 1 0
 2 2   
0 0 0 1 0 0 0 1

Chapter 5 Three dimensional Graphics-I Page 38 of 46


The rotation matrix will be
1 0 0 0  1 0 0 0  1 1  1 0 0 0 1 0 0 0
0 1 0 − 1 0 1 1   − 0 0  1 1   1
0 − 0  0 1 0
R= 
0  2 2
. 2 2 . 1 1
 . 2 2 .
0 0 1 0    0 0   0 0 1 0
1 1 0 1 1
 
 0 − 0  2 2  0  
0 0 0 1  2 2   0 0 1 0  2 2  0 0 0 1
 0 0 0 1  0 0 0

1
0 0 0 1 

 1 −1 1 1 
 2 2 2 2 
 
 1 2+ 2 2− 2 2− 2 
=  2 4 4 4 
 −1 2− 2 2+ 2 −2+ 2
 
 2 4 4 4 
 0 0 0 1 
The coordinates after rotation can be given by the equation
P′ = R. P
 1 −1 1 1 
 2 2 2 2 
  0 1 0 0
 1 2+ 2 2− 2 2− 2  
 . 0 0 1 0
So P′ =  2 4 4 4
 −1 2− 2 2+ 2 − 2 + 2  0 0 0 1

  1 1 0 1
 2 4 4 4  
 0 0 0 1 
 1 1+ 2 
 0 1 
 2 2 
 2 − 2 4− 2 2− 2
=  1
4 4 4 
− 2 + 2 −4+ 2 
 0 1 
 4 4 
 1 1 1 1 

Example 5.6 Find the matrix for mirror reflection with respect to the plane passing through the origin and having the
normal vector whose direction is N = I + j + k.

Solution: First align the vector with the z-axis then reflect and align back to its original direction
Here A = b2 + c2 = 2
And |N| = a2 + b2 + c2 = 3

Chapter 5 Three dimensional Graphics-I Page 39 of 46


 2 −1 −1 
 0
 3 6 6  1 0 0 0
 −1 0 0
0 2 0  1 0
AN =  2  , and AN-1 = ANT and Mxy =
  0 0 −1 0
1 1 1  
 0
 3 3 3  0 0 1 1
 0 0 0 1

Therefore MN = AN-1. Mxy. AN


 1 −2 −2 
 3 0
3 3
− 2 1 −2 
 0
=  3 3 3 
− 2 −2 1
0
 3 3 3
 0 0 0 1 

5.8 SUMMARY
In this chapter, we have introduced three dimensional object representations. The major topics discussed are Quadric
surfaces, Super Quadrics, Blobby objects, Spline representations, Bezier curves and surfaces. We have seen that
surface polygons as the most commonly used boundary presentation for a three-dimensional graphics objects. We
have seen that the data in polygon tables is placed into tables that are to be used in the subsequent processing, display,
and manipulation of the objects in a scene. We have discussed how the three dimensional object can be represented
using equations. We have seen that with the help of polygon meshes several polygon functions can be modeled to
form objects. We have considered quadratic surface as class of objects that are used described with second-degree
equations. We have also discussed how an ellipsoid can be considered as an extension of a spherical surface, torus as
doughnut-shaped object, Super-quadrics as the class of objects as generalization of the quadric representations. We
have also discussed briefly the superellipse, superellipsoid, blobby objects, spline representations in drafting
terminology, interpolation and approximation spline, parametric continuity conditions, geometric continuity
conditions, spline specifications. We then discussed Bezier curves and surfaces. The Bezier curve is the spline
approximation method. We have illustrated the method of generating curves with the help of control points. Bezier
curve is a polynomial of degree one less than the number of control points used. The important properties of a Bezier
curve are also presented in this chapter. Closed Bezier curves are generated by specifying the first and last control
points at the same position. The cubic Bezier curves can be generated with four control points. Finally the Bezier
Surfaces are discussed.

In this chapter, we have introduced visible surface detection algorithm named Back Face Detection. The
implementation conditions for back face removal are also discussed. We also introduced general principles including
object space and Image space. In Depth-Buffer Method, we have seen it as a simple extension of the frame buffer
idea. We have also discussed how a frame buffer is used to store the attributes of each pixel in the image space.
We have seen that A-Buffer Method is considered the A-buffer method as an extension of the techniques which are
used in depth-buffer method. We have also discussed that the A-buffer method represents an antialiased, area-
averaged method used in implementation of surface-rendering system. Scan-line Methods are considered as
extensions of scan polygon techniques. We have presented Depth-Sorting method for performing Surfaces sorting in
decreasing order of depth and, Surfaces scan conversion in order starting from the surface of greatest depth lowest.
The octrees methods are considered as three dimensional analogs of quad-trees.
We have introduced basic transformation techniques that can be applied in three dimensional plane. The most basic
transformations are translation, scaling and rotation. In translation an object can be shifted to any coordinate position

Chapter 5 Three dimensional Graphics-I Page 40 of 46


in three dimension plane, while in rotation an object can be rotated about origin as well as any arbitrary pivot point. In
case of scaling, the size of an object can be modified in x-direction, in y-direction, z-direction as well as in all the three
directions. For this purpose the three dimensional geometry is also discussed in brief. Apart from these basic
transformations, in shearing the shape of an object can be modified in x-direction, in y-direction, in z-direction as well
as in all the three directions depending upon the value assigned to shearing variables. In reflection the mirror image of
an object can be seen with respect to x-axis, y-axis, z-axis as well as with respect to an arbitrary line. The concept of
composite transformation with respect to xyz-plane is also introduced.
We have introduced a new term called projection in this chapter. There are two kind of projection parallel and
perspective. The two kind of parallel projections orthographic projection and oblique projection are also discussed in
this chapter. As far as the further classification is concerned the axonometric orthographic, isometric projection,
cavalier Projection, Cabinet projection also discussed.
5.9 KEY TERMS
Constructive Solid Geometry Methods - The Constructive Solid Geometry Methods refers to the shapes created by
union, intersection and difference of given shapes.
Octrees - Octrees are three dimensional analogs of quad-trees.
Quadric surfaces - Quadric surfaces (particularly spheres and ellipsoids), are common elements of graphics scenes,
and they are often used in graphics packages as primitives components by which more complex objects can be
constructed.
The Torus - A torus can be defined as doughnut-shaped object.
Super Quadrics - Super-quadrics is the class of objects as generalization of the quadric representations.
Blobby Objects - Some objects do not maintain a fixed shape, but change their surface characteristics in certain
motions or when in proximity to other objects. These are called blobby objects.
Wire Frame Model - The wire frame model of a three dimensional object is a model that represents all the
dimensions of the object external as well as internal.
Bezier curve - Bezier curve is the spline approximation method that was developed by the French engineer Pierre
Bezier for use in the design of automobile bodies.
Orientation - The orientation of co-ordinate system is determined by two systems : right-handed system and left-
handed system.
Basic transformations - There are three basic transformations for three-dimensional geometry: (a) Translation, (b)
Rotation, (c) Scaling.
3D Rotation - There can be three cases from where we select one of the positive x-axis, y-axis and z-axis as an axis of
rotation.
Rotations about an arbitrary line - This involves combinations of the coordinate axis rotations and translations in
either sequence.
Composite Transformations - we make a composite three-dimensional transformation by multiplying the matrix
representations for the individual operations in the transformation sequence.
3D Reflection - Reflection in three dimensional coordinate system, is the reflection of a point/object relative to a
plane.
Parallel Projection - Parallel projection shows the true image, size and shape of the object. The angle made by the
direction of projecting lines with the projection plane or view plane.
Isometric Projection - This is the projection in which projection plane intersects the x-, y-, and z-axes at equal
distances and the projection plane Normal makes an equal angle with the three axes.
Perspective Projection - The Perspective viewing projection has a Center of Projection (COP) at a finite distance
from the projection plane.
Object space algorithms - Object space algorithms do their work on the objects themselves before they are
converted to pixels in the frame buffer.
Back Face Removal - A simple example of an object space algorithm where no faces on the back of the object are
displayed. This algorithm removes about half of the total polygons in the image since about half of the faces of
objects are back faces.
Z-Buffer Method (Depth –Buffer) - The z-buffer or depth buffer is the simplest of the visible surface or hidden
surface algorithms and it is an image space algorithm. The z-buffer is a simple extension of the frame buffer idea.

Chapter 5 Three dimensional Graphics-I Page 41 of 46


Frame Buffer - A frame buffer is used to store the attributes of each pixel in the image space.
Scan-Line Method - Scan-line visible surface and visible line algorithms are extensions of scan polygon techniques.
Scan line algorithms reduce the visible line/ visible surface problem from three dimensions to two.
A-Buffer Method - A-buffer method is an extension of the techniques which are used in depth-buffer method. The A-
buffer method represents an antialiased, area-averaged method used in implementation of surface-rendering system.
Depth-Sorting Method - Sorting operations are taken in both image and object space, and the scan conversion of the
polygon surfaces is only performed in the image space.
5.10 ANSWERS TO CHECK YOUR PROGRESS
1. Why are homogeneous coordinates used for transformation computations in Computer Graphics?
2. Give the definition of the cubic Bezier curve.
3. Derive the conditions necessary to ensure that two cubic Bezier curves join with continuity.
4. Describe, in detail, an algorithm for drawing a cubic Bezier curve to a given tolerance using straight lines.
You may assume that you already have an algorithm for drawing a straight line.
5. What is Z-buffer algorithm for removing hidden faces?
6. What are orthographic projections? When do we need them?
7. What are the merits and demerits of various techniques for hidden surface removal?
8. What do you mean by a projection? Classify its different types. What are the perspective anomalies?
9. Write a short note on:
a. Perspective transformation
b. Extend and bounding volumes
c. Back face cutting
10. Explain any one area subdivision algorithm for visible surface detection.
11. What are blobby objects?
12. What do you meant by sweep representation?
13. What is composite transformation?
14. Define perspective projection.
15. What are called cavalier projections?
16. Write down the transformation matrix for shearing in z-axis using parallel projection method.
5.11 QUESTIONS AND EXERCISES
1. Write a short note on viewing transformation.
2. Distinguish between view port and window.
3. What do you mean by normalization transformation? Why it is needed?
4. Write a function to draw a rectangle
5. Write a function to draw a polyline
6. Derive the transformation matrix for 3-D viewing transformation?
7. How can scaling with respect to a point p0 (x0, y0, z0) be defined in terms of scaling with respect to the origin?
8. Derive the general equation of parallel projection on to a given view plane in the direction of a given projector
V.
9. Given the plane parameters U, V, W, and X for all surfaces of an object, devise an algorithm to determine
whether any specified point is inside or outside the object.
10. Write a C program that calculates parameters U, V, W, and X for any set of three-dimensional plane surfaces
defining an object.
11. Write a C program for converting any specified sphere, ellipsoid, or cylinder to a polygon-mesh
representation How would the values for parameters U, V, W, and X in the equation of a plane surface have to
be altered if the coordinate reference is changed from a right-handed system to a left-handed system?
12. Set up an algorithm for converting a specified super-ellipsoid to a polygon-mesh representation.
13. Write a C program to display a two-dimensional, cardinal-spline curve, given an input set of control points in
the xy plane Set up an algorithm for converting a meta ball representation to a polygon-mesh representation.
14. Determine the Bezier blending functions for five control points. Plot each function and label the maximum
and minimum values.

Chapter 5 Three dimensional Graphics-I Page 42 of 46


15. Determine the quadratic Bezier blending functions for three control points. Plot each function and label the
maximum and minimum values.
16. Write an efficient routine to display two-dimensional, cubic Bezier curves, given a set of four control points
in the xy plane.
17. Write a routine to display a cubic Bezier curve using a subdivision method.
18. Write a routine to design two-dimensional, cubic Bezier curve shapes that have second-order piecewise
continuity.
19. Write a routine to design two-dimensional, cubic Bezier curve shapes that have first order piecewise
continuity. Use an interactive technique for selecting control-point positions in the xy-plane for each section
of the curve.
20. Write a program using forward differences to calculate points along a two-dimensional, uniform, periodic,
cubic B-spline curve, given an input set of control points.
21. Determine the blending functions for uniform, periodic B-spline curves for d = 4 and d = 8
22. Write a routine to display any specified conic in the xy-plane using a rational Bezier spline representation.
23. Develop an algorithm for calculating the normal vector to a Bezier surface at the point (u, v).
24. Write a routine to display any specified conic in the xy-plane using a rational B-spline representation.
25. Write a program to display any specified quadratic curve using forward differences to calculate points along
the curved path.
26. Develop an algorithm for generating the description of three-dimensional object using input parameters that
define the object in terms of a rotational sweep.
27. Write a C program to display any specified cubic curve using forward differences to calculate points along the
curve path.
28. Write a C program for generating solid objects as combination of three-dimensional primitive shapes, each
defined as a set of surfaces.
29. Write a routine for performing constructive solid-geometry modeling using a primitive set of solids defined in
octree structures.
30. Develop an algorithm for encoding a two-dimensional scene as a quadtree representation.
31. Write a routine to calculate elevations above a ground plane using the random midpoint-displacement method.
32. Write a routine to convert the polygon definition of a three-dimensional object into an octree representation.
33. Using the random, midpoint-displacement method, write a routine to create a mountain outlined, starting with
a horizontal line in the xy-plane.

5.12 LONG-ANSWER QUESTIONS


1. Write the hidden line methods in detail.
2. Compute the 4 by 4 homogeneous transformation matrix to translate and uniformly scale a volume with
corners (1, 2, 3) and (4, 5, 6) to be centered in a cube with corners (0, 0, 0) and (1, 1, 1), and to be as large as
possible.
3. Find a normal vector to the plane through the three points: (0, 0, 0), (1, 1, 1), and (2, 2, 2).
4. What is the difference between Gouraud and Phong shading?
5. Can Gouraud shading produce a highlight in the interior of a face?
6. Is Gouraud shading faster than Phong?
7. Can Phong shading produce a highlight in the interior of a face?
8. What is Gouraud shading, and what does it achieve (in the context of assuming diffuse reflection)?
9. What is specular reflection, and how is it usually modeled?
10. What does ray tracing involve?
11. Outline what ray tracing achieves, and its limitations?
12. State clearly which properties of the Bezier blending functions guarantee that the Bezier curve lies within the
convex hull of the control points.
13. Show that the derivative of a curve, as a function of u, is a Bezier curve of degree 1. In particular, express the
derivative as a linear combination of the degree-1 Bezier blending functions.

Chapter 5 Three dimensional Graphics-I Page 43 of 46


14. Implement a back-face detection procedure using a perspective projection to view visible faces of a convex
polyhedron. Assume that all parts of the object are in front of the view plane, and provide a mapping onto a
screen viewport for display.
15. Implement a back-face detection procedure using an orthographic parallel projection to view visible faces of a
convex polyhedron. Assume that all parts of the object are in front of the view plane, and provide a mapping
onto a screen viewport for display.
16. Implement the depth-buffer method to display the visible surfaces of a given polyhedron. How can the storage
requirements for the depth buffer be determined from the definition of the objects to be displayed?
17. Write a program to produce an animation of a convex polyhedron. The object is to be rotated incrementally
about an axis that passes through the object and is parallel to the view plane. Assume that the object lies
completely in front of the view plane.
18. Implement the depth-buffer method to display the visible surfaces in a scene containing any number of
polyhedrons. Set up efficient methods for storing and processing the various objects in the scene.
19. Write an algorithm to implement the scan-line algorithm for a scene containing several polyhedrons. Use
polygon and edge tables to store the definition of the object, and use coherence techniques to evaluate points
along and between scan lines.
20. Implement the A-buffer algorithm to display a scene containing both opaque and transparent surfaces. As an
optional feature, the algorithm may be extended to include anti-aliasing.
21. Set up a program to display the visible surfaces of a convex polyhedron using the painter’s algorithm. That is,
surfaces are to be sorted on depth and painted on the screen from back to front.
22. Develop a depth-sorting program to display the visible surfaces in a scene containing several polyhedrons.
23. Write a program on to display an octree representation for an object so that hidden-surfaces are removed.
24. Write a program that uses the depth-sorting method to display the visible surfaces of any given obi& with
plane faces.
25. Discuss how antialiasing methods can be incorporated into the various hidden-surface elimination algorithms.
26. Write an algorithm for viewing a single sphere using the ray-casting method.
27. Derive the matrix for the rotation about z-axis by an angle θ.
28. Find matrix for rotation about any arbitrary line by an angle θ whose direction vector V= ai + bj + ck.
29. Explain the difference between the parallel and perspective projection.
30. Derive the matrix for parallel projection and explain.
31. Explain three dimensional transformations.
32. Write short notes on the following.
a) Parallel projection
b) 3-D Scaling
c) 3-D Translation
d) Isometric projection
e) Orthographic projection

17. How we can rotate an object about any arbitrary line which is not parallel to any axis.
18. Prove that the perspective projection of a line segment is equal to the line segment between the perspective
projection of endpoints.
19. Find the transformation matrix for oblique projection onto xy-plane.
20. What is the difference between a left-handed and a right-handed 3-dimensional coordinate system?
21. What is the reflection property that characterizes a pure diffuse reflector (also called a Lambertian reflector)?
22. What is Lambert’s law of diffuse reflection?
23. What is the inverse texture wrapping function, and why is it more relevant to the rendering process than the
texture wrapping function?
24. What is back-face culling? For an average view, what fraction of the faces of a scene would be expected to be
eliminated by this method? Explain briefly.
25. You want to know whether a point P lies on a given surface. From which representation of the surface is this
question easier to answer: implicit or parametric?
26. Give an implicit function f(x, y, z) = 0 that describes the surface of the cone.

Chapter 5 Three dimensional Graphics-I Page 44 of 46


27. Based on your knowledge of perspective projection, the Phong lighting Model, and the nature of water,
explains why the reflected light has this Elongated shape.
28. Give a function that determines the projection of the point P onto a point Q = (qx, qy, qz) T on the x and y-
coordinate plane, that is, the plane given by the equation z = 0.
29. Various types of visual artifact (“aliasing”) occur if images are rendered using only one sample per pixel.
30. Describe, in outline, each of the z-buffer, BSP tree, and painter’s algorithm methods for rendering a set of 3D
polygons.
31. Compare and contrast the three methods of line clipping.
32. Describe operations on images which achieve the following effects:
(i) lighten an image which is too dark; (ii) remove noise from an image; (iii ) locate 45° edges in an image;
(iv) convert a color image (in RGB format) to a grayscale image while preserving the perceived luminance.
33. Describe an algorithm for performing scan conversion of a set of 3D polygons, including projection, and the
underlying 2D polygon scan conversion algorithm.
34. Explain how to convert standard 3D coordinates, (x, y, z), to homogeneous coordinates and how to convert
homogeneous coordinates to standard 3D coordinates.
35. Define the aspect ratio of the ellipse to be ry = rx. In the case where rx = ry = r (aspect ratio is 1) the ellipse is
a circle of radius r, in which the above equation is equivalent to (x - cx)2 + (y - cy)2 = r2..
36. Let P0 (0 ,0) , P1 (1, 2) , P2 (2, 1), P3 (3, 1) , P4 (4, 10 ) and P5 (5, 5 ) be given data points. If interpolation
based on B-splines is used to find a curve interpolating these data points, Find a point set t0, ….., t9 that can be
used to define B-splines (cubic B-splines ).
37. Given a ray R : P + t~u, where P = (Px, Py, Pz) and ~u = (ux, uy, uz) derive the t value of the first point of
intersection between the surface and the ray. Express your answer by first deriving a quadratic equation of the
form at2 + bt + c = 0 and then explain how to compute the roots of this equation in order to determine the first
intersection point.
38. Derive the value of the (normalized) normal vector ~n at this intersection point. There is no notion of outside
hit or inside hit, but the normal should be directed to the same side of the surface from which the ray
approaches.
39. You are given two circles in the plane of radii r1 and r2 centered at points C1 = (c1x, c1y) and C2 = (c2x, c2y),
respectively. Derive an expression that tests whether these two circles overlap each other, but one circle is not
contained within the other.
40. Given a function drawline(x1, y1, x2, y2), describe an algorithm for drawing a Bezier cubic curve to a specified
level of accuracy using only straight lines.
41. A graphics scene is to be made up of a set of triangles. When one of the triangles is in the standard viewing
system (viewpoint at the origin) it has vertex coordinates:
Vertex Coordinates are P1 (-10, 20, 40), P2 (15, 35, 25), and P3 (15, -20, 60). Assume that the triangle is
visible from the viewpoint.
a) Find the outer normal vector of the surface.
b) If the triangle is to be drawn using interpolation shading, which will be the brightest point? Assume
that the incident light at each point of the triangle is a constant (no inverse square attenuation of the
light).
c) The scene is lit by a single light source which is located at position (-2, -40, -50). Assume that only
diffuse lighting is being used, find the brightest point on the triangle.
d) The triangle is part of a bigger surface. A fourth point P4 at (-25, 25, 40) forms another two triangles.
One is with P1 and P2, and the other with P1 and P3. There are no other faces that meet at P1. What is
the unit normal vector at P1 that would be used for Gouraud shading or Phong shading.
e) Would the result be different if the inverse square law was taken into account?

5.13 FURTHER READINGS


1. D. P. Mukherjee, “Fundamentals of Computer Graphics and Multimedia”, PHI.
2. David F Rogers, “Procedural elements for Computer Graphics”, Tata McGraw hill, 2nd edition.
3. Donald Hearn and M. Pauline Baker, “Computer Graphics”, second Edition, Pearson Education.

Chapter 5 Three dimensional Graphics-I Page 45 of 46


4. Foley, Vandam, Feiner, Huges, “Computer Graphics: Principles & Practice”, Second edition in C, Pearson
Education, 2005
5. Hill Jr, “Computer Graphics using openGL”, 2nd Edition, PHI
6. Neuman and Sproul, “Principles of Interactive Computer Graphics”, TMH.
7. Ranjan Parekh, “Principles of Multimedia”, Tata Mcgraw Hill,2006
8. Rogers, “Mathematical elements of Computer Graphics”, McGraw Hill.
9. Rogers, “Procedural elements of Computer Graphics”, McGraw Hill.
10. Shalini Govil, Pai, “Principles of Computer Graphics”, Springer.
11. Steven Harrington, “Computer Graphics- A Programming Approach”, Second Edition, Mcgraw Hill
International
12. Zhigand xiang, Roy Plastock, “Computer Graphics Second edition”, Schaum’s outlines, Tata McGraw Hill
edition.

Chapter 5 Three dimensional Graphics-I Page 46 of 46

View publication stats

Das könnte Ihnen auch gefallen