You are on page 1of 21

DHANALAKSHMI COLLEGE OF ENGINEERING,

CHENNAI

Department of Computer Science and Engineering

CS6504-COMPUTER GRAPHICS

Anna University 2 & 16 Mark Questions & Answers

Year / Semester: III / V


Regulation: 2013

Academic year: 2017 - 2018


PART – A (Unit – III)

1. Differentiate parallel projection from perspective projection. [M/J-16]


Perspective projection is seeing things larger when they’re up close and smaller at a distance. It is a
three-dimensional projection of objects on a two-dimensional medium such as paper. It allows an
artist to produce a visual reproduction of an object which resembles the real one.

Parallel projection, on the other hand, resembles seeing objects which are located far from the viewer
through a telescope. It works by making light rays entering the eyes parallel, thus, doing away with
the effect of depth in the drawing. Objects produced using parallel projection do not appear larger
when they are near or smaller when they are far. It is very useful in architecture.

2. What is the need for space partitioning representations? [M/J-16]


In geometry, space partitioning is the process of dividing a space (usually a Euclidean space) into two
or more disjoint subsets (see also partition of a set). In other words, space partitioning divides a space
into non-overlapping regions. Any point in the space can then be identified to lie in exactly one of the
regions.
Space-partitioning systems are often hierarchical, meaning that a space (or a region of space) is
divided into several regions, and then the same space-partitioning system is recursively applied to
each of the regions thus created. The regions can be organized into a tree, called a space-partitioning
tree.

3. What are blobby objects? Give two examples. [N/D-16]


Some objects do not maintain a fixed shape, but change their surface characteristics in certain
motions or when in proximity to other objects. That is known as blobby objects. Example – molecular
structures, water droplets.

4. State the applications of Bezier splines. [N/D-16]


Bézier curves are widely used in computer graphics to model smooth curves. As the curve is
completely contained in the convex hull of its control points, the points can be graphically displayed
and used to manipulate the curve intuitively. Affine transformations such as translation and rotation
can be applied on the curve by applying the respective transform on the control points of the curve.

5. Represent the parametric representation of a cubic Bezier curve. [N/D – 15]

Where n is the polynomial degree, i is the index, and t is the variable.

The simplest Bézier curve is the straight line from the point P0 to P1

. A quadratic Bezier curve is determined by three control points. A cubic Bezier curve is

determined by four control points.


6. Define projection plane and centre of projection. [N/D – 15]

Projection rays (projectors) emanate from a Center of Projection (COP) and intersect Projection Plane
(PP). The COP for parallel projectors is at infinity. The length of a line on the projection plane is the
same as the "true Length".

(Unit – III – Part B)

1. (a) Write notes on:


i) Quadric surfaces (8) [M/J-16]

A second-order algebraic surface given by the general equation

(1)

Quadratic surfaces are also called quadrics, and there are 17 standard-form types. A quadratic
surface intersects every plane in a (proper or degenerate) conic section. In addition, the cone
consisting of all tangents from a fixed point to a quadratic surface cuts every plane in a conic
section, and the points of contact of this cone with the surface form a conic section.

ii) Polygon surfaces (8) [M/J-16]

It is the most common representation for 3D graphics objects. 3D object is represented by the set
of surfaces which enclose an object interior. Set of polygons are stored for an object description.
This simplifies & speeds up surface rendering and display of the object since all surfaces can be
described with linear equations.
The realistic scenes are produced by interpolating shading patterns across polygon surface to let
illuminate.

Polygon Table:

A polygon surface is specified with set of vertex coordinates & associated attribute parameters. A
convenient organization for storing geometric data is to create three lists:

 A vertex table
 An edge table
 A polygon surface table.

− Vertex table stores coordinates of each vertex in an object.

− An edge table stores Edge information of each edge of polygon face.

− A polygon surface table stores surface information for each

Consider surface contains polygonal facets as shown in the figure:

S1 and S2 are 2 polygon surfaces which represent boundary of some 3D object. For storing geometric
data, we can use following three table:

S1 and S2 are 2 polygon surfaces which represent boundary of some 3D object. For storing
geometric data.

(b) Explain a method to rotate an object an axis that is not parallel to the coordinate Axis
with a neat block diagram and derive the transformation matrix for the same.(16)[M/J-16]
X-Axis Rotation

X-axis rotation looks like Z-axis rotation if replace:

X axis with Y axis


Y axis with Z axis
Z axis with X axis

So we do the same replacement in the equations:

y' = y*cos q - z*sin q


z' = y*sin q + z*cos q
x' = x

(1 0 0 0)
Rx(q) = (0 cos q sin q 0)
(0 -sin q cos q 0)
(0 0 0 1)

Y-Axis Rotation

Y-axis rotation looks like Z-axis rotation if replace:

X axis with Z axis


Y axis with X axis
Zaxis with Y axis
So we do the same replacement in equations :

z' = z*cos q - x*sin q


x' = z*sin q + x*cos q
y' = y

(cos q 0 -sin q 0)
Ry(q) = (0 1 0 0)
(sin q 0 cos q 0)
(0 0 0 1)

Rotation about an Arbitrary Axis

This is similar to 2D rotation about an arbitrary point. The general procedure is as follows:

1. Perform transformations which align rotation axis with one of coordinate axis (x, y, z)
2. Perform rotation about the axis
3. Do inverse of (1)

Special case: The rotation axis is parallel to a principle coordinate axis. This is directly analogous to the
2D case of rotation about a point. The steps are:

1. Translate rotation axis to coordinate axis


2. Perform rotation
3. Do inverse translation
In the general case, rotation about an arbitrary axis is more complicated. First we must define the axis of
Rotation by 2 points - P1, P2 then do the following:

1. Translate so that rotation axis passes through origin.


2. Rotate so that the rotation axis is aligned with one of the principle coordinate axes.
3. Perform rotation of object about coordinate axis.
4. Perform inverse rotation of 2.
5.Perform iInverse translation of 1.

2. (a) (i) Discuss about 3Dimensional display methods. (7)[N/D-16]


To obtain display of a three-dimensional scene that has been modeled in world
coordinates. we must first set up a coordinate reference for the "camera". This
coordinate reference defines the position and orientation for the plane of the carnera
film which is the plane we want to us to display a view of the objects in the scene.
Object descriptions are then transferred to the camera reference coordinates and
projected onto the selected display plane. We can then display the objects in wireframe
(outline) form, or we can apply lighting surface rendering techniques to shade the
visible surfaces.

PARALLEL PROJECTION
In a parallel projection, parallel lines in the world-coordinate scene projected into
parallel lines on the two-dimensional display plane.

Perspective Projection
Another method for generating a view of a three-dimensional scene is to project points
to the display plane along converging paths. This causes objects farther from the
viewing position to be displayed smaller than objects of the same size that are nearer to
the viewing position.In a perspective projection, parallel lines in a scene that are not
parallel to the display plane are projected into converging lines

DEPTH CUEING
A simple method for indicating depth with wireframe displays is to vary the intensity of
objects according to their distance from the viewing position. The viewing position are
displayed with the highest intensities, and lines farther away are displayed with
decreasing intensities.

Visible Line and Surface Identification


We can also clarify depth relation ships in a wireframe display by identifying visible
lines in some way. The simplest method is to highlight the visible lines or to display
them in a different color. Another technique, commonly used for engineering drawings,
is to display the nonvisible lines as dashed lines. Another approach is to simply remove
the nonvisible lines

Surface Rendering
Added realism is attained in displays by setting the surface intensity of objects
according to the lighting conditions in the scene and according to assigned surface
characteristics. Lighting specifications include the intensity and positions of light
sources and the general background illumination required for a scene. Surface properties
of objects include degree of transparency and how rough or smooth the surfaces are to
be. Procedures can then be applied to generate the correct illumination and shadow
regions for the scene.

Exploded and Cutaway View


Exploded and cutaway views of such objects can then be used to show the internal
structure and relationship of the object Parts

Three-Dimensional and Stereoscopic View


Three-dimensional views can be obtained by reflecting a raster image from a vibrating
flexible mirror. The vibrations of the mirror are synchronized with the display of the
scene on the CRT. As the mirror vibrates, the focal length varies so that each point in
the scene is projected to a position corresponding to its depth.

Stereoscopic devices present two views of a scene: one for the left eye and the other for
the right eye.

(ii) Explain in detail about quadratic surfaces. (5) [N/D-16]

QUADRIC SURFACES
A frequently used class of objects is the quadric surfaces, which are described with second -
degree equations (quadratics). They include spheres, ellipsoids, tori, paraboloids, and
hyperboloids. Quadric surfaces, particularly spheres and ellipsoids, are common elements of
graphics scenes, and they are often available in graphics packages as primitives from which more
complex objects can be constructed.

Sphere
In Cartesian coordinates, a spherical surface with radius r centered on the coordinate origin is
defined as the set of points (x, y, z) that satisfy the equation

We can also describe the spherical surface in parametric form, using latitude and longitude
angles Figure below:

The parametric representation in Equ. Below provide a symmetric range for the angular
parameters and alternatively, we could write the parametric equations using standard
spherical coordinates, where angle is specified as the colatitudes fig. below. Then is defined
over the range , and is often taken in the range . We could also set up the
representation using parameters u and v defined over the range from 0 to 1 by substituting
and .

Ellipsoid
An ellipsoidal surface can be described as an extension of a spherical surface where the radii in
three mutually perpendicular directions can have different values fig. below. The Cartesian
representation for points over the surface of an ellipsoid centered on the origin is
And a parametric representation for the ellipsoid in terms of the latitude angle and the
longitude angle in fig. below

3. Brief on polygon Meshes. (4) [N/D-16]

A polygon mesh is the collection of edges, vertices & polygons connected such that each edge is shared
by at most 2 polygons. An edge connects 2 vertices & polygon is closed sequence of edges. An edge can
be shared by 2 polygons & a vertex is shared by at least 2 edges.

When object surfaces are to be tiled, it is more convenient to specify surface face with mesh function.
One type of polygon mesh is triangle strip. This function produce n-2 connected triangles.

Another similar function is quadrilateral mesh, which generates mesh of (n-1) by (m-1) quadrilaterals,
given coordinates for an m * n array of vertices.

If surface of 3D object is planer, it is comfortable to represent surface with a meshes.

(b) (i) Derive the 3d transformation matrix for rotation about (6) [N/D-16]

(1) an arbitrary axis


(2) an arbitrary plane

This is similar to 2D rotation about an arbitrary point. The general procedure is as follows:
1. Perform transformations which align rotation axis with one of coordinate axis (x, y, z)
2. Perform rotation about the axis
3. Do inverse of (1)

Special case: The rotation axis is parallel to a principle coordinate axis. This is directly analogous to the
2D case of rotation about a point. The steps are:

1. Translate rotation axis to coordinate axis


2. Perform rotation
3. Do inverse translation

In the general case, rotation about an arbitrary axis is more complicated. First we must define the axis of
Rotation by 2 points - P1, P2 then do the following:

1. Translate so that rotation axis passes through origin.


2. Rotate so that the rotation axis is aligned with one of the principle coordinate axes.
3. Perform rotation of object about coordinate axis.
4. Perform inverse rotation of 2.
5.Perform iInverse translation of 1.

We will arbitrarily choose the Z axis to map the rotation axis onto. The rotation axis is defined by 2
points: P1(x1,y1,z1) and P2(x2,y2,z2.). These 2 points define a vector:
V = (x2 - x1 , y2 - y1 , z2 - z1) = (dx, dy, dz)

4. Write short notes about viewing coordinates. (5) [N/D-16]

In a 3-D coordinate system the X axis generally points from left to right, and the Y axis generally points
from bottom to top. ( Although some windowing systems will have their Y coordinates going from top
to bottom. )

When we add the third coordinate, Z, we have a choice as to whether the Z-axis points into the screen or
out of the screen:
Right Hand Coordinate System (RHS)
Z is coming out of the page

Counterclockwise rotations are positive


if we rotate about the X axis : the rotation Y->Z is positive
if we rotate about the Y axis : the rotation Z->X is positive
if we rotate about the Z axis : the rotation X->Y is positive

Left Hand Coordinate System (LHS)


Z is going into the page

Clockwise rotations are positive


if we rotate about the X axis : the rotation Y->Z is positive
if we rotate about the Y axis : the rotation Z->X is positive
if we rotate about the Z axis : the rotation X->Y is positive

so basically its the same thing ...

The important thing to note is what coordinate system is being used by the package you are working
with, both for the creation of models and the displaying of them. Also note that if the two packages use
different coordinate systems, then the model(s) may need to be inverted in some fashion when they are
loaded in for viewing.

OpenGL generally uses a right-hand coordinate system.

Multiple Coordinate Systems in a Graphics Program

In a typical graphics program, we may need to deal with a number of different coordinate systems, and a
good part of the work ( and the cause of many headaches ) is the conversion of coordinates from one
system to another. We'll learn about the conversion process a little later, but in the meantime, here is a
list of some of the coordinate systems you may encounter:

 World Coordinate System - Also known as the "universe" or sometimes "model" coordinate
system. This is the base reference system for the overall model, ( generally in 3D ), to which all
other model coordinates relate.
 Object Coordinate System - When each object is created in a modelling program, the modeller
must pick some point to be the origin of that particular object, and the orientation of the object to
a set of model axes. For example when modelling a desk, the modeller might choose a point in
the center of the desk top for the origin, or the point in the center of the desk at floor level, or the
bottom of one of the legs of the desk. When this object is moved to a point in the world
coordinate system, it is really the origin of the object ( in object coordinate system ) that is
moved to the new world coordinates, and all other points in the model are moved by an equal
amount. Note that while the origin of the object model is usually somewhere on the model itself,
it does not have to be. For example, the origin of a doughnut or a tire might be in the vacant
space in the middle.
 Hierarchical Coordinate Systems - Sometimes objects in a scene are arranged in a hierarchy, so
that the "position" of one object in the hierarchy is relative to its parent in the hierarchy scheme,
rather than to the world coordinate system. For example, a hand may be positioned relative to an
arm, and the arm relative to the torso. When the arm moves, the hand moves with it, and when
the torso moves, all three objects move together.
 Viewpoint Coordinate System - Also known as the "camera" coordinate system. This coordinate
system is based upon the viewpoint of the observer, and changes as they change their view.
Moving an object "forward" in this coordinate system moves it along the direction that the
viewer happens to be looking at the time.
 Model Window Coordinate System - Not to be confused with desktop windowing systems ( MS
Windows or X Windows ), this coordinate system refers to the subset of the overall model world
that is to be displayed on the screen. Depending on the viewing parameters selected, the model
window may be rectalinear or a distorted viewing frustrum of some kind.
 Screen Coordinate System - This 2D coordinate system refers to the physical coordinates of the
pixels on the computer screen, based on current screen resolution. ( E.g. 1024x768 )
 Viewport Coordinate System - This coordinate system refers to a subset of the screen space
where the model window is to be displayed. Typically the viewport will occupy the entire screen
window, or even the entire screen, but it is also possible to set up multiple smaller viewports
within a single screen window.

5. i) Differentiate parallel projection and perspective projection in detail.(5) [N/D-16]

Parallel Projection

Parallel projection discards z-coordinate and parallel lines from each vertex on the object are extended
until they intersect the view plane. In parallel projection, we specify a direction of projection instead of
center of projection.

In parallel projection, the distance from the center of projection to project plane is infinite. In this type of
projection, we connect the projected vertices by line segments which correspond to connections on the
original object.

Parallel projections are less realistic, but they are good for exact measurements. In this type of
projections, parallel lines remain parallel and angles are not preserved. Various types of parallel
projections are shown in the following hierarchy.

Orthographic Projection

In orthographic projection the direction of projection is normal to the projection of the plane. There are
three types of orthographic projections −

 Front Projection
 Top Projection
 Side Projection

Oblique Projection

In orthographic projection, the direction of projection is not normal to the projection of plane. In oblique
projection, we can view the object better than orthographic projection.

There are two types of oblique projections − Cavalier and Cabinet. The Cavalier projection makes 45°
angle with the projection plane. The projection of a line perpendicular to the view plane has the same
length as the line itself in Cavalier projection. In a cavalier projection, the foreshortening factors for all
three principal directions are equal.

The Cabinet projection makes 63.4° angle with the projection plane. In Cabinet projection, lines
perpendicular to the viewing surface are projected at ½ their actual length. Both the projections are
shown in the following figure −
Isometric Projections

Orthographic projections that show more than one side of an object are called axonometric orthographic
projections. The most common axonometric projection is an isometric projection where the projection
plane intersects each coordinate axis in the model coordinate system at an equal distance. In this
projection parallelism of lines are preserved but angles are not preserved. The following figure shows
isometric projection −

Perspective Projection

In perspective projection, the distance from the center of projection to project plane is finite and the size
of the object varies inversely with distance which looks more realistic.

The distance and angles are not preserved and parallel lines do not remain parallel. Instead, they all
converge at a single point called center of projection or projection reference point. There are 3 types of
perspective projections which are shown in the following chart.

 One point perspective projection is simple to draw.


 Two point perspective projection gives better impression of depth.
 Three point perspective projection is most difficult to draw.

The following figure shows all the three types of perspective projection −
6. (a) (i) Derive the parametric equation for a cubic Bezier curve. (8) [N/D – 15]

There are three equivalent methods for specifying a particular spline representation: (1) We van state the
set of boundary conditions that are imposed on the spline; or (2) we can state the matrix that
characterizes the spline; or (3) we can state the set of blending functions (or basis functions) that
determine how specified geometric constraints on the curve are calculate positions along the curve path.
To illustrate these three equivalent specifications, suppose we have the following parametric cubic
polynomial representation for the x coordinate along the path of a cubic spline section:

Bezier curve is discovered by the French engineer Pierre Bézier. These curves can be generated under
the control of other points. Approximate tangents by using control points are used to generate curve. The
Bezier curve can be represented mathematically as −

∑k=0nPiBni(t)

Where pi is the set of points and Bni(t)

represents the Bernstein polynomials which are given by −

Bni(t)=(ni)(1−t)n−iti

Where n is the polynomial degree, i is the index, and t is the variable.

The simplest Bézier curve is the straight line from the point P0 to P1

. A quadratic Bezier curve is determined by three control points. A cubic Bezier curve is determined by
four control points.
Properties of Bezier Curves

Bezier curves have the following properties −

 They generally follow the shape of the control polygon, which consists of the segments joining
the control points.
 They always pass through the first and last control points.
 They are contained in the convex hull of their defining control points.
 The degree of the polynomial defining the curve segment is one less that the number of defining
polygon point. Therefore, for 4 control points, the degree of the polynomial is 3, i.e. cubic
polynomial.
 A Bezier curve generally follows the shape of the defining polygon.
 The direction of the tangent vector at the end points is same as that of the vector determined by
first and last segments.
 The convex hull property for a Bezier curve ensures that the polynomial smoothly follows the
control points.
 No straight line intersects a Bezier curve more times than it intersects its control polygon.
 They are invariant under an affine transformation.
 Bezier curves exhibit global control means moving a control point alters the shape of the whole
curve.
 A given Bezier curve can be subdivided at a point t=t0 into two Bezier segments which join
together at the point corresponding to the parameter value t=t0.

(ii) Compare and contrast orthographic, Axonometric and Oblique projections. (8) [N/D – 15]

Oblique Projection

In orthographic projection, the direction of projection is not normal to the projection of plane. In oblique
projection, we can view the object better than orthographic projection.

There are two types of oblique projections − Cavalier and Cabinet. The Cavalier projection makes 45°
angle with the projection plane. The projection of a line perpendicular to the view plane has the same
length as the line itself in Cavalier projection. In a cavalier projection, the foreshortening factors for all
three principal directions are equal.

The Cabinet projection makes 63.4° angle with the projection plane. In Cabinet projection, lines
perpendicular to the viewing surface are projected at ½ their actual length. Both the projections are
shown in the following figure −

Isometric Projections
Orthographic projections that show more than one side of an object are called axonometric orthographic
projections. The most common axonometric projection is an isometric projection where the projection
plane intersects each coordinate axis in the model coordinate system at an equal distance. In this
projection parallelism of lines are preserved but angles are not preserved. The following figure shows
isometric projection −

(b) (i) Write down the Back face detection algorithm. (8) [N/D – 15]

A fast & simple object space method used to remove the hidden surface from 3D object drawing is
known as "Plane equation method" & applied to each side after any rotation of an object takes place. It
is commonly known as a back-face detection of a polyhedron is based on "inside-outside" tests. A point
(x,y,z) is inside the polygon surface if

Ax + By + Cz + D < 0

We can simplify this test by considering normal vector N to polygon surface that has Cartesian
components (A,B,C)

If V is vector in viewing direction from an eye position then this polygon is back face if,

V.N>0

In equation Ax + By + Cz + D = 0, if A,B,C remains constant, then the varying value of D results in


whole family of parallel planes. One of which (D = 0) contains origin of coordinates system &,

If D > 0, plane is behind origin (Away from observer)

If D < 0, plane is in front of origin (towards observer)

If we clearly defined our object to have centred at origin, those entire surface which are
viewable will have negative D & non viewable surface have positive D.
So, simply our hidden surface removal routine defines plane corresponding to one of three dimension
surface from coordinate of three points on it & computing D , visible surface are detected.

(ii) How will you perform three dimensional rotation about any arbitrary axis in space?
(8) [N/D – 15]

Rotation of a point in 3 dimensional space by theta about an arbitrary axes defined by a line between
two points P1 = (x1,y1,z1) and P2 = (x2,y2,z2) can be achieved by the following steps

(1) translate space so that the rotation axis passes through the origin

(2) rotate space about the x axis so that the rotation axis lies in the xz plane

(3) rotate space about the y axis so that the rotation axis lies along the z axis

(4) perform the desired rotation by theta about the z axis

(5) apply the inverse of step (3)

(6) apply the inverse of step (2)

(7) apply the inverse of step (1)

Note:

 If the rotation axis is already aligned with the z axis then steps 2, 3, 5, and 6 need not be
performed.
 In all that follows a right hand coordinate system is assumed and rotations are positive when
looking down the rotation axis towards the origin.
 Symbols representing matrices will be shown in bold text.
 The inverse of the rotation matrices below are particularly straightforward since the determinant
is unity in each case.
 All rotation angles are considered positive if anticlockwise looking down the rotation axis
towards the origin.

Step 1

Translate space so that the rotation axis passes through the origin. This is accomplished by translating
space by -P1 (-x1,-y1,-z1). The translation matrix T and the inverse T-1 (required for step 7) are given
below

Step 2

Rotate space about the x axis so that the rotation axis lies in the xz plane. Let U = (a,b,c) be the unit
vector along the rotation axis. and define d = sqrt(b2 + c2) as the length of the projection onto the yz
plane. If d = 0 then the rotation axis is along the x axis and no additional rotation is necessary. Otherwise
rotate the rotation axis so that is lies in the xz plane. The rotation angle to achieve this is the angle
between the projection of rotation axis in the yz plane and the z axis. This can be calculated from the dot
product of the z component of the unit vector U and its yz projection. The sine of the angle is determine
by considering the cross product.

(0,0,c) dot (0,b,c) || (0,0,c) cross (0,b,c) ||


cos(t) = = c/d sin(t) = = b/d
cd cd

The rotation matrix Rx and the inverse Rx-1 (required for step 6) are given below

1 0 0 0 1 0 0 0
0 c/d -b/d 0 0 c/d b/d 0
Rx = Rx-1 =
0 b/d c/d 0 0 -b/d c/d 0
0 0 0 1 0 0 0 1

Step 3

Rotate space about the y axis so that the rotation axis lies along the positive z axis. Using the appropriate
dot and cross product relationships as before the cosine of the angle is d, the sine of the angle is a. The
rotation matrix about the y axis Ry and the inverse Ry-1 (required for step 5) are given below.

d 0 -a 0 d 0 a 0
0 1 0 0 0 1 0 0
Ry = Ry-1 =
a 0 d 0 -a 0 d 0
0 0 0 1 0 0 0 1

Step 4

Rotation about the z axis by t (theta) is Rz and is simply

cos(t) -sin(t) 0 0
sin(t) cos(t) 0 0
Rz =
0 0 1 0
0 0 0 1

The complete transformation to rotate a point (x,y,z) about the rotation axis to a new point (x`,y`,z`) is as
follows, the forward transforms followed by the reverse transforms.
x' x
y' y
= T-1 Rx-1 Ry-1 Rz Ry Rx T
z' z
1 1

You might also like