Professional Documents
Culture Documents
01725-402592
Computer graphics are pictures and movies created using computers usually referring to
image data created by a computer specifically with help from specialized graphic hardware
and software.
(i) Computer Aided Design (CAD): A major use of computer graphics is in design
processes, particularly for engineering and architectural systems, but almost all products are
now computer designed. Generally referred to as CAD, computer-aided design methods are
now routinely used in the design of buildings, automobiles, aircraft, watercraft, spacecraft,
computers, textiles, and many, many other products.
(ii) Presentation Graphics: Another major application area is presentation graphics, used to
produce illustrations for reports or to generate 35-mm slides or transparencies for use with
projectors. Presentation graphics is commonly used to summarize financial, statistical,
mathematical, scientific, and economic data for research reports, managerial reports, and
consumer information bulletins.
(iii) Computer Art: Computer graphics methods are widely used in both fine art and
commercial art applications.
(iv) Entertainment: Computer graphics methods are now commonly used in making motion
pictures, music videos, and television shows.
(vi) Visualization: Scientists, engineers, medical personnel, business analysts, and others
often need to analyze large amounts of information or to study the behavior of certain
processes.
(vii) Image Processing: In computer graphics, a computer is used to create a picture. Image
processing, on the other hand applies techniques to modify or interpret existing pictures,
such as photo graphs and TV scans.
(viii) Graphical user interface: It is common now for software packages to provide a
graphical interface. A major component of a graphical interface is a window manager that
allows a user to display multiple-window areas. Each window can contain a different process
that can contain graphical or non graphical displays.
Pixel: Each screen point is referred to as a pixel or pel. The pixel (a word invented from
"picture element") is the basic unit of programmable color on a computer display or in a
computer image. Think of it as a logical - rather than a physical - unit. The physical size of a
pixel depends on how you've set the resolution for the display screen.
Resolution: Resolution is defined as a matrix of "pixels" per inch. Screen Pixels Per Inch. A
screen resolution of 1920x1200 means 1,920 pixels horizontally across each of 1,200 lines,
which run vertically from top to bottom.
Aspect ratio: Aspect ratio is an image projection attribute that describes the proportional
relationship between the width of an image and its height. For example, if a graphic has an
aspect ratio of 2:1, it means that the width is twice as large as the height.
Persistence: Persistence mean how long the electronic beam continue emit light after the
CRT beam is removed.
The basic operation of a CRT: A beam of electrons (cathode rays) emitted by an electron
gun, passes through focusing and deflection systems that direct the beam toward specified
positions on the phosphor coated screen.
The phosphor then emits a small spot of light at each position contacted by the
electron beam. This type of display is called a refresh CRT.
The primary components of an electron gun in a CRT are the heated metal cathode
and a control grid.
The focusing system in a CRT is needed to force the electron beam to converge into a
small spot as it strikes the phosphor.
Magnetic deflection has two pairs of coils are used, with the coils in each pair
mounted on opposite sides of the neck of the CRT envelope.
Electrostatic deflection has two pairs of parallel plates are mounted inside the CRT
envelope.
Resolution: The maximum number of points that can be displayed without overlap
on a CRT is referred to as the resolution.
Frame buffer can be anywhere in the system memory & video controller access the frame
buffer to refresh the screen
Fig: Architecture of a raster system with a fixed portion of the system memory reserved for the frame
buffer.
Video controller resets the register to the first pixel position on top scan line & the refresh
process starts over.
Random scan System: Random scan monitors draw a picture one line at a time and for this
reason are also referred to as vector displays.
Q. 2012-1(c): Distinguish between Raster Scan CRT and Random Scan CRT
Mathematical functions are used to draw Screen points/pixels are used to draw an
an image. image.
Color CRT Monitors: A CRT monitor displays color pictures by using a combination of
phosphors that emit different -colored light. By combining the emitted light from the
different phosphors, a range of colors can be generated. The two basic techniques for
producing color displays with a CRT are
1. The Beam-Penetration method.
2. The Shadow-Mask method.
The Beam-Penetration method: The beam-penetration method for displaying color
pictures has been used with random-scan monitors. Two layers of phosphor, usually RED
and GREEN, are coated onto the inside of the CRT screen, and the displayed color depends
on how far the electron beam penetrates into the phosphor layers.
A beam of slow electrons excites only the outer RED layer.
A beam of very fast electrons penetrates through the RED layer and excites the inner
GREEN layer.
At intermediate beam speeds, combinations of red and green light are emitted to show two
additional colors, ORANGE and YELLOW.
Advantage:
Beam penetration has been an inexpensive way to produce color in random -scan monitors,
Disadvantage:
Only four colors are possible, and the quality of pictures is not as good as with other
methods.
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
9
Shadow mask: The shadow mask is one of the technologies used to manufacture cathode
ray tube (CRT) televisions and computer displays that produce color images. A shadow-
mask CRT has three phosphor color dots at each pixel position.
One phosphor dot emits a RED Light, another emits a GREEN light, and the third emits a
BLUE light.
Flat-panel display: Although most graphics monitors are still constructed with CRTs, other
technologies are emerging that may soon replace CRT monitors.
The term flat-panel display refers to a class of video devices that have
1. Reduced volume
2. Weight
3. Power requirements compared to a CRT.
Current uses for flat-panel displays include small TV monitors, calculators, pocket video
games, laptop computers. Flat-panel displays into two categories:
1. Emissive displays
2. Non-Emissive displays.
Emissive displays (or emitters): These devices that convert electrical energy into light.
Examples: 1. Plasma panels. 3. Light-Emitting Diodes (LED).
Non-emissive is plays (or non-emitters): These device use optical effects to convert
sunlight or light from some other source into graphics patterns. Example: Liquid-Crystal
Device (LCD).
Plasma panel display: Plasma panels also called gas-discharge displays.
These are constructed by filling the region between two glass plates with a mixture of gases
that usually includes neon.
Advantage of LCD: (i) Low power Consumption. (ii) Low cost. (iii) Small size.
Disadvantage of LCD: (i) LCD have less color capability. (ii) Resolution is not as good as
that of a CRT. (iii) LCD’s do not emit light.
LED Advantages:
1) Better black levels (most of the time).
2) Higher contrast ratios (most of the time).
3) 40% less energy use than a florescent tube back lit LCD TV.
5) LED will not lose color accuracy with age as florescent tubes do.
6) Extremely thin profile.
LCD Disadvantages
Input device: An input device is any device that provides input to a computer. Examples of
input devices include keyboards, mouse, scanners, digital cameras and joysticks.
Mouse: A device that controls the movement of the cursor or pointer on a display screen. A
mouse is a small object you can roll along a hard, flat surface. Its name is derived from its
shape, which looks a bit like a mouse.
Keyboard: External input device used to type data into some sort of computer system
whether it be a mobile device, a personal computer, or another electronic machine. A
keyboard usually includes alphabetic, numerical, and common symbols used in everyday
transcription.
There are many types of computer keyboards. For instance, multimedia computer keyboard,
membrane computer keyboard, slim computer keyboard, capacitive key switches etc.
Digitizer: Digitizer converts analog or physical input into digital image. This makes them
related to both scanners and mice, although current digitizer serve completely different role.
Scanners: A computer scanner optically scans an object such as document and data convert
the information into a digital image. The two commonly used types are: (i) Flatbed scanner
(ii) Hand-held.scanner.
Image Scanner: In computing, an image scanner is a device used to transfer images or text
into a computer. There are special models for scanning photo negatives, or to scan books. In
the computer, the signal from the scanner is transferred to a digital image.
Joystick: A joystick is an input device consisting of a stick that pivots on a base and reports
its angle or direction to the device it is controlling. A joystick, also known as the control
column.
Light pens: A light pen is a computer input device in the form of a light-sensitive wand
used in conjunction with a computer's CRT display. Light pens have the advantage of
'drawing' directly onto the screen, but this can become uncomfortable, and they are not as
accurate as digitizing tablets.
Line drawing is accomplished by calculating intermediate positions along the line path
between two specified endpoint positions. An output device is then directed to fill in these
positions between the endpoints. For analog devices, such as a vector pen plotter or a
random-scan display, a straight line can be drawn smoothly from one endpoint to the other.
Stair step effect (jaggies) produced when Fig: Pixel positions referenced by scan-line
a line is generated as a series number and column number.
Line-drawing
of pixel positions. Algorithms:
y= m. x +b
For line segment starting in (x1,y1) and ending in (x2,y2), the slop is:
m= (y1-y2)/(x1-x2)
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
12
b= y1- m.x1
For any given x interval x, we can compute the corresponding y interval y:
y= m.x
x= y/m
|m| >1, y can be set proportional to a small vertical deflection voltage with the
corresponding horizontal deflection voltage set proportional to x.
y k+1= yk+ m
Subscript k takes integer values starting from 1, for the first point, and increases by 1
until the final endpoint is reached. Since m can be any real number between 0 and 1,
the calculated y values must be rounded to the nearest integer.
For lines with a positive slope greater than 1, we reverse the roles of x and y. That is, we
sample at unit y intervals (y = 1) and calculate each succeeding x value as
x k+1= xk + (1/m)
If the absolute slop is less than 1, set x=-1 and
y k+1= yk - m
or, If the absolute slop is greater than 1, set y=-1 and
x k+1= xk - (1/m)
Bresenham’s Line Algorithm:
When sampling at unit x intervals, we need to decide which of two possible pixel
positions is closer to the line path at each sample step by using a decision parameter.
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
13
The decision parameter (pk) is an integer number that is proportional to the difference
between the separations of the two pixel positions from the actual line path.
Depending on the slop sign and value the decision parameter determine which pixel
coordinates would be taken in the next step.
Algorithm:
d1 and d2 are the vertical pixel separations from the mathematical line path.
y= (x+1.m)+b
d1= y-yk
d2= yk+1-y
We accomplish this by substituting m = y/x, where y and x are the vertical and
horizontal separations of the endpoint positions, and defining:
Pk =x(d1-d2)
=2y.xk-2x. yk+c
If the pixel at yk is closer to the line path than the pixel at yk+l (that is, d1 < d2), then decision
parameter pk is negative and we plot the lower pixel.
pk+1 = pk+2y-2x(yk+1-yk)
and p0=2y-x
1. Input the two line endpoints and store the left endpoint in (x0, y0).
2. Load (x0, y0) into the frame buffer; that is, plot the first point.
3. Calculate constants x, y, 2y, and 2y - 2x, and obtain the starting value for the
decision parameter as
P0 = 2y - X
Pk+1 = Pk + 2y
To illustrate the algorithm, we digitize the line with endpoints (20, 10) and (30,18). This line
has a slope of 0.8, with
We plot the initial point (x0, y0) = (20, 10), and determine successive pixel positions along
the line path from the decision parameter as-
A plot of the pixels generated along this line path is shown in Fig
Samples at unit intervals and uses decision parameter to determine the closest pixel
position to the specified circle path at each step.
Along the circle section from x = 0 to x = y in the first quadrant, the slope of the curve
varies from 0 to -1. Therefore, we can take unit steps in the positive x direction over
this octant and use a decision parameter to determine which of the two possible y
positions is closer to the circle path at each step. Positions in the other seven octants
are then obtained by symmetry.
or
Q. 2013-3(c)/Example 3-2: Drive successive decision values and positions along the
circle path using the midpoint method. [where r= 10 & first quadrant from x=0 to x=y]
Given a circle radius r = 10, we demonstrate the midpoint circle algorithm by determining
positions along the circle octant in the first quadrant from x = 0 to x = y. The initial value of
the decision parameter is
P0 = 1-r = -9
For the circle centered on the coordinate origin, the initial point is (x0, y0) = (0, l0), and
initial increment terms for calculating the decision parameters are-
2x0=0, 2y0=20 If (x0, y0)=(0, r)
Ellipse Properties: Expressing distances d1 and d2 in terms of the focal coordinates F1 = (x1,
y1) and F2 = (x2, y2), we have: ( x x )2 ( y y )2 ( x x )2 ( y y )2 constant
1 1 2 2
2
2
Cartesian coordinates: x xc y yc 1
rx ry
x xc rx cos
Polar coordinates:
y yc ry sin
dy 2ry2 x
Slope 2
dx 2rx y
2ry2 x 2rx2 y
Assuming that we have just plotted the pixels at (xi , yi). The next position is determined by:
p1i f ellipse ( xi 1, yi 12 )
ry2 ( xi 1)2 rx2 ( yi 12 )2 rx2 ry2
Or,
4. (x0, y0) is the last position calculated in region 1. Calculate the initial parameter in
region 2 as
p20 ry ( x0 2 ) rx ( y0 1) rx ry
2 1 2 2 2 2 2
5. At each yi position, starting at i = 0, if p2i > 0, the next point along the ellipse centered
on (0, 0) is (xi, yi – 1) and p 2 p 2 2r 2 y r 2
i 1 i x i 1 x
6. For both regions determine symmetry points in the other three quadrants.
7. Move each calculated pixel position (x, y) onto the elliptical path centered on (xc, yc)
and plot the coordinate values
x = x + xc , y = y + yc
Example: 3-3:
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
19
rx = 8 , ry = 6
2ry2x = 0 (with increment 2ry2 = 72)
2rx2y = 2rx2ry (with increment -2rx2 = -128)
Region 1: (x0, y0) = (0, 6)
2 745 (8, 0) - -
Stop at y = 0
Fig: Positions along an elliptical path centered on the origin with rx= 8 and ry= 6 using the midpoint
algorithm to calculate pixel addresses in the first quadrant.
Chapter: 05
Basic transformations: Basic transformations such as translation, rotation, and scaling are
included in most graphics packages. Some packages provide a few additional
transformations that are useful in certain applications. Two such transformations are
reflection and shear.
2D Transformations: “Transformations are the operations applied to geometrical
description of an object to change its position, orientation, or sizes are called geometric
transformations”.
Why Transformations?
“Transformations are needed to manipulate the initially created object and to display the
modified object without having to redraw it.”
Q.2013-5(b): What do you mean by Translation and Rotation in geometric
transformations?
Translation: A translation moves all points in an object along the same straight-line path to
new positions.
P' = P + T
Figure 5-3 Rotation of an object through angle about the pivot point (x1, y1).
Scaling: Scaling changes the size of an object and involves two scale factors, S x and Sy for
the x- and y-coordinates respectively.
• Scales are about the origin.
• We can write the components:
p'x = sx • px
p'y = sy • py
or in matrix form:
P' = S • P
Scale matrix as: sx 0
S
0 s y
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
22
General fixed point scaling: Translate object so that the fixed point coincides with the
coordinate origin. Scale the object with respect to the coordinate origin.
is called a two-dimensional affine transformation. Each of the transformed coordinates x' and
y' is a linear function of the original coordinates x and y, and parameters aij and bk are
constants determined by the transformation type. Affine transformations have the general
properties that parallel lines are transformed into parallel lines and finite points map to finite
points.
Translation, rotation, scaling, reflection, and shear are examples of two-dimensional affine
transformations.
Chapter: 06
Clipping: Identify those portions of a picture that are either inside or outside of a specified
region of space. The region against which an object is to clipped is called a clip window.
In the following sections, we consider algorithms for clipping the following primitive types-
Point Clipping
Line Clipping (straight-line segments)
Area Clipping (polygons)
Curve Clipping
Text Clipping
Point Clipping: Assuming that the clip window is a rectangle in standard position, we save
a point P = (x, y) for display if the following inequalities are satisfied:
xwmin ≤ x ≤ xwmax
ywmin ≤ y ≤ ywmax
Where the edges of the clip window (xwmin, xwmax, ywmin, ywmax) can be either the world-
coordinate window boundaries or viewport boundaries. If any one of these four inequalities
is not satisfied, the point is clipped (not saved for display)
Line Clipping: Possible relationships between line positions and a standard rectangular
clipping region
Curve Clipping: Use bounding rectangle to test for overlap with a rectangular clip window.
Curve clipping procedures will involve non-linear equations (so requires more processing
than for objects with linear boundaries).
Text Clipping: There are several techniques that can be used to provide text clipping in a
graphics package. The clipping technique used will depend on the methods used to generate
characters and the requirements of a particular application. Methods for processing
character strings relative to a window boundary
• All-or-none string clipping strategy
• All or none character clipping strategy
• Clip the components of individual characters
Chapter: 10
Q. 2012-8(i): Write the short note of following terms-
Bézier curve: A Bézier curve is a parametric curve frequently used in computer graphics
and related fields.
In general, a Bezier curve section can be fitted to any number of control points. The number
of control points to be approximated and their relative position determine the degree of the
Bézier polynomial.
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
29
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.
The Bezier blending function BEZ k,n(u), are the Bernstein polynomials:
C(n,k) =
Equivalently, we can define Bezier blending functions with the recursive calculation
with BEZ k,k = uk, and BEZ0,k = (1- u)k. Vector equation represents a set of three parametric
equations for the individual curve coordinates.
Variation diminishing property: No straight line intersects a Bézier curve more times than
it intersects its control polygon.
=1
The contrex-hull property for a Bezier curve ensures that the polynomial smoothly follows
the control points without erratic oscillations.
Bézier Surface: Two sets of orthogonal Bézier curves can be used to design an object
surface by specifying by an input mesh of control points. The parametric vector function for
the Bkzier surface is formed as the Cartesian product of Bezier blending functions:
Figure 10-39 illustrates two Bezier surface plots. The control points are connected by dashed
lines, and the solid lines show curves of constant u and constant v.
Figure 10-39: Bezier surfaces constructed tor (a) m = 3, n = 3, and (b) m = 4, n = 4. Dashed
lines connect the control points.
B-Spline Curve and Surfaces: These are the most widely used class of approximating
splines. B-splines have two advantages over Bezier splines: (1) the degree of a B-spline
polynomial can be set independently of the number of control points (with certain
limitations), and (2) B-splines allow local control over the shape of a spline curve or surface
The trade-off is that B-splines are more complex than Bezier splines.
We can write a general expression for the calculation of coordinate positions along a B-
spline curve in a blending-function formulation as-
Where the pk are an input set of n + 1 control points. There are several differences between
this B-spline formulation and that for Bezier splines.
Blending functions for B-spline curves are defined by the Cox-deBoor recursion formulas:
1 if uk u < uk+1
Bk,1 (u) =
0 Otherwise
Fig: Local modification of a B-spline curve. Changing one of the control points in (a) produces curve (b),
which is modified only in the neighborhood of the altered control point .
u2 for 0 u 1
for 2 u 3
(3-u)2
We obtain the next periodic blending function using relationship 10-57. Substituting u-1 for
u in B0,3, and shifting the starting positions up by 1:
(u-1)2 for 1 u 2
(4-u)2 for 3 u 4
Similarly, the remaining two periodic function are by successively shifting B1,3 to the right.
(u-2)2 , for 2 u 3
(5-u)2,
for 4 u 5
Chapter: 11
In 2-D, a rotation is prescribed by an angle θ & a center of rotation P. But in 3-D rotations
require the prescription of an angle of rotation & an axis of rotation.
1 0 0
R θ,I = 0 cos θ -sin θ
0 sin θ cos θ
Scaling:
Changing the size of an object is called Scaling. The scale factor s determines whether
the scaling is a magnification, s > 1,Or a reduction, s < 1. Scaling with respect to the origin,
where the origin remains fixed,
x’ = x . sx
Ssx,sy,sz y’ = y . sy
z’ = z . sz
The transformation equations can be written in the matrix form:
x’ sx 0 0 x
y’ = 0 sy 0 . y
z’ 0 0 sz z
Chapter: 12
Viewing pipeline: The viewing pipeline is a group of processes common from wireframe
display through to near photo-realistic image generation, and is basically concerned with
transforming objects to be displayed from specific viewpoint and removing surfaces that
cannot be seen from this viewpoint.
World co-ordinate system: In our world co-ordinate system, we need to specify a view
reference point - this will become the origin of the view co-ordinate system.
Finally we need to specify the view-up direction, V - this will give the y-axis direction
Parallel Projections: Coordinate Positions are transformed to the view plane along parallel
lines.
• Oblique parallel projecion: The parallel projection is not perpendicular to the view
plane.
Perspective projection: Perspective projection transforms object positions to the view plane
while converging to a center point of projection.
Perspective projection produces realistic views but does not preserve relative proportions.
Projections of distant objects are smaller than the projections of objects of the same size that
are closer to the projection plane.
Figure: At view-plane position (x, y), surface S, has the smallest depth from the view plane
and so is visible at that position.
• For any scan line adjacent horizontal x positions or vertical y positions differ by 1 unit.
• The depth value of the next position (x+1,y) on the scan line can be obtained using
A( x 1) By D
z
C
A
z
C
• For adjacent scan-lines we can compute the x value using the slope of the projected
line and the previous x value.
1
x x
m
A/ m B
z z
C
A-buffer method: An extension of the ideas in the depth-buffer method is the A-buffer
method (at the other end of the alphabet from "z-buffer", where z represents depth). The A-
buffer method represents an antaliased, area-averaged, accumulation-buffer method
developed by Lucas film for implementation in the surface-rendering system called REYES.
A drawback of the depth-buffer method is that it can only find one visible surface at each
pixel position. Each position in the A-buffer has two fields:
If depth is >= 0, then the surface data field stores the depth of that pixel position as before
If depth < 0 then the data filed stores a pointer to a linked list of surface data
Surface information in the A-buffer includes:
– RGB intensity components
– Opacity parameter
– Depth
– Percent of area coverage
– Surface identifier
– Other surface rendering parameters
Depth-sorting method: Using both image-space and object-space operations, the depth-
sorting method performs the following basic functions:
1. Surfaces are sorted in order of decreasing depth.
2. Surfaces are scan converted in order, starting with the surface of greatest depth.
Q. 2013-8(b): Define BSP tree and Octree.
BSP tree: A binary space-partitioning (BSP) tree is an efficient method for determining
object visibility by painting surfaces onto the screen from back to front, as in the painter's
algorithm.
BSP-Tree Method: When BSP tree is complete, process the tree from the right nodes to the
left nodes
Octree: An octree is a tree in which each node has at most 8 children. When an octree
representation is used for the viewing volume, hidden surface elimination is accomplished by
projecting octree nodes onto the viewing surface in a front-to-back order.
We know from before that a point (x, y, z) is behind a polygon surface if:
Ax By Cz D 0
Where A, B, C & D are the plane parameters for the surface
This can actually be made even easier if we organise things to suit ourselves
Now we can simply say that if the z component of the polygon’s normal is less than zero the
surface cannot be seen