Rvu
Rvu
Designing of buildings, automobile, 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.
3. Presentation Graphics
For the preparation of reports or summarizing the financial, statistical, mathematical, scientific, economic data
for research reports, managerial reports, moreover creation of bar graphs, pie charts, time chart, can be done
4. Entertainment
Computer graphics finds a major part of its utility in the movie industry and game industry. Used for creating
motion pictures , music video, television shows, cartoon animation films. In the game industry where focus and
interactivity are the key players, computer graphics helps in providing such features in the efficient way.
5. Education
Computer generated models are extremely useful for teaching huge number of concepts and fundamentals in an
easy to understand and learn manner. Using computer graphics many educational models can be created through
which more interest can be generated among the students regarding the subject.
6. Training
Specialized system for training like simulators can be used for training the candidates in a way that can be
grasped
2
in a short span of time with better understanding. Creation of training modules using computer graphics is simple and very
useful
7. Visualization
Today the need of visualize things have increased drastically, the need of visualization can be seen in many advance
technologies , data visualization helps in finding insights of the data , to check and study the behavior of processes around us
we need appropriate visualization which can be achieved through proper usage of computer graphics
8. 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.
9. Machine Drawing
Computer graphics is very frequently used for designing, modifying and creation of various parts of 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.
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
3
What is Pixel?
The full form of the pixel is "Picture Element.” It is also known as "PEL." Pixel is the smallest element of an image
on a computer display, whether they are LCD or CRT monitors. A screen is made up of a matrix of thousands or
4
Once the electron heats the phosphorus, they light up, and they are projected on a screen. The color you view on the screen
is produced by a blend of red, blue and green light.
Focusing
System
V deflect
Base
Phosphor
Connector x deflect
Pins
Llectron
Control
Gun
grid
voltage
Components of CRT:
Main Components of CRT are:
1. Electron Gun: Electron gun consisting of a series of elements, primarily a heating filament (heater) and a cathode. The
electron gun creates a source of electrons which are focused into a narrow beam directed at the face of the CRT.
5
3. Focusing system: It is used to create a clear picture by focusing the electrons into a narrow beam.
4. Deflection Yoke: It is used to control the direction of the electron beam. It creates an electric or magnetic field which will
bend the electron beam as it passes through the area. In a conventional CRT, the yoke is linked to a sweep or scan generator.
The deflection yoke which is connected to the sweep generator creates a fluctuating electric or magnetic potential.
5. Phosphorus-coated screen: The inside front surface of every CRT is coated with phosphors. Phosphors glow when a high-
energy electron beam hits them. Phosphorescence is the term used to characterize the light given off by a phosphor after it has
been exposed to an electron beam.
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
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
6
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:
7
Differentiate between Random and Raster Scan Display:
Random Scan Raster Scan
8
7. Beam Penetration technology come under
7. Shadow mark technology came under this.
it.
Chapter 2
Line Drawing Algorithm in Computer Graphics
"The Line drawing algorithm is a graphical algorithm which is used to represent the line segment on discrete graphical
9
• Input: A good algorithm must accept at least one or more input.
• Output: An algorithm must generate at least one output.
Equation of the straight line
We can define a straight line with the help of the following equation.
y= mx + a Where,
(x, y) he line.
m = Slope of the line. a = Interception point
The Digital Differential Analyzer helps us to interpolate the variables on an interval from one point to another point. We can use the
digital Differential Analyzer algorithm to perform rasterization on polygons, lines, and triangles.
Digital Differential Analyzer algorithm is also known as an incremental method of scan conversion. In this algorithm, we can
perform the calculation in a step by step manner. We use the previous step result in the next step.
As we know the general equation of the straight line is: y = mx + c
Here, m is the slope of (xi, yi) and (x2, y2). m = (y2 - y1)/ (x2 - x1)
Now, we consider one point (xk, yk) and (xk+1, yk+1) as the next point.
10
Then the slope m = (yk+1 - yk)/ (xk+1 - xk)
Now, we have to find the slope between the starting point and ending point. There can be following three cases to discuss:
Case 1: If m < 1
Then x coordinate tends to the Unit interval.
Xk+1 = Xk + 1 yk+i = yk + m Case 2: If m > 1
Then y coordinate tends to the Unit interval. yk+1 = yk + 1 Xk+1 = Xk + 1/m
Case 3: If m = 1
Then x and y coordinate tend to the Unit interval.
Xk+1 = Xk + 1 yk+1 = yk + 1
We can calculate all intermediate points with the help of above three discussed cases.
Algorithm of Digital Differential Analyzer (DDA) Line Drawing Step 1: Start.
Step 2: We consider Starting point as (X1, y1), and ending point (X2, y2).
Step 3: Now, we have to calculate Ax and Ay.
▲ X = X2-X1
Ay = y2-y1 m = Ay/Ax
Step 4: Now, we calculate three cases.
Step 5: We will repeat step 4 until we find the ending point of the line.
Step 6: Stop.
Example: A line has a starting point (1,7) and ending point (11,17). Apply the Digital Differential Analyzer algorithm to plot a
line.
Solution: We have two coordinates,
Starting Point = (X1, y1) = (1,7)
Ending Point = (X2, y2) = (11,17)
Step 1: First, we calculate Ax, Ay and m.
Ax = X2 - X1 = 11-1 = 10 Ay = y2 - y1 = 17-7 = 10
11
m = Ay/Ax = 10/10 = 1 Step 2: Now,
we calculate the number of steps. Ax = Ay = 10
Then, the number of steps = 10
Step 3: We get m = 1, Third case is
satisfied.
_Now move to next step._
i
1 7 2 8 (2, 8)
3 9 (3, 9)
4 10 (4, 10)
5 11 (5, 11)
6 12 (6, 12)
7 13 (7, 13)
8 14 (8, 14)
9 15 (9, 15)
10 16 (10, 16)
11 17 (11, 17)
12
Step 4: We will repeat step 3 until we get the endpoints of the line.
Step 5: Stop.
^ Digital Differential Analyzer algorithm tells us about the overflow of the point when the point changes its location.
13
Chapter 3
Introduction of
What is Transformation?
Transformations
Transformation refers to the mathematical operations or rules that are applied on a graphical image consisting of the
number of lines, circles, and ellipses to change its size, shape, or orientation. It can also reposition the image on the screen.
Transformations play a very crucial role in computer graphics.
There are two complementary points of view for describing object transformation.
1. Geometric Transformation: The object itself is transformed relative to the coordinate system or background. The
mathematical statement of this viewpoint is defined by geometric transformations applied to each point of the object.
2. Coordinate Transformation: The object is held stationary while the coordinate system is transformed relative to the
object. This effect is attained through the application of coordinate transformations.
Types of Transformations
There are various types of transformations in computer graphics through which an image can be processed, edited ad altered.
Some basic and most commonly used types of these transformations are:
14
1. Translation
2. Rotation
3. Scaling
4. Reflection
5. Shearing
Translation
Translation refers to a technique in which a point is shift from one place to another, whose distance is known.
Consider a point A(x1, yO be shifted to another point B (x2, y2). Now we only know the shifting distance tx along x-axis
x2 = x1 + tx
y2 = y1 + ty For example:
Suppose we want to shift a point with coordinates at A(30,100) and distance along x-axis is 10 units and 20 units along y-
axis.
Using translation:
Here tx = 10 ;
and ty = 20
15
X2 = 30 + 10 = 40
y2 = 100 + 20 = 120
Example Given a circle C with radius 10 and center coordinates (1, 4). Apply the translation with distance 5 towards X axis and 1
towards Y axis. Obtain the new coordinates of C without changing its radius.
Solution-
Given-
• Xnew = Xold + Tx = 1 + 5 = 6
• Ynew = Yold + Ty = 4 + 1 = 5
16
Rotation
Rotation refers to mathematical operation in which the graphical object is rotated about an angle (0) to the axis.
Suppose we want to rotate a point with coordinates A (x^ yO clockwise through an angle 0 about the origin Then the new
17
Initial angle of the object O with respect to origin = <E>
Rotation angle = 9
New coordinates of the object O after rotation = (X w, Ynew)
ne
18
Example: Given a line segment with starting point as (0, 0) and ending point as (4, 4). Apply 30 degree rotation anticlockwise
direction on the line segment and find out the new coordinates of the line.
Solution-
We rotate a straight line by its end points with the same angle. Then, we re-draw a line between the new end points.
Given-
Let new ending coordinates of the line after rotation = (Xnew, Ynew).
Applying the rotation equations, we have-Xnew = Xold x cos9 - Yold x sin9 = 4 x cos30° - 4 x sin30°
= 4 x (V3 / 2) - 4 x (1 / 2)
= 2V3 - 2
19
= 2(V3- 1)
= 2(1.73 - 1)
= 1.46
= 2(1 + 1.73)
= 5.46
Thus, New ending coordinates of the line after rotation = (1.46, 5.46).
20
Scaling
Scaling is the concept of increasing (or decreasing) the size of a picture. (In one or in either directions. When it is done in both
directions, the increase or decrease in both directions need not be same) To change the size of the picture, we increase or decrease the
distance between the end points of the picture and also change the intermediate points are per requirements.
Scaling refers to a mathematical rule applied to change the size of the image.
If the value of scaling factors is negative, the size is decreased and when the value is positive, the size of the image is increased.
Suppose the point with coordinates A (x 1, y1) is to be scaled by a factor sx along the x-axis and sy along the y-axis.
x2 = x1 x sx
21
y2 = yi x sy
Let-
22
Example: given a square object with coordinate points A(0, 3), B(3, 3), C(3, 0), D(0, 0). Apply the scaling parameter 2 towards
X axis and 3 towards Y axis and obtain the new coordinates of the object.
Solution-
Given-
• Old corner coordinates of the square = A (0, 3), B(3, 3), C(3, 0), D(0, 0)
• Scaling factor along X axis = 2
• Scaling factor along Y axis = 3
23
For Coordinates B(3, 3)
Let the new coordinates of corner B after scaling = (Xnew,
Ynew).
Applying the scaling equations, we have-
• Xnew _ Xold X Sx _ 3 X 2 — 6
• Ynew — Yold X Sy — 3 X 3 — 9
• Xnew — Xold X Sx — 3 X 2 — 6
• Ynew — Yold X Sy — 0 X 3 — 0
• Xnew — Xold X Sx — 0 X 2 — 0
• Ynew — Yold X Sy — 0 X 3 — 0
It is a transformation which produces a mirror image of an object. The mirror image can be either about x-axis or y-axis. The object is
rotated by180°.
Types of Reflection:
1. Reflection about the x-axis
2. Reflection about the y-axis
25
1. Reflection about x-axis: The object can be reflected about x-axis with the help of the following matrix
1 0 0
0-10 .0 0
1.
In this transformation value of x will remain same whereas the value of y will become negative. Following figures shows the
reflection of the object axis. The object will lie another side of the x-axis.
2. Reflection about y-axis: The object can be reflected about y-axis with the help of following transformation matrix
26
-1 0 0 0 10
. 0 0 1.
Here the values of x will be reversed, whereas the value of y will remain the same. The object will lie another side of the
y-axis. The following figure shows the reflection about the y-axis
A (3 4)
B (6 4)
C (4 8)
27
Find reflected position of triangle i.e., to the x-axis.
Solution:
y-axis
Original position
i-1-1-1-1-1-1- x-axis
Reflected position
28
1 0 0
(x, y) = (3, 4) 0 -1 0
.0 0 1.
(x, y) = [3, -4]
1 0 0
0 -1 0
-0 0 1-
(x. y) = (6, 4)
0
0
1.
(x: y) = [4, -3]
a (3, 4) becomes a1 (3, -4) b (6, 4) becomes b1 (6, -4) c (4, 8) becomes c1 (4, -8)
Shearing
A transformation that slants the shape of an object is called the shear transformation. There are two shear transformations X-
Shear and Y-Shear. One shifts X coordinates values and other shifts Y coordinate values. However; in both the cases only one
coordinate changes its coordinates and other preserves its values. Shearing is also termed as Skewing.
29
X-Shear
The X-Shear preserves the Y coordinate and changes are made to X coordinates, which causes the vertical lines to tilt right or
left as shown in below figure.
Y-Shear
The Y-Shear preserves the X coordinates and changes the Y coordinates which causes the horizontal lines to transform into lines
which slopes up or down as shown in the following figure.
30