Beruflich Dokumente
Kultur Dokumente
net/publication/260137371
Computer Graphics
CITATIONS READS
0 6,109
2 authors:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Rajendra Kumar on 12 February 2014.
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
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
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.
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
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
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.
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 ϕ.
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)
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.
+ + =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
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
-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
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
∑ 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
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:
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.
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
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
α θ
P′ (0, y′, z′)
Z
P (0 y, z)
Fig. 5.28 Rotation about x-axis
α θ
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.
α θ
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)
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.
(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
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.
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
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
V
θi
N
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
Figure 5.40 Viewing a scene from different directions with a fixed view-reference point.
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)
Projection plane
Fig.5.43 Illustration of orthographic projection
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
(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°
L1
L2
Center of Projection
L1 L1
Y
P (x, y, z)
X
(xp, yp)
Z
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)
(4, 4)
(2, 3)
(1, 1) (6, 1)
(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
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
0 − 1 0 0
1 0 0 0
R 90,k =
0 0 1 0
0 0 0 1
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
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
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
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.