0% found this document useful (0 votes)
97 views

What Is Computer Graphics?

This document provides an overview of computer graphics. It discusses what computer graphics are, their importance, and their evolution. It then describes some common applications of computer graphics like movies, video games, scientific modeling, and design. Finally, it explains some specific computer graphics algorithms and concepts like line drawing, the digital differential analyzer, Bresenham's algorithm, properties and algorithms for drawing circles, cell arrays, and boundary fill algorithms.

Uploaded by

Abdur Rahim
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

What Is Computer Graphics?

This document provides an overview of computer graphics. It discusses what computer graphics are, their importance, and their evolution. It then describes some common applications of computer graphics like movies, video games, scientific modeling, and design. Finally, it explains some specific computer graphics algorithms and concepts like line drawing, the digital differential analyzer, Bresenham's algorithm, properties and algorithms for drawing circles, cell arrays, and boundary fill algorithms.

Uploaded by

Abdur Rahim
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Computer Graphics

Chapter 1
1. What is computer graphics?
Ans: Computer graphics means drawing pictures on a computer screen. Computer graphics are
pictures and films created using computers. Usually, the term refers to computer-generated image
data created with help from specialized graphical hardware and software. It is a vast and recent area
in computer science.

2. Importance of computer graphics.


Ans:
 Computer graphics has many applications in the entertainment industry, most importantly
video games and visual effects in movie production.
 In medicine, computer graphics is used to visualize data obtained from medical imaging, such
as CT scans.
 Computer-aided design relies on computer graphics for modelling and visualizing products,
buildings, cars, etc.
 The same modelling techniques are used for creating 3D-printed objects.
 Digital design for printed media and web makes use of 2D computer graphics.
 D and 3D computer graphics are used by television broadcasters for

3. Evolution of computer graphics.


Ans: http://deseng.ryerson.ca/dokuwiki/mec222:brief_history_of_computer_graphics
I hope you are understand, why I can't give this answer.

4. Some application of computer graphics.


Ans: Computer-generated imagery is used for movie making, video game and computer program
development, scientific modeling, and design for catalogs and other commercial art. Some people
even make computer graphics as art. We can classify applications of computer graphics into four
main areas:
1. Display of information
2. Design
3. User interfaces
4. Simulation
According to these four areas there are several types of applications which are used in today’s world.
These are:
 Computational Biology  Video Games
 Computational Physics  Virtual Reality
 Information of Graphics  Computer Simulation
 Scientific Visualization  Education
 Graphic Design  Information Visualization
 Computer-aided Design  Digital Art
 Web Design
5. Short note:
i. Computer aided design (CAD)
Ans: 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 other products.

ii. Presentation graphics


Ans: 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, consumer information bulletins, and
other types of reports) Workstation devices and service bureaus exist for converting screen
displays into 35-mm slides or overhead transparencies for use in presentations/Typical
examples of presentation graphics are bar charts, line graphs, surface graphs, pie charts, and
other displays showing relationships between multiple parameters

iii. Computer art.


Ans: Computer graphics methods are widely used in both fine art and commercial art
applications. Artists use a variety of computer methods, including special-purpose hardware,
artist's paintbrush programs (such as Lumena), other paint packages (such as PixelPaint and
SuperPaint), specially developed software, symbolic mathematics packages (such as
Mathematica), CAD packages, desktop publishing software, and animation packages that
provide facilities for designing object shapes and specifying object motions.
Chapter- 3
Line drawing algorithm: The Cartesian slope-intercept equation for a straight line is
y=m• x +b ---------------- (3-1)
With m representing the slope of the line and b as the y intercept. Given that the two endpoints of a
line segment are specified at positions (x1, y1) and (x2, y2), as shown in Fig. 3-3, we can determine
values for the slope m and y intercept b with the following calculations:

Algorithms for displaying straight lines are based on the line equation 3-1 and the calculations given in Eqs.
3-2 and 3-3. For any given x interval ∆x along a line, we can compute the corresponding y interval ∆y from
Eq. 3-2 as

Similarly, we can obtain the x interval ∆x corresponding to a specified ∆y as

These equations form the basis for determining deflection voltages in analog devices.

Digital differential analyzer (DDA): The digital differential analyzer (DDA) is a scan-conversion line
algorithm based on calculating either ∆y or ∆x, using Eq. 3-4 or Eq. 3-5. We sample the line at unit intervals
in one coordinate and determine corresponding integer values nearest the line path for the other coordinate.
Consider first a line with positive slope, as shown in Fig. 3-3. If the slope is less than or equal to 1, we
sample at unit x intervals (∆x = 1) and compute each successive y value as

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 unity intervals (∆y = 1) and calculate each succeeding x value as

Equations 3-6 and 3-7 are based on the assumption that lines are to be processed from the left endpoint to
the right endpoint (Fig. 3-3).
Bresenham's algorithm for |M|<1:
(a) Input the two line endpoints and store the left endpoint in (x0, y0).
(b) Load (x0, y0) into the frame buffer; that is, plot the first point.
(c) Calculate constants ∆x, ∆y, 2∆y and 2∆y - 2∆x, and obtain the starting value for the decision
parameter as

(d) At each xk along the line, starting at k = 0, perform the following test: If p k < 0, the next point
to plot is (xk + 1, yk) and

Otherwise, the next point to plot is (xk + 1, yk + 1) and

(e) Repeat step 4 Lx times.

Circle: - The circle is a frequently used component in pictures and graphs, a procedure for generating either
full circles or circular arcs is included in most graphics packages. More generally, a single procedure can be
provided to display either circular or elliptical curves.

Cell Array: - The cell array is a primitive that allows users to display an arbitrary shape defined by as a
two-dimensional grid pattern. A predefined matrix of color values is mapped by this function onto a
specified rectangular coordinate region. The PHIGS version of this function is
cellArray (wcPoints, n, m, colorArray)
Properties of circle:
(a) Circles having equal radii are congruent.
(b) Circles having different radii are similar.
(c) The central angle which intercepts an arc is the double of any inscribed angle that intercepts the same
arc (proof).
(d) The radius perpendicular to a chord bisects the chord.
(e) The chords equidistant from the center are equal in length.
(f) A tangent to a circle is at a right angle to the radius at the point of contact.
(g) Two tangents drawn on a circle from a point outside are equal in length.
(h) The angle subtended at the center of a circle by its circumference is equal to four right angles.
(i) The circumference of two different circles is proportional to their corresponding radii.
(j) Arcs of the same circle are proportional to their corresponding angles.
(k) Radii of the same circle or equal circles are equal.
(l) Equal chords have equal circumferences.
(m)The diameter of a circle is the longest chord.
(n) Equal circles have equal circumferences.
Mid-point circle algorithm:
(a) Input radius r and circle center (xc, yc), and obtain the first point on the circumference of a circle
centered on the origin as
(x0, y0) = (0, r)
(b) Calculate the initial value of the decision parameter as

(c) At each xk position, starting at k = 0, perform the following test: If P k < 0, the next point along the
circle centered on (0, 0) is (xk+1, yk) and

Otherwise, the next point along the circle is (xk + 1, yk - 1) and

where 2xk+1 = 2xk + 2 and 2yk+1 = 2yk - 2.


(d) Determine symmetry points in the other seven octants.
(e) Move each calculated pixel position (x, y) onto the circular path centered on (x c, yc) and plot the
coordinate values:
x = x + xc , y = y + yc
(f) Repeat steps 3 through 5 until x ≥ y.
Boundary fil algorithm:
Another approach to area filling is to start at a point inside a region and paint the interior outward toward the
boundary. If the boundary is specified in a single color, the fill algorithm proceeds outward pixel by pixel
until the boundary color is encountered. This method, called the boundary-fill algorithm, is particularly
useful in interactive painting packages, where interior points are easily selected.

A boundary-fill procedure accepts as input the coordinates of an interior point (x, y), a fill color, and a
boundary color. Starting from (x, y), the procedure tests neighboring positions to determine whether they are
of the boundary color. If not, they are painted with the fill color, and their neighbors are tested. This process
continues until all pixels up to the boundary color for the area have been tested. Both inner and outer
boundaries can be set up to specify an area, and some examples of defining regions for boundary fill are
shown in figure.

Figure shows two methods for proceeding to neighboring pixels from the current test position. In Figure four
neighboring points are tested. These are the pixel positions that are right, left, above, and below the current
pixel. Areas filled by this method are called 4-connected. The second method, shown in Fig. 3-43(b), is used
to fill more complex figures. Here the set of neighboring positions to be tested includes the four diagonal
pixels. Fill methods using this approach are called 8-connected.

Four connected with figure: In figure four neighboring points are tested. These are the pixel positions that
are right, left, above, and below the current pixel. Areas filled by this method are called 4-connected.

Eight connected with figure: Shown in figure is used to fill more complex figures. Here the set of
neighboring positions to be tested includes the four diagonal pixels. Fill methods using this approach are
called 8-connected.
Chapter- 5
Transformation: Transformations are one of the primary vehicles used in computer graphics to manipulate
objects in three-dimensional space. Their development is motivated by the process of converting coordinates
between frames, which results in the generation of a 4 x 4 matrix. We can generalize this process and
develop matrices that implement various transformations in space.

A translation is applied to an object by repositioning it along a straight-line path from one coordinate
location to another. We translate a two-dimensional point by adding translation distances, t x and ty, to the
original coordinate position (x, y) to move the point to a new position (x', y') (Fig. 5-1).
x' = x + tx, y' = y + ty ( 5 - 1)
The translation distance pair (tx,ty) is called a translation vector or shift vector. We can express the
translation equations 5-1 as a single matrix equation by using column vectors to represent coordinate
positions and the translation vector:

This allows us to write the two-dimensional translation equations in the matrix form:
P' = P + T (5 - 3)

Translating a point from P to position P' with translation vector T


Rotation: A two-dimensional rotation is applied to an object by repositioning it along a circular path in the
xy plane. To generate a rotation, we specify a rotation angle θ and the position ( x ¿ ¿ γ , y γ )¿of the rotation
point (or pivot point) about which the object is to be rotated (Fig. 5-3). Positive values for the rotation angle
define counterclockwise rotations about the pivot point, as in Fig. 5-3, and negative values rotate objects in
the clockwise direction. This transformation can also be de-scribed as a rotation about a rotation axis that is
perpendicular to the xy plane and passes through the pivot point.

We first determine the transformation equations for rotation of a point position P when the pivot point is at
the coordinate origin. The angular and coordinate relationships of
The original and transformed point positions are shown in Fig. 5-4. In this figure, r is the constant distance
of the point from the origin, angle ∅ is the original angular position of the point from the horizontal, and θ is
the rotation angle. Using standard trigonometric identities, we can express the trans-formed coordinates in
terms of angles θ and ∅ as

The original coordinates of the point in polar coordinates are

Scaling: A scaling transformation alters the size of an object. This operation can be carried out for polygons
by multiplying the coordinate values (x, y) of each vertex by scaling factors s x and sy to produce the
transformed coordinates (x', y')

Scaling factor s2, scales objects in the x direction, while sy scales in the y direction, The transformation
equations 5-10 can also be written in the matrix form:

Or

General pivot point rotation: We can generate rotations about any selected pivot point ( x r , y r) by
performing the following sequence of translate-rotate-translate operations:
(a) Translate the object so that the pivot-point position is moved to the coordinate origin.
(b) Rotate the object about the coordinate origin.
(c) Translate the object so that the pivot point is returned to its original position.
General fixed point scaling: Figure illustrates a transformation sequence to produce scaling with respect to
a selected fixed position (xf, yf) using a scaling function that can only scale relative to the coordinate origin.
(a) Translate object so that the fixed point coincides with the coordinate origin.
(b) Scale the object with respect to the coordinate origin.
(c) Use the inverse translation of step 1 to return the object to its original position.

Reflection: A reflection is a transformation that produces a mirror image of an object. The mirror image for
a two-dimensional reflection is generated relative to an axis of reflection by rotating the object 180° about
the reflection axis. We can choose an axis of reflection in the xy plane or perpendicular to the xy plane.
When the re-flection axis is a line in the xy plane, the rotation path about this axis is in a plane perpendicular
to the xy plane. For reflection axes that are perpendicular to the xy plane, the rotation path is in the xy plane.
Following are examples of some com-mon reflections. Reflection about the line y = 0, the x axis, is
accomplished with the transformation matrix
Shear: A transformation that distorts the shape of an object such that the transformed shape appears as if the
object were composed of internal layers that had been caused to slide over each other is called a shear. Two
common shearing transformations are those that shift coordinate x values and those that shift y values. An x-
direction shear relative to the x axis is produced with the transformation matrix

Which transforms coordinate positions as

Any real number can be assigned to the shear parameter shx.


Chapter-10
Spline representation: A spline is a flexible strip used to produce a smooth curve through a designated set
of points. Several small weights are distributed along the length of the strip to hold it in position on the
drafting table as the curve is drawn. The term spline curve originally referred to a curve drawn in this
manner.
Inter interpolation & approximation spline with figure.
We specify a spline curve by giving a set of coordinate positions, called control points, which indicates the
general shape of the curve. These control points are then fitted with piecewise continuous parametric
polynomial functions in one of two ways. When polynomial sections are fitted so that the curve passes
through each control point, as in Fig. 10-19, the resulting curve is said to interpolate the set of control points.
On the other hand, when the polynomials are fitted to the general control-point path without necessarily
passing through any control point, the resulting curve is said to approximate the set of control points (Fig.
10-20). Interpolation curves are commonly used to digitize drawings or to specify animation paths.
Approximation curves are primarily used as design tools to structure object surfaces. Figure 10-21 shows an
approximation spline surface created for a design application. Straight lines conned the control-point
positions above the surface.
Differentiate between interpolation & approximation spline:

Interpolation Spline Approximation Spline


when the polynomials are fitted to the
When polynomial sections are fitted so that
general control-point path without
the curve passes through each control point
necessarily passing through any control
is called interpolation spline
point it’s called approximate spline

Interpolation curves are commonly used to Approximation curves are primarily


digitize drawings or to specify animation used as design tools to structure object
paths surfaces

Sweep representation with figure:


Solid-modeling packages often provide a number of construction techniques. Sweep representations are
useful for constructing three-dimensional objects that possess translational, rotational, or other symmetries.
We can represent such objects by specifying a two-dimensional shape and a sweep that moves the shape
through a region of space. A set of two-dimensional primitives, such as circles and rectangles, can be
provided for sweep representations as menu options. Other methods for obtaining two-dimensional figures
include closed spline-curve constructions and cross-sectional slices of solid objects.

Figure illustrates a translational sweep. The periodic spline curve in Fig. 10-53(a) defines the object cross
section. We then perform a translational
Sweep by moving the control points P0 through P3 a set distance along a straight-line path perpendicular to
the plane of the cross section. At intervals along this path, we replicate the cross-sectional shape and draw a
set of connecting lines in the direction of the sweep to obtain the wireframe representation shown in figure.

Hermite spline with figure:


A Hermite spline (named after the French mathematician Charles Hermite) is an interpolating piecewise
cubic polynomial with a specified tangent at each control point. Unlike the natural cubic splines, Hermite
splines can be adjusted locally because each curve section is only dependent on its endpoint constraints. If
P(u) represents a parametric cubic point function for the curve section be-tween control points P k and Pk+I, as
shown in Fig. 10-27, then the boundary conditions that define this Hermite curve section are
P ( 0 )=P k
P ( 1 )=Pk+ 1 (1)
P' ( 0 )=DP k
P' ( 1 ) =DPk +1

with Dpk and Dpk+1 specifying the values for the parametric derivatives (slope of the curve) at control points
pk and pk+1, respectively.
We can write the vector equivalent of Eqs. 10-26 for this Hermite-curve section as

P ( u )=a u 3+ bu 2+ cu+d 0 ≤u ≤ 1 (2)


Where the x component of P is x ( u )=a x u3 + bx u2 +c x u+d and similarly for the v and z components. The
matrix equivalent of Eq. 10-28 is

P ( u )=u3 u2 u1 ¿ (3)

And the derivative of the point function can be expressed as


P' ( u )=3 u2 2 u 1 0¿ (4)
Substituting endpoint values 0 and I for parameter u into the previous two equations, we can express the
Hermite boundary conditions 10-27 in the matrix form:
Pk 0 0 0 1 a

[ ] [ ][ ] P k +1
DP k
DP k +1
=1 1
0 0
3

Solving the equation for the polynomial coefficients, we have


2
1
1
1
1 ⋅b
0 c
0 d
(5)

a 0 0 0 1
−1 Pk

[][ ] [ ]
b
c
d
=
1 1
0 0
3 2
1
1
1
1
0
0
P
⋅ k +1
DP k
DP k +1

Pk

[ ]
−1
0 0 0 1
P
=M H⋅ k +1
DP k
[ ]
DP k +1
Where,
M H=
1
0
3
1
0
2
1
1
1
1
0
0 (6)

Where MH, the Hermite matrix, is the inverse of the boundary constraint matrix. Equation 10-29 can thus be
written in terms of the boundary conditions as
Pk

P(u)=[ u3 u 2
P

[ ]
u 1 ]⋅M H⋅ k +1
DP k
DP k +1

Finally, we can determine expressions for the Hermite blending functions by carrying out the matrix
(7)

multiplications in Eq. 10-33

You might also like