0% found this document useful (0 votes)
16 views17 pages

CG Unit1

The document provides an overview of computer graphics, detailing types such as interactive and non-interactive graphics, and their applications in various fields like education, entertainment, and visualization. It explains the components of graphic displays, including random scan and raster scan displays, and the roles of frame buffers and video controllers in image generation. Additionally, it covers fundamental geometric concepts such as points, lines, and planes, essential for understanding graphical representations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views17 pages

CG Unit1

The document provides an overview of computer graphics, detailing types such as interactive and non-interactive graphics, and their applications in various fields like education, entertainment, and visualization. It explains the components of graphic displays, including random scan and raster scan displays, and the roles of frame buffers and video controllers in image generation. Additionally, it covers fundamental geometric concepts such as points, lines, and planes, essential for understanding graphical representations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Unit-1

Types of Computer Graphics, graphic displays- random scan displays, raster scan displays,
frame buffer and video controller, points and lines, line drawing algorithm, circle
generating algorithm, mid-point circle generating algorithm and parallel version of these
algorithm.

Introduction of Computer Graphics

Computer Graphics involves technology to access. The Process transforms and presents
information in a visual form. The role of computer graphics insensible. In today life,
computer graphics has now become a common element in user interfaces, T.V. commercial
motion pictures.

Computer Graphics is the creation of pictures with the help of a computer. The end product of
the computer graphics is a picture it may be a business graph, drawing, and engineering.

In computer graphics, two or three-dimensional pictures can be created that are used for
research. Many hardware devices algorithm has been developing for improving the speed of
picture generation with the passes of time. It includes the creation storage of models and
image of objects. These models for various fields like engineering, mathematical and so on

Today computer graphics is entirely different from the earlier one. It is not possible. It is an
interactive user can control the structure of an object of various input devices.

Interactive Computer Graphics

This technique encompasses interactive communication between users and visual content in
real-time using different input devices. These devices include touchscreens, keyboards, mice,
game controllers, and VR controllers.

Also, Interactive Computer Graphics allows the users to actively engage with the digital
content they work with which may lead to better interactive visual experiences:

The Principal Components of Interactive Computer Graphics

The following elements are the basic components of Interactive Computer Graphic:
 Input device: users are able to interact with graphics by inputting devices such as
keyboards, mice, touchscreens, and game controllers

 Display device: a display device like a monitor or a screen is needed for presenting the
graphics to users

 Graphic pipeline: a set of stages such as rasterization, geometric processing, output


merging, and pixel shading, used for rendering graphical data

 Rendering engine: it creates the final output by performing the necessary operations to
convert the objects’ descriptions into rasterized images

 Graphic User Interface (GPU): it helps users to interact with the system. Buttons,
menus, sliders, and other UI elements are used to manipulate objects, control the
graphics app, and change settings

 Interaction technique: it includes actions such as dragging, clicking, and rotating


objects.

 Application logic: the algorithms that control the behaviour of the Interactive system
by determining the way that objects interact together and the way the graphic systems
react and behave in different situations.

Non-Interactive Computer Graphics

In this method, the visual content has already been generated and the user cannot participate
in real-time manipulation. The content is static as images or animations.
Some techniques like global illumination, ray tracing, high-resolution rendering, and shaders
are applied for the main goal of non-interactive computer graphics which is producing high-
quality visual content. The pre-determined visual output is used in different industries, for
instance entertainment, advertising, architecture, and so on.
Applications of Computer Graphics
Computer graphics is the part of computer science that studies methods for manipulating
visual content although computer graphics deals with 3D graphics, 2D graphics, and image
processing. It also deals with the creation, manipulation, and storage of different types of
images and objects. There are some of the applications of computer graphics are described
below.:
Computer Art: Using computer graphics, we can create fine and commercial art which
includes animation packages, and paint packages. These packages provide facilities for
designing object shapes and specifying object motion. Cartoon drawings, paintings, and logo
designs can also be done.
Computer-Aided automobiles Drawing: Designing buildings, automobiles, and aircraft is
done with the help of computer-aided drawing, this helps in providing minute details to the
drawing and producing more accurate and sharp drawings with better specifications.
Presentation Graphics: For the preparation of reports or summarising the financial, statistical,
mathematical, scientific, and economic data for research reports, and managerial reports,
moreover creation of bar graphs, pie charts, and time charts, can be done using the tools
present in computer graphics.
Entertainment: Computer graphics find a major part of its utility in the movie industry and
game industry. Used for creating motion pictures, music videos, television shows, and
cartoon animation films. In the game industry where focus and interactivity are the key
players, computer graphics help in efficiently providing such features.
Education: Computer-generated models are extremely useful for teaching huge number of
concepts and fundamentals in an easy-to-understand and learn manner.
Training: Specialised systems for training like simulators can be used for training the
candidates in a way that can be grasped in a short span of time with better understanding. The
creation of training modules using computer graphics is simple and very useful.
Visualization: Today the need of visualize things have increased drastically, the need of
visualization can be seen in many advanced technologies, data visualization helps in finding
insights into the data, to check and study the behaviour of processes around us we need
appropriate visualization which can be achieved through proper usage of computer graphics.
Image Processing: Various kinds of photographs or images require editing in order to be used
in different places. Processing of existing images into refined ones for better interpretation is
one of the many applications of computer graphics.
Machine Drawing: Computer graphics are very frequently used for designing, modifying,
and creating various parts of a machine and the whole machine itself, the main reason behind
using computer graphics for this purpose is the precision and clarity we get from such
drawing is ultimate and extremely desired for the safe manufacturing of machine using these
drawings.
Graphical User Interface: The use of pictures, images, icons, pop-up menus, and graphical
objects helps in creating a user-friendly environment where working is easy and pleasant,
using computer graphics we can create such an atmosphere where everything can be
automated and anyone can get the desired action performed in an easy fashion.
These are some of the applications of computer graphics due to which it’s popularity has
increased to a huge extend and will keep on increasing with the progress in technology.
Example of Computer Graphics Packages:
LOGO
COREL DRAW
AUTO CAD
3D STUDIO
CORE
GKS (Graphics Kernel System)
PHIGS
CAM (Computer Graphics Metafile)
CGI (Computer Graphics Interface)

Graphic displays

Random Scan and Raster Scan Display:

Random Scan Display:

Random Scan System uses an electron beam which operates like a pencil to create a line
image on the CRT screen. The picture is constructed out of a sequence of straight-line
segments. Each line segment is drawn on the screen by directing the beam to move from one
point on the screen to the next, where its x & y coordinates define each point. After drawing
the picture. The system cycles back to the first line and design all the lines of the image 30 to
60 time each second. The process is shown in fig:

Random-scan monitors are also known as vector displays or stroke-writing displays or


calligraphic displays.
Advantages:
A CRT has the electron beam directed only to the parts of the screen where an image is to be
drawn.
Produce smooth line drawings.
High Resolution
Disadvantages:
Random-Scan monitors cannot display realistic shades scenes.

Raster Scan Display:

A Raster Scan Display is based on intensity control of pixels in the form of a rectangular box
called Raster on the screen. Information of on and off pixels is stored in refresh buffer or
Frame buffer. Televisions in our house are based on Raster Scan Method. The raster scan
system can store information of each pixel position, so it is suitable for realistic display of
objects. Raster Scan provides a refresh rate of 60 to 80 frames per second.
Frame Buffer is also known as Raster or bit map. In Frame Buffer the positions are called
picture elements or pixels. Beam refreshing is of two types. First is horizontal retracing and
second is vertical retracing. When the beam starts from the top left corner and reaches the
bottom right scale, it will again return to the top left side called at vertical retrace. Then it will
again more horizontally from top to bottom call as horizontal retracing shown in fig:

Types of Scanning or travelling of beam in Raster Scan

1. Interlaced Scanning
2. Non-Interlaced Scanning

In Interlaced scanning, each horizontal line of the screen is traced from top to bottom. Due to
which fading of display of object may occur. This problem can be solved by Non-Interlaced
scanning. In this first of all odd numbered lines are traced or visited by an electron beam,
then in the next circle, even number of lines are located.

For non-interlaced display refresh rate of 30 frames per second used. But it gives flickers. For
interlaced display refresh rate of 60 frames per second is used.

Advantages:

1. Realistic image
2. Million Different colors to be generated
3. Shadow Scenes are possible.

Disadvantages:

1. Low Resolution
2. Expensive

Differentiate between Random and Raster Scan Display:

RANDOM SCAN RASTOR SCAN

It has high Resolution Its resolution is low.


It is more expensive It is less expensive

Any modification if needed is easy Modification is tough

Solid pattern is tough to fill Solid pattern is easy to fill

Refresh rate depends or resolution Refresh rate does not depend on the picture.

Only screen with view on an area is


Whole screen is scanned.
displayed.

Beam Penetration technology come under it. Shadow mask technology came under this.

It does not use interlacing method. It uses interlacing

Frame Buffer vs Video Controller


The Frame Buffer and the Video Controller are two key components of a computer's
video display system. They work together to generate the images you see on your screen,
but they have distinct roles.
Frame Buffer
The frame buffer is a special part of your computer's memory (RAM) that stores the image
you see on your screen. Here's a simple explanation:
It holds the color and brightness information for every single pixel (tiny dot) on your
screen. For example, if your screen resolution is 1920x1080, the frame buffer stores the
data for all 2 million+ pixels.
When you see an image or video on your screen, the computer sends the pixel data to the
frame buffer. The frame buffer then keeps this data ready so it can be sent to your monitor
to display the image.
The frame buffer determines how detailed and colorful the images on your screen can be. A
larger frame buffer allows for higher resolutions (more pixels) and more colors.
Example:
Imagine the frame buffer as a giant grid of light bulbs, where each bulb represents a pixel
on your screen. The frame buffer stores the color and brightness for each bulb, and your
monitor lights them up accordingly to show the image.
In short, the frame buffer is the memory that holds the picture you see on your screen
before it gets displayed!

What is a Video Card? / Video Controller


A video card is a PC component that connects to a computer motherboard, also known as a
video controller, display adapter, video board, graphics card, or video adapter. It is an
expansion card, controls and calculates an image's appearance on the screen and used to
improve the picture quality to show on display. Even you cannot see this page without a
video card. It accelerates the video throughput as it is an intermediate device. The below
picture is an instance of the video card.

More clearly, inside the computer, it is a piece of hardware that process the graphics portion
of the processing load, and normally CPU handles most of the task. Due to extra processing
power and video ram, gamers use the video card instead of integrated graphics. Almost, it is
able to run all programs more efficiently as in modern times most of the programs are
graphically oriented.
The video card has the ability to speed up both 2D and 3D graphics rendering. Like web
browsers and photo editors' programs may benefit from 2D acceleration, and video games
and CAD design programs will likely advantage from the card's 3D acceleration.
The libraries, like OpenGL and DirectX, are supported by most video cards. For manipulating
graphics, these libraries have commands that programmers can use in their code. Some
commands from among these may be used for casting light, morphing polygons, moving or
rotating an object, and creating shadows. To create graphically-oriented programs, the
OpenGL or DirectX standards provide an easier way for developers. For the computer, it also
makes it compulsory to involve a supported video card in terms of running programs.

Points and Lines

Points, Lines, and Planes in Geometry

In basic geometry, fundamental concepts like points, lines, and planes form the foundation
upon which more complex geometric ideas are built. Points are precise locations in space,
devoid of size or dimension, represented simply by dots.

Lines are infinite paths stretching in two opposite directions, composed of an unending
series of points. They are defined by any two distinct points lying on them. Beyond lines,
planes extend infinitely in all directions, forming flat, two-dimensional surfaces.

A plane can be defined by any three non-collinear points or by a line and a point not on the
line. These basic elements serve as the starting point for exploring the intricacies of
geometric shapes, relationships, and constructions.

What is a Point?
A Point in geometry is defined as a location in the space that is uniquely determined by an
ordered triplet (x, y, z) where x, y, & z are the distances of the point from the X-axis, Y-
axis, and Z-axis respectively in the 3-Dimensions and is defined by ordered pair (x, y) in
the 2-Dimensions where, x and y are the distances of the point from the X-axis, and Y-
axis, respectively. It is represented using the dot and is named using capital English
alphabets. The figure added below shows a point P in the 3-D at a distance of x, y, and z
from the X-axis, Y-axis, and Z-axis respectively.

Collinear and Non-Collinear Points

When 3 or more points are present on the straight line then such types of points as known
as Collinear points and if these points do not present on the same line, then such types of
points are known as non-collinear points.
Coplanar and Non-Coplanar Points

When the group of points is present on the same plane then such types of points are known
as coplanar points and if these points do not present on the same plane, then such types of
points are known as non-coplanar points.

What is a Line?

A Line in three-dimensional geometr y is defined as a set of points in 3D that extends


infinitely in both directions It is the smallest distance between any two points either in 2-D
or 3-D space. We represent a line with L and in 3-D space, a line is given using the
equation,
L: (x – x1) / l = (y – y1) / m = (z – z1) / n

where
(x, y, z) are the position coordinates of any variable point lying on the line
(x1, y1, z1) are the position coordinates of a point P lying on the line
l, m, & n are the direction ratios of the line.

In 3D we can also form a line by the intersection of two non-parallel planes.

Line Segment

A line segment is defined as the finite length of the line that is used to join two points in 2-
D and 3-D. It is the shortest distance between two points. A line segment between two
points A and B is denoted as, AB

“A line has infinite length whereas a line segment is a part of a line and has finite length”.

Mid-Point

Midpoint is defined as the point on the line segment which divides the line segment into
two equal parts. Suppose we have two points A and B and the line segment joining these
two points is AB and not the point P on the line is called the midpoint if it breaks the line
into two equal parts such that,

AP = PB
Thus, P is called the midpoint of line segment AB. The image added below shows the line
segment AB with P as the midpoint.

Rays

A ray is defined as a line that has a fixed end point in one direction but can be extended to
infinity in the other direction. It is of infinite length. We define the ray joining points O and
A and extending to infinity towards A as

Intersecting and Parallel lines

In 2-D any two lines can either meet at some point or they never meet at some point. The
lines that meet at some point are called intersecting lines. The distance between the
intersecting line keeps on decreasing as we move toward the point of intersection, and at
the point of intersection of these lines, the distance between them becomes zero. When two
lines intersect an angle is formed between them.

Two lines that never meet each other in 2-D planes are called parallel lines. For parallel
lines, the distance between them is always constant.

The images below show Intersecting and Parallel lines.


Perpendicular Lines

Intersecting lines that intersect at right angles are called perpendicular lines. The angle
between these perpendicular lines is always the right angle or 90 degrees.

The perpendicular lines are shown in the image added below:

Line drawing algorithm


A line connects two points. It is a basic element in graphics. To draw a line,you need two
points between which you can draw a line. In the following three algorithms, we refer the
one point of line as X0,Y0 and the second point of line as X1,Y1.

DDA Algorithm

Digital Differential Analyzer (DDA) algorithm is the simple line generation algorithm
which is explained step by step here.

Step 1 − Get the input of two end points (X0,Y0) and (X1,Y1).
Step 2 − Calculate the difference between two end points.
dx = X1 - X0
dy = Y1 - Y0
Step 3 − Based on the calculated difference in step-2, you need to identify the number of
steps to put pixel. If dx > dy, then you need more steps in x coordinate; otherwise in y
coordinate.
if (absolute(dx) > absolute(dy))
Steps = absolute(dx);
else
Steps = absolute(dy);
Step 4 − Calculate the increment in x coordinate and y coordinate.
Xincrement = dx / (float) steps;
Yincrement = dy / (float) steps;
Step 5 − Put the pixel by successfully incrementing x and y coordinates accordingly and
complete the drawing of the line.
for(int v=0; v < Steps; v++)
{
x = x + Xincrement;
y = y + Yincrement;
putpixel(Round(x), Round(y));
}

Bresenham's Line Generation

Bresenham’s Line Drawing Algorithm is an efficient way to draw a straight line between two
points on a pixel-based display. It uses integer calculations rather than floating-point
arithmetic, making it faster and more suitable for computer graphics.

1. Initialize: Set starting point (X0,Y0) and ending point (X1,Y1).


2. Calculate Differences: dx=, X1 - X0 , dy= Y1 - Y0
3. Compute Decision Parameter: p=2dy−dx
4. If m<1 and p<0 then

Xi+1= Xi + 1

Yi+1= Yi

Pk+1 = Pk + 2dy

Else if m<1 and P>=1

Xi+1= Xi + 1

Yi+1= Yi+1

Pk+1 = Pk + 2dy – 2dx

5. If m>= 1 and p< 0 then


Xi+1= Xi
Yi+1= Yi+1
Pk+1 = Pk + 2dx

Else if m>= 1 and p>= 0 then

Xi+1= Xi + 1

Yi+1= Yi+1

Pk+1 = Pk + 2dx – 2dy

6. Stop

Circle generating algorithm

Drawing a circle on the screen is a little complex than drawing a line. There are two popular
algorithms for generating a circle − Bresenham’s Algorithm and Midpoint Circle
Algorithm. These algorithms are based on the idea of determining the subsequent points
required to draw the circle. Let us discuss the algorithms in detail −

The equation of circle is X2+Y2=r2 where r is radius.

Bresenham's Circle Drawing Algorithm is a modification of the Midpoint Circle Drawing


Algorithm that uses integer arithmetic instead of floating-point calculations to determine the
points on a circle. This makes it more efficient for computer systems that have limited
floating-point capabilities. Like the Midpoint algorithm, Bresenham's algorithm takes
advantage of the circle's symmetry to reduce the number of calculations required to plot the
full circle.

Bresenham's Circle Drawing Algorithm Overview


The algorithm is based on an iterative process where a decision parameter D is used to
determine whether the next pixel should be placed horizontally or diagonally. It draws a
circle by plotting points in the first octant and then reflecting them across the other seven
octants.

Steps of the Algorithm:

1. Initialization:
o Let the center of the circle be (x, y) and the radius be R.
o Initialize the decision parameter D and two variables P and Q:
 P = 0
 Q = R (the initial point starts at the top of the circle).
 The initial decision parameter D is given by D = 3 - 2 * R.
2. Repeat the following steps while P <= Q:
o Step 1: Plot the current points at (x + P, y + Q), (x - P, y + Q), (x +
P, y - Q), (x - P, y - Q), (x + Q, y + P), (x - Q, y + P), (x + Q,
y - P), and (x - Q, y - P) (these are the symmetric points in the 8 octants
of the circle).
o Step 2: Increment P by 1 (i.e., move to the next pixel horizontally).
o Step 3: Evaluate the decision parameter D:
 If D < 0: The next pixel is placed horizontally (at (P + 1, Q)), and
the decision parameter is updated as: D= D+4P+6
 If D ≥ 0: The next pixel is placed diagonally (at (P + 1, Q - 1)),
and the decision parameter is updated as: D= D+4(P−Q) +10
 Decrease Q by 1 when a diagonal step is taken.
3. Stop: The algorithm stops when P > Q, as this means the circle's points have been
plotted for all octants.

Mid-Point Algorithm

The Mid-Point Circle Algorithm is an efficient method for drawing circles using integer
arithmetic. It determines pixel positions using a decision parameter and exploits circle
symmetry to reduce computations.
Step-by-Step Process:

Step-1 Initialize the Parameters:

o Define the radius r of the circle.


o Define the coordinates of the center (center_x, center_y) of the circle.
o Start with the initial point (x, y) = (0, r).
o Initialize the decision parameter d as d = 1 - r.

Step-2 Plot the Initial Points:

o Plot the initial point (center_x + x, center_y + y).


o Use the circle's symmetry to plot the corresponding points in all eight octants.

Step-3 Iterate to Find the Next Points:

o Repeat the following steps while x < y:

(i) Update the Decision Parameter:

If d < 0, the midpoint is inside the circle.

Update d as d = d + 2*x + 3.

If d >= 0, the midpoint is outside the circle.

Update d as d = d + 2*(x - y) + 5.

Decrement y by 1: y = y - 1.

(ii) Increment x:

Increment x by 1: x = x + 1.

(iii) Plot the Points:

Plot the new point (center_x + x, center_y + y).

The circle's symmetry allows you to plot the calculated point (x, y) in eight positions:

(center_x + x, center_y + y)

(center_x - x, center_y + y)

(center_x + x, center_y - y)

(center_x - x, center_y - y)

(center_x + y, center_y + x)
(center_x - y, center_y + x)

(center_x + y, center_y - x)

(center_x - y, center_y - x)

Parallel version of these algorithm.


To parallelize the Mid-Point Circle Algorithm, you can use multiple processors to handle
different sections of the circle simultaneously. Here's an outline:

1. Divide the Circle:

o Divide the circle into multiple segments. The circle can be divided into
octants, quadrants, or any other segment that suits the parallel processing
needs.

2. Assign Segments to Processors:

o Assign each segment to a separate processor. For example, if dividing into


four quadrants, each processor will handle one quadrant.

3. Run the Algorithm in Parallel:

o Each processor runs the Mid-Point Circle Algorithm for its assigned segment
independently.

4. Merge the Results:

o After processing, combine the results from all processors to form the complete
circle.

You might also like