Professional Documents
Culture Documents
Computer Graphics
UNIT-1
OVERVIEW OF COMPUTER
GRAPHICS
1
Computer Graphics
Definitioin: Computer graphics is an art of drawing pictures, lines, charts,
etc. using computers with the help of programming.
Computer graphics image is made up of number of pixels.
●
●
It displays the information in the form of graphical objects such as pictures,
charts, diagram and graphs.
●
Graphical objects convey more information in less time and easily
understandable formats for example statically graph shown in stock exchange.
●
The special procedure determines which pixel will provide the best
approximation to the desired picture or graphics object this process is known
as Rasterization.
2
Pixel: is the smallest addressable graphical unit represented on the
computer screen.
Image: is a visual representation of something. ...
●
An image is a picture that has been created or copied and stored in
electronic form.
●
An image can be described in terms of vector graphics or raster graphics.
●
An image stored in raster form is sometimes called a bitmap.
●
Object: In computer graphics, an object refers to an item within a graphic,
such as a graphic circle or a square.
6
Rastor aind Vector Zoom
7
8
9
10
Disadvantages of Random scan
display
19
Architecture of Raster Scan Display
Termiinology related to raster scain
23
29
Applicatioins of Computer Graphics
User iinterface: Visual object which we observe on screen which
communicates with user is one of the most useful applications of
the computer graphics.
Data Represeintatioin: Plotting of graphics and chart in industry,
business, government and educational organizations drawing like
bars, pie-charts, histogram’s are very useful for quick and good
decision making.
Ofce automatioin aind desktop publishiing: - It is used for
creation and dissemination of information. It is used in in-house
creation and printing of documents which contains text, tables,
graphs and other forms of drawn or scanned images or picture.
Computer aided draftiing aind desigin: - It uses graphics to
design components and system such as automobile bodies
structures of building etc.
30
Simulatioin aind ainimatioin: - Use of graphics in simulation
makes mathematic models and mechanical systems more
realistic and easy to study.
Art aind commerce: - There are many tools provided by
graphics which allows used to make their picture animated
and attracted which are used in advertising.
Process cointrol: - Now a day’s automation is used which is
graphically displayed on the screen.
Cartography: - Computer graphics is also used to represent
geographic maps, weather maps,oceanographic charts etc.
Educatioin aind traiiniing: - Computer graphics can be used
to generate models of physical, fnancial and economic
systems. These models can be used as educational aids.
Image processiing: - It is used to process image by changing
property of the image.
31
●
Virtual Reality (VR) is the use of computer technology to create a
simulated environment. Unlike traditional user interfaces, VR
places the user inside an experience.
●
Instead of viewing a screen in front of them, users are
immersed and able to interact with 3D worlds.
●
By simulating as many senses as possible, such as vision,
hearing, touch, even smell, the computer is transformed into
a gatekeeper to this artificial world. The only limits to near-real
VR experiences are the availability of content and
cheap computing power.
3D Computer Graphics
●
In the 2D system, we use only two coordinates X and Y but in 3D,
an extra coordinate Z is added.
●
3D graphics techniques and their application are fundamental to
the entertainment, games, and computer-aided design industries.
●
Furthermore, 3D graphics components are now a part of almost
every personal computer and, although traditionally intended for
graphics-intensive software such as games, they are increasingly
being used by other applications.
33
34
Liine Segmeint iin Computer Graphics
35
36
Circle iin Computer Graphics
37
Arc: Continuous part of the circle is called arc.
Chord: A line segment within a circle that touches two
points on the circle is called chord.
38
GLS University
Faculty of Computer Applications & Information Technology
Sub: Computer Graphics
Unit-1
Computer Graphics
UNIT-2
GRAPHICS PRIMITIVES
1
Line Styles
●
Different Line styles are used to differentiate each of the line from one
another.
Dashed line an
●
be generated by inter-dash spaces beween the dashes.
2
Line Attributes
3
4
5
Different colours is also used with different shapes
of pens and brushes.
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Antialiasing
●
In computer graphics, antialiasing is a software technique for diminishing
jaggies - stairstep-like lines that should be smooth.
●
Jaggies occur because the output device, the monitor or printer, doesn't have a
high enough resolution to represent a smooth line.
●
Antialiasing reduces the prominence of jaggies by surrounding the stairsteps
with intermediate shades of gray (for gray-scaling devices) or color (for color
devices).
●
Although this reduces the jagged appearance of the lines, it also makes them
fuzzier.
23
The errors caused by aliasing are called artefacts. Common aliasing artefacts
include jagged profiles, disappearing or improperly rendered fine detail, and
disintegrating textures.
24
Errors by Antialiasing
Jagged profless
●
The picture on the left shows the sampling grid superimposed on
the original scene.
●
The picture on the right is the rendered image.
●
A jagged profile is quite evident in the rendered image. Also
known as "jaggies", jagged silhouettes are probably the most
familiar effect caused by aliasing.
25
26
Improperly Rendered
●
The original scene on the left shows a group of small polygons. In
the rendered scene, one of the two red rectangles disappears entirely,
and the other doubles in width.
●
Two of the orange triangles disappear. Although the two yellow
triangles are identical in size, one is larger than the other in the
rendered image.
27
28
Disintegrating textures
●
This is a checkered texture on a plane. The checkers should become
smaller as the distance from the viewer increases.
●
However, the checkers become larger or irregularly shaped when
their distance from the viewer becomes too great.
●
Simply increasing the resolution will not remove this artefact.
Increasing the resolution will only move the artefact closer to the
horizon.
29
30
31
32
Line Drawing Algorithms-
In computer graphics, popular algorithms used to generate lines are-
DDA Algorithm-
DDA Algorithm is the simplest line drawing algorithm.
DDA Algorithm attempts to generate the points between the starting and ending coordinates.
Procedure-
Given-
• Starting coordinates = (X0, Y0)
• Ending coordinates = (Xn, Yn)
The points generation using DDA Algorithm involves the following steps-
Step-01:
Calculate ΔX, ΔY and M from the given input.X, ΔX, ΔY and M from the given input.Y and M from the given input.
These parameters are calculated as-
• ΔX, ΔY and M from the given input.X = Xn – X0
• ΔX, ΔY and M from the given input.Y =Yn – Y0
• M = ΔX, ΔY and M from the given input.Y / ΔX, ΔY and M from the given input.X
Step-02:
Find the number of steps or points in between the starting and ending coordinates.
if (absolute (ΔX, ΔY and M from the given input.X) > absolute (ΔX, ΔY and M from the given input.Y))
Steps = absolute (ΔX, ΔY and M from the given input.X);
else
Steps = absolute (ΔX, ΔY and M from the given input.Y);
Step-03:
Suppose the current point is (Xp, Yp) and the next point is (Xp+1, Yp+1).
Step-04:
Keep repeating Step-03 until the end point is reached or the number of generated new points
(including the starting and ending points) equals to the steps count.
PRACTICE PROBLEMS BASED ON DDA ALGORITHM
Problem-01:
Calculate the points between the starting point (5, 6) and ending point (8, 12).
Solution-
Given-
• Starting coordinates = (X0, Y0) = (5, 6)
• Ending coordinates = (Xn, Yn) = (8, 12)
Step-01:
Calculate ΔX, ΔY and M from the given input.X, ΔX, ΔY and M from the given input.Y and M from the given input.
• ΔX, ΔY and M from the given input.X = Xn – X0 = 8 – 5 = 3
• ΔX, ΔY and M from the given input.Y =Yn – Y0 = 12 – 6 = 6
• M = ΔX, ΔY and M from the given input.Y / ΔX, ΔY and M from the given input.X = 6 / 3 = 2
Step-02:
Calculate the number of steps.
As |ΔX| < |ΔY| = 3 < 6, so number of steps = ΔY = 6ΔX, ΔY and M from the given input.X|ΔX| < |ΔY| = 3 < 6, so number of steps = ΔY = 6 < |ΔX| < |ΔY| = 3 < 6, so number of steps = ΔY = 6ΔX, ΔY and M from the given input.Y|ΔX| < |ΔY| = 3 < 6, so number of steps = ΔY = 6 = 3 < 6, so number of steps = ΔX, ΔY and M from the given input.Y = 6
Step-03:
As M > 1, so case-03 is satisfied.
Now, Step-03 is executed until Step-04 is satisfied.
Calculate the points between the starting point (5, 6) and ending point (13, 10).
Solution-
Given-
• Starting coordinates = (X0, Y0) = (5, 6)
• Ending coordinates = (Xn, Yn) = (13, 10)
Step-01:
Calculate ΔX, ΔY and M from the given input.X, ΔX, ΔY and M from the given input.Y and M from the given input.
• ΔX, ΔY and M from the given input.X = Xn – X0 = 13 – 5 = 8
• ΔX, ΔY and M from the given input.Y =Yn – Y0 = 10 – 6 = 4
• M = ΔX, ΔY and M from the given input.Y / ΔX, ΔY and M from the given input.X = 4 / 8 = 0.50
Step-02:
Step-03:
Calculate the points between the starting point (1, 7) and ending point (11, 17).
Solution-
Given-
• Starting coordinates = (X0, Y0) = (1, 7)
• Ending coordinates = (Xn, Yn) = (11, 17)
Step-01:
Calculate ΔX, ΔY and M from the given input.X, ΔX, ΔY and M from the given input.Y and M from the given input.
• ΔX, ΔY and M from the given input.X = Xn – X0 = 11 – 1 = 10
• ΔX, ΔY and M from the given input.Y =Yn – Y0 = 17 – 7 = 10
• M = ΔX, ΔY and M from the given input.Y / ΔX, ΔY and M from the given input.X = 10 / 10 = 1
Step-02:
Step-03:
As M = 1, so case-02 is satisfied.
Now, Step-03 is executed until Step-04 is satisfied.
Practice Questions
Computer Graphics
UNIT-3
POLYGON
1
POLYGON
2
Types Of POLYGON
3
4
5
6
7
8
9
Winding Number method
10
11
12
13
Scan line Fill Method
14
15
16
17
`
18
19
Boundary Fill Algorithm
20
21
22
8 connected pixel position
23
4 connected pixel position
24
25
26
27
28
29
30
31
32
Flood-Fill Algorithm
33
34
35
36
37
38
39
40
41
42
Difference between Flood fill and Boundary
Fill
43