Computer-Graphics Book 1 PDF
Computer-Graphics Book 1 PDF
np
Computer graphics.
Book: computer Graphics
Author: Donald Heam M Pauline baker.
Date: 2070/5/12
What is computer Graphics?
-
Operating system
Complier
Editor
Debuggers
Graphics library
CG libraries:
- Functions/ routine to draw line or circle etc.
- Ellaborate : pull -down menu, 3D coordinate system etc.
Motivation of CG:
- Appealing picture produce.
- Humans respond better to pictorial information.
- Human brain recognizes visual patterns.
- If it looks right , it is right, Jim Blinn (CG pioneer)
Reasons to study CG:
- information presentation.
- Job in CG ( Games, movies etc)
- New medium for artistic expression.
- Communicate ideas better.
- Take animation course.
Use of CG:
- Art. Entertainment, publishing
- Movies , TV, books, magazines, game
- Image processing
- Alter images, remove noise
- Processing monitoring
- Large systems or plants
- Display simulations:
- Flight simulators, virtual worlds.
- Computer- aided design, architecture, electric circuit
design
- Scientific analysis and visualization.
- Molecular biology(human brain), matlab,
CG Example:
- Biggest CG consumers today are:
- Movies (Hollywood)
- Computer Games: eg Mdden NFL football 2004.
1
Downloaded from www.bhawesh.com.np
2
Downloaded from www.bhawesh.com.np
Date: 2065/4/14
Application of computer graphics:
Computer graphics started with the display of
data or hard copy plotter and CRT screens had grown include the
creation, storage and manipulation of mode is of images of
objects. These models come from a diverse set of fields and
include physical mathematical, engineering , architectural,
natural phenomena and so on. There is virtually no area in which
graphical displays cannot be used to some advantages.
Today al most all application
programs even for manipulating text or numerical data uses
graphics extensively in user interface for visualizing and
manipulating the application specific objects. Graphical
interaction has replaced textual interaction with alphanumeric
terminal. Even people who do not use computer encounter
computer graphics in TV commercial or special effects. It is an
integral part of all computer user interfaces and is indepensible
for visualizing 2D, 3D and higher- dimensional objects. We find
computer graphics used in a diverse areas as science, engineering
, medicine business, industry, government, art, entertainment ,
education and others.
COMPUTER AIDED DESING (CAD):
In CAD, interactive graphics is used to design components and
systems of mechanical, electrical, electromechanical and
electronic devices including structures such as buildings,
automobile bodies, airplane, VLSI chips, optical systems and
telephone and computer networks. The emphasis is on
interacting with a computer-based model of the component or
3
Downloaded from www.bhawesh.com.np
Date: 2065/4/15
Computer Art:
Computer graphics is used to generate arts. They are widely
used in both fine art and commercial art applications. Fine arts is
drawn by artist hand and this kind of art is perfect to the artist
skill. Artist use a variety of computer methods including specialpurpose hardware, artists paints brush program, other paint
packages, specially developed software. Mathematics packages,
CAD packages, desktop publishing software and animation
packages providing facilities.
Moreover, artists uses a touchpad or a stylus or digitizer to
draw pictures. The movement of object is captured by some
input hardware. These arts are usually generated by using
mathematical functions or algorithms.
Computer art is not as realistic as fine arts. Mostly the
commercial art is used to produce animations to demonstrate or
present commercial products to the public. Find artists uses a
variety of computer techniques to produce images. These images
are created using a combination of 3D modeling package, texture
mapping, drawing programs and CAD software.
These technique for generating electronic images are
also applied in commercial art for logos and other design, page
layouts combining text and graphics, TV advertising sports, and
other areas. Animations are also used frequently in advertising
and TV commercial and produce frame by frame, where each
frame of the motion is rendered and saved as an image file.
A common graphics method exployed in many
commercials is morphing, where one object is transformed into
another.
4
Downloaded from www.bhawesh.com.np
5
Downloaded from www.bhawesh.com.np
6
Downloaded from www.bhawesh.com.np
Disadvantages:
When used for long time, leads to an arm pain.
Some part of the screen will be obscure by hand.
Cannot read black pixel position.
Reading might be errorous if background light has very
high intensity.
Date:2065/4/16
Touch-Panel: Touch panels are a sensitive surface that is used
to point directly. The panel can be touched by finger or any other
object like stylus Transparent touch panels are integrated with
computer monitor for the manipulation of information display.
A basic touch panel senses voltage drop when a user
touches the panel. It knows where the voltage has dropped and
accordingly calculates the touch position.
- Resistant based touch panel uses two substances of glass
or plastic separates by insulators. When a user touches the
panel these two substances are connected and the resistance
at that point will drop down. The resistance drop is sensed
and the touch position is calculated.
- In capacitance based touch panel, some charge is spread
on the screen. When user touches the panel the charge is
drawn by finger form each side proportionally. The sensor
calculates the charge in frequency of charge/voltage and
find out the touch position.
- In Acoustic(Sound) based touch panel uses very high
frequency (5 Mhz). The sound waves are generated from
X-axis and Y-axis sides are reflected from opposite side of
either axis. When user touches the panel, the sound waves
are interrupted and reflected back from their mid wave. The
sensors on the X -axis and Y-axis sides measured the time,
the sound waves took to get reflected back and estimate the
touch position.
- An optical touch panel uses Infra red (IR) emitters and
sensor on X and Y-axis sides, emitter are placed and on the
apposite sides sensors are placed when a user touches the
screen, the point will interrupt two IR beam from X and yaxis. This is detected by IR sensors and the touch position
is calculated.
Advantages:
Touch panel can be mounted an display screen leaving
more space on desktop but mouse, joystick etc. take some
space.
Tablets (Electronic, Sonic and Resistive ): A common device
for drawing, painting or interactively selecting co-ordinate
position on an object is a digitizer. Typically a digitizer is used to
scan over a drawing on object and to input a set of discrete coordinate position which can be joined with straight line segments
to approximate the curve surface shape.
One type of digitizer is Graphics tablets (data tablets),
which is used to input two dimensional (2D) co-ordinate by
activity a hand curser or stylus as selected position, flat surface.
A had curser contains cross hairs for sighting position, while a
stylus is a pencil shaped device that is pointed to the position of
the tablet. Many graphics tablets are constructed with a
rectangular grid of wires embedded on the tablet surface.
Electromagnetic pulses are generated in sequence along the wires
and an electric signal is induced in a wire coil. In an activated
stylus or hand curser to record tablet position.
7
Downloaded from www.bhawesh.com.np
CPU
Application:
- Digitizing a drawing in a book.
System
Memory
Display
Processor
(Graphic
controller)
System bus
Date: 2065/4/19
2.2 Raster and vector display architecture:
I/O Device
Display
Commman
Other
state
Display
Controller
System bus
JAYA
RAM
Mouse
Keyboard
8
Downloaded from www.bhawesh.com.np
9
Downloaded from www.bhawesh.com.np
Date: 2065/4/20
Raster Display:
C PU
System
Memory
System bus
I/O Device
10
Downloaded from www.bhawesh.com.np
Diplay
Processor
(Graphic
controlled)
Moniter
system
memroy
Frame
Buffer
Video
Controller
Date: 2065/4/21
Video Controller:
System bus
Raster-scan
Generatro
x
Registor
I/O Device
y
Registor
Pixel
Registor
Memory
Address
Intensity
Frame buffer
Frame
Buffer
Video
Controller
Monitor
CPU
Display
processor
System
Memory
System bus
I/O Device
12
Downloaded from www.bhawesh.com.np
Date:2065/4/23
14
Downloaded from www.bhawesh.com.np
Chapter : 3
Line Drawing Algorithm:
The Cartesian slope equation of a
Scan line Algorithm:
straight line as, y = mx+b .(i)
When m represents the slope of the line and b as the y intercept.
y
Magnified phosphorous
dot trigger
(x2,y2)
y2
(x1,y1)
y1
x1
x2
m=x
2
15
Downloaded from www.bhawesh.com.np
b = y mx .(iii)
For any given x-interval
x= y
These equations form the basis of determining deflection voltage
in analog devices.
Case: I
For m < 1,
y=m
x.
Case I :
Then
y as
x = 1.
Case: II
For m >1
y=m
Yk+1 = yk + m ..(iv)
Case: II
proportional to
successive x-values.
Case III
When m = 1, then x = y and then horizontal and vertical
voltages equal.
Comments:
1. It uses multiplication
2. It uses float operation.
Therefore, 1 = m x
x = 1/m
Xk+1- xk = 1/m..(v)
Yk+1 = y k + 1.(vi)
Above equation hold for the lines processed from left end to
right end. For the reverse process i. e if the line is to be
processed form right to left then,
16
Downloaded from www.bhawesh.com.np
For m <1, x = -1
Xk+1 = xk-1
Yk+1 = yk- m
18
16
14
12
11
10
8
6
4
2
For m >1, y = -1
Yk+1 =y-k +1 (ix)
Xk+1= xk -1/m.(x)
Therefore , in general,
Yk+1 = y m
xk+1 = xk 1 for m < 1
yk+1= yk 1
xk+1 = xk 1/m
x
2 4 6 8 10 11 12 14 16 18 202224 26
for m >1
y 2 y1 30 15 15
=
= =3
x x
15 10 3
2
(10 ,15)
Eg. Example: Digitize a line with end points (10,15) and (15,
30).
Solution:
The slope of line is
m=
(11 ,17)
m >1
S.N
1
2
3
4
x
10
10
11
11
y
15
16
17
18
Comments:
1. It is faster to calculate pixel position.
2. Due to propagation of round off errors due to successive
addition the calculated pixel may shift among from the
true line path.
Algorithm:
1. Declare the variables, x1,y1 and x2 , y2 dx, dy ,del x, del y
as real and k as integer.
2. Perform
dx = x2-x1
dy = y2 y1
3. Test if |dy|<|dx| then
Steps = |dx|
17
Downloaded from www.bhawesh.com.np
k+1
d2
Plot (x,y)
End do.
Date: 2065/5/3
3.Bresenhans line Algorithm (BLA) :
DDA includes calculation related to m and 1/m which is little
complicated. Bresenhans improves DDA algorithm by only
involving integer calculation. .
13
12
Y = mx +b
Then, at smapling position (xk+1)
Y = m(xk+1) +b
From fig.
11
10
9
8
7
8
10 11
12
13
14 15
d1 = y y k
d2 = yk+1- y
d1 - d2 = (y yk) (yk+1-y)
th
18 Pk = x (d1- d2)
Downloaded from www.bhawesh.com.np
Pk+1 = pk + 2 y 2 x (vi)
Therefore, Initial decision parameter. P0
x>0,
Therefore, Pk <0 if d1 < d2
Pk 0 , if d1 > d2
Pk =
=2
= 2
x{ y-yk (yk+1 y )}
=
=
x{ 2{ m(xk+1)+b} 2 yk 1}
x 2yk
x +(2m+2b-1)
y xo- 2
=2
y xo - 2
Po = 2
x yo + 2
y+2
P0 = 2
Pk+1 = pk +2
y .(iv)
y/ x. xo
#. Digitize a line with end points ( 15, 18) and (10,15) using BLA
Pk+1 Pk = 2
xyo+ 2
x
x
y = /15-18/ = 3
x = /10-15/ = 5
m < 1, we sample at x direction.
First pixel ,(10, 15)
y (xk+1- xk) 2
Solution:
Where, C = (2m+2b-1) x is a
constant. Now, for next step,
x + 2b
=2
xk+1 Pk = 2mxk
x yo + c [ from (i)]
= 2 y xo 2
Pk =
y xo 2
y x
= 2 3- 5
=1
We know that
, If pk < 0
Pk+1 = pk+2 y
yk+1 = yk
if p 0
Pk+1 = pk + 2 y 2 x
19 Yk+1 = yk+1
Downloaded from www.bhawesh.com.np
We have pk 0,
So, p1 = p0 + 2 y 2 x
=1+2x32x5
= -3
20
19
18
P2 = p1+ 2 y
= - 3+2 x 3
=3
17
16
11
12
13 14
15
# Digitize a line with end points ( 15, 15 ) and (10, 18 ) use BLE
P3 = p2 + 2 y 2 x
= 3+ 2 x 3 2 x 5
= 9 10
= -1
and DDA.
Solution:
Pk
xk+1 , yk+1
11,
16
1
2
-3
3
12,
13,
16
17
-1
14,
17
15,
18
y = /15-18/ = 3
y = / 10-15/ = 5
m = 3/ 5 = 0.6
m < 1, we sample at x direction,
First pixel , ( 10, 15)
Note:
P0 = 2 y x
For, Pk 0 ,
=235
Pk+1 = pk+ 2 y 2 x
yk+1 = yk-1 ( when the slope is ve )
=1
We know that,
Pk < 0
If pk 0
Pk+1 = pk + 2 y
P1 = po + 2 y 2 x
Yk+1 = yk
=1+2x32x5
-3
Pk < 0
P2 = pk + 2 y.
= -3 + 2 x 3
=3
20
Downloaded from www.bhawesh.com.np
2. Load (x0, y0) into the frame buffer; that is plot the first
point.
P3 = p2 + 2 y 2 x
= 3 + 23 2 5
= -1
Pk < 0
P4 = p3 + 2 y
= -1+ 23
=5
K
0
1
2
3
4
pk
1
-3
3
-1
5
xk+1
11
12
13
14
15
yk+1
17
17
16
16
15
y.
Otherwise , the next point to plot is ( xk+1, yk+1) and pk+1= pk+
2
y2
5. Repeat step 4
20
x times.
# Digitize a line with end point s( 20, 10) and (30, 18). The slope
of the line is 0.8 using BLE.
19
18
17
16
Case:II m > 1
15
10
11 12 13
14
15 16
Date: 2065/5/4
Bresenhams line algorithm:
1. Input the tow line end points and store the end point in (x0,
y0)
d1
d2
yk+1
21
Downloaded from www.bhawesh.com.np
xk
xxk+1
y ( x- xk+1+x)
=
=
y ( 2x xk+1 + x)
y ( 2x 2xk + 1) [ since, xk+1 = xk+1]
b
y
=
yk+3
2xk
1 }
yk+2
yk+1
y/m{2(yk+1-b) 2xkm m}
x { 2 ( yk+1 b) 2 xk ( y/ x)
yk
xk xk+1 xk+2
=2
Let (xk, yk) be the pixel position determined then the next pixel
to the plotted is either ( xk+1, yk+1) or ( xk, yk+1)
Let d1 and d2 be the separation of the pixel positons ( xk, yk+1)
and ( xk+1, yk+1) for the actual line path.
Y = mx +b
The actual value of x is given by
x = (y-b)/m
Sampling position at yk+1
Pk = y ( d1- d2)
y>0
Pk < 0 if d1 < d2
Pk 0, if d1 d2
y (d1 d2)
x( yk+1-b)- 2
y . xk
y/
x}
= 2 x yk 2 y xk + 2(1-b) x y
Pk = 2 x yk 2 y xk + c ..(ii)
Let C = 2 ( 1-b) x y
Now for next step,
Pk+1 = 2 x yk+1 2 y xk+1 + c.(iii)
From equation (i) and (ii)
Pk+1 pk = 2 x ( yk+1- yk) 2 y ( xk+1- xk)
Form figure,
d1 = x - xk
d2 = xk+1 x
Let us define a decision parameter pk and Pk is defined by,
Pk =
y{2 k +1
Pk+1 = pk + 2
x ( yk+1- yk) 2
y ( xk+1 xk)
Where, , xk+1- xk = 0 or 1
If pk 0
Pk+1 = pk + 2 x 2 y
We plot , xk+1 = xk+1, yk+1 = yk+1
P< 0
Pk+1 = Pk+ 2 x
Xk+1 = xk
For initial parameter,
22
Downloaded from www.bhawesh.com.np
Po = 2
x yo 2
y xo +c
t = x1; x1 = x2 ; x2 = t
=2
x yo 2
=2
x yo 2
=2
x yo 2
=2
x yo 2
y xo + 2
Po = 2
y xo + 2 ( 1-b)
y xo + 2
x 2b
t = y1 , y1 = y2 ; y2 = t.
ii. Find initial decision parameters. P = 2dx dy
iii. Plot the first point (x1,y1)
iv.
x 2 x yo + 2. ( y/ x).xo
x-
Else, P = P+ 2dx-2dy
X1 = x1 +a
Date: 2065/5/10
2.
The cicle function tests are performed for the mid position
between pixels near the circle path at each sampling step.
yk
yk -1
Mid
x +
Point
y2
=r
(0,r)
(-y,x)
(y,x)
xk xk+1 xk+2
(-x,y)
(x,y)
(r,0)
(-x,-y)
Here assume that we have just plotted the pixel (xk,yk ). We next
need to determine whether the pixel at position (xk+1,yk) or the
one at the position (xk+1,yk-1) is closer to the circle.
(x,-y)
(-y,-x)
(y,-x)
..(iv)
If pk< 0 , this mid pixel is inside the circle and the pixel on the scan
line yk is closer to the circle boundary . Otherwise the mid point is
outside or on the circle boundary , and we select the 24 pixel yk -1,
successive decision parameters can be obtained
= (xk+1+1) + ( yk+1-1/2) r
(v)
= 1 + r r + 1/4 r
Po = 5/4 r
Po = 1-r
P = 1-r .(ix) since 5 and 4 are integer values so can be
rendered off.
2
Date: 2065/5/12
25
Downloaded from www.bhawesh.com.np
K
1
1
2
3
4
5
6
Pk
-9
-6
-1
6
-3
8
5
xk+1 yk+1
(1,10)
(2,10)
(3,10)
(4,9)
(5,9)
(6,8)
(7,7)
2xk+1
2
4
6
8
10
12
14
2yk+1
20
20
20
18
18
16
14
10
9
Yk+1 = yk
Pk+1 = pk + 2xk+1 2yk+1 + 1 (pk 0)
Yk+1 = yk -1
K
0
1
2
3
pk
-4
-1
4
3
xk+1 yk+1
(1,5)
(2,5)
(3,4)
(4,3)
2xk+1
2
4
6
8
2yk+1
10
10
8
6
(1,5)
(-1,5)
(-1,-5)
(1,-5)
(5,1)
(5,-1)
(-5,-1)
(-5,1)
Actual pixel
(3,8)
(x,y)
(1,8)
(-x,y)
(1,-2)
(-x,-y)
(3,-2)
(x,-y)
(7,4)
(y,x)
(7,2)
(y,-x)
(-3,2)
(-y,-x)
(-3,4)
(-y,x)
(2,5)
(4,8)
(-2,5)
(0,8)
(-2,-5)
(2,-5)
(5,2)
(0,-2)
(4,-2)
(7,5)
(5,-2)
(7,1)
(-5,-2)
(-5,2)
(-3,1)
(-3,5)
Other pixel
(1,5)
7
6
5
4
3
2
1
0
0
6 7
(2,5)
26
Downloaded from www.bhawesh.com.np
(3,4)
(3,4)
(-3,4)
(-3,-4)
(3,-4)
(4,3)
(4,-3)
(-4,-3)
(-4,3)
(5,7)
(-1,7)
(-1,-1)
(5,-1)
(6,6)
(6,0)
(-2,0)
(-2,6)
8
7
6
5
Centre
4
3
2
1
(4,3)
(4,3)
(-4,3)
(-4,-3)
(4,-3)
(3,4)
(3,-4)
(-3,-4)
(-3,4)
(6,6)
(-2,6)
(-2,0)
(6,0)
(5,7)
(5,-1)
(-1,-1)
(-1,7)
0
-1
-2
-3
-4
-5
-6
-7
-8
-8 -7 -6 -5 -4 -3 -2 -1 0 1 2
3 4
5 6
Complete
Algorithm:
1. Get the input centre (xc, yc) and radius of the circle.
2. Set x = 0, and y = r.
3. Plot the first point and its symmetry at appropriate
positions by x = x+xc , y = y + yc
4. Compute the initial decision parameter. P = 1- r
5. Repeat the following till x < y.
i. Set x = x+1.
ii. Check if P< 0 then.
27
Downloaded from www.bhawesh.com.np
P = P+2x +
1 Else,
y = y-1
p = p+2x 2y +1
iii. Shift the point (x, y) and its symmetry points by x = x+xc
, y = y+yc and plot.
iv. sdf
Ellipse: Ellipse is an elongated circle. Therefore elliptical curves
can be generated by modifying circle drawing
procedures to take into
account the different dimensions of an
ellipse along the major and minor axes.
The equation of ellipse in standard form is given by
,
2 2
2 2
x /a + y /b = 1
2 2
Therefore, y = +- b (1-x /a )
y
(0,b)
(-x,y)
R1
b x +a y -a b = 0
(x,y) R2
2b
yk
(a,0)
2a
y
(-x,-y)
k-1
(x,-y)
(mid point)
x x
k
k+1
28
Downloaded from www.bhawesh.com.np
}
If Pk< 0, mid point lies inside the ellipse, So we plot,
(xk+1, yk) i.e xk+1 = xk +1. yk+1 = yk
2
2
2
Therefore, Pk+1 = pk + b { (xk +1) + 2xk+1+1 (xk + 1) } +
2
2
2
a {(yk ) (yk ) }
2
pk+1 = pk + 2b xk+1 + b
.(iii) Where,
xk+1 = xk + 1 , yk+1 = yk
If Pk 0, the mid point
lies outside the ellipse so we plot
(xk+1, yk-1). i.e xk+1 = xk +1 , yk+1 = yk -1.
2
2
2
Therefore, Pk+1 = pk + b {(xk +1) +2 (xk +1)+1}+a {(yk-12
2
1/2) (yk -1/2) }
2
2
2
= pk + b {2xk+1+1} +a {(y k-1/2) 2(yk ) +1 (yk
2
2
2
2
) } = pk + 2b xk+1 + b - 2a yk+1
2
2
Therefore, Pk+1 = pk + 2b xk+1 2a yk+1 +
2
b Where,
Xk+1 = xk +1
Yk+1 = yk -1
Now initial decision parameter is given by is given by ,
P0 = f(x0+1, y0 -1/2)
= f(0+1, b-1/2)
2 2 2
2
2 2
= b 1 +a (b-1/2) a b
k-1
(mid point)
k x
k+1
P1 = b -
P1 = p1+2b x- 2a y = b
30
Downloaded from www.bhawesh.com.np
For region R1
K
0
1
2
pk
-151
233
745
2b xk+1
576
576
-
(xk+1,yk+1 )
(8,2)
(8,1)
(8,0)
2a yk+1
256
128
-
2b xk+1 2a yk+1
pk
(xk+1, yk+1)
-332
(1,6)
72
768
-224
(2,6)
144
768
-44
(3,6)
216
768
-208
(4,5)
288
640
-108
(5,5)
360
640
288
(6,4)
432
512
244
(7,3)
504
384
2
2
We now move out of region 1, since 2b x >2a y
For region 2, the initial point is (x0,y0) = (7,3) and the initial
decision parameter is
2
2
2 2 2
P0 = b (x0+1/2) +a (y-1) a b
2
2
= 36(7+1/2) + 64(3-1) 36 64
= 36 225/4 + 644 3664
= - 151
The remaining positions along the ellipse path in the first
quadrant are then calculated as
If pk > 0
k
0
1
2
3
4
5
6
7
6
5
4
3
2
1
0
0
7 8
31
Downloaded from www.bhawesh.com.np
other three quadrants are loaded into the frame buffer using the
set pixel routine.
P(x,y)
p (x,y)
Other Transformation
1.reflection
2.Shearing
x'
x
=
y'
t+x
y'
ty
P(x,y)
p (x,y)
32
Downloaded from www.bhawesh.com.np
P(x,y)
sx 0 x
0 sy y
p (x,y)
(x y
f , f)
i.e
p = S (sx, sy).P(x,y)
.
Scaling:
# Scale the given triangle whose co- ordinate values are (2,3),
(1,2) , (3,4) where the scaling factor is (2,3) about (i) origin (ii)
about fixed point (1,2)
P(x,y)
p (x,y)
Where
S (sx, sy) is a scaling matrix
If sx = sy scaling type is uniform
If sx is not equal to sy scaling type is differential.
p (x,y)
In matrix form,
Types of rotation:
a. About origin
b. About any point
33
Downloaded from www.bhawesh.com.np
p (x,y)
(x
r , yr)
x
o
x- xr
y = r sin( + )
Do yourself .
cos
sin x
y'
y
Sin
cos
Date: 2065/5/18
Matrix Representation and Homogeneous Co-ordinates:
To treat all the transformation in the same manner, homogeneous
co-ordinate are used for reapresentation. Each points (x,y) is
represented by triple (x,y,h).
(x,y,h) and (x,y,h) represent same point if on one is multiple
of other.
Ie x/x = y/y = h/h
So, (x,y,h) and (x/h, y/h,1) also represent same point, for
simplicity we use h = 1.
Therefore, (x,y) in Cartesian system is represented as (x,y,1) in
homogeneous co-ordinate system.
Now (22) matrix is changed into 3 3
matrix, 34 For translation:
x'
y'
1 0 t xx
y
1 ty
=0
0 1z
z'
Sin
z'
0 y
= Sin
0 x
cos
cos
1 z
1 0 t x1
=0
0
P = R( ). P
=0
sx 0
= 0
0 x
y1
1 0 t x1
0 10
0 tx + tx
1
y1
0 1
2
1 ty1 + ty2
0
0 y
1 z
z'
0 0
Inverse Transformation:
For inverse translation:
-1
T (tx,ty )= T ( -tx , -ty )
For inverse Rotation:
-1
R ( = R( - )
-
Solution:
35 # Prove that two successive scalings are multiplicative.
Downloaded from www.bhawesh.com.np
2 0
=0
0
0
0
y2
0 sx1 0
0
y1
sx1 sx2
0
0
0 1/ 2 1/ 2 0
0
2/ 2
y1
x2
0
2/ 2
3/ 2 3/ 2 0
0
0
1
s s
1/ 2 1/ 2 0
=
sx2
2/ 2
2/ 2 0 7
3 / 2 3 / 2 0 15
B=TB
2/ 2
Solution:
2/ 2 0 5
3/ 2 3/ 2 0 8=
0
A(7,15)
1 1
C = TC
C (10,10)
2/ 2
B(5,8)
2 / 2 0 10
3 / 2 3 / 2 0 10
= 30 / 2 + 30 / 2 + 0
40 / 2
=
1
0
20 / 2 + 20 / 2 + 0
0 0 cos 45
Sin45
3 0 Sin45
cos 45
0 + 0 + 0 +1
36
0
Downloaded from www.bhawesh.com.np
Step 1: Translate the object such that fixed pont moves to origin
i.e T(-xr,-yr) .
Step 2: Rotate the object coordinate origin i.e R() .
Step 3: Translate back the object so that the pivot point is
returned to its original position T(xr,yr).
This transformation sequence is illustrated in fig below.
x y
( r, r)
=0
sin
0 1
xr
cos
0 0
1 0 0
x y
y sin
0 0 1
x y
( r, r)
0 xr cos
( r, r)
37
Downloaded from www.bhawesh.com.np
( r, r)
C(10,10)
B(5,8)
1 0 xf
Net Transformation T = 0 1
Step:1
T(-5,-8)
Step: 2
(xf,yf)
R(90 )
Step: 3
T(5,8)
Step: 4
T(-10,-10)
Step:5
S(2,2)
Step: 6
T(10,10) Net
transformation:
T(10,10). S(2,2). T(-10,-10).T(5,8).R(90) . T(-5,-8)
sx
y
0 0 1
0 sy
0 0
0
0 sy
0 0
1
1 0 0
f
1
x f (1 sx )
y f (1 s y )
0 0
sx
0 1 0 xf
Date: 2065/6/5
# Rotate the ABC by 90 anticlock wise about ( 5,8) and scale
it by (2,2) about (10,10)
Solution:
10 2 0 0 1
0 10 1
5 cos 90
sin 90
=0
10 0 2 0 0
1 10 0
8 sin 90
cos 90
0 0
0 01
0
0
Other transformation:
1. Reflection
38
Downloaded from www.bhawesh.com.np
1 0 0 1
0 0
2. Shearing.
Reflection: Providing a mirror image about an axis of an object
is called reflection.
(i) about x-axis (y =0) x
=x
y = -y
In matrix from,
x'
y'
1
1 0
P = Rfy.P
Rfy = Reflection matrix about y-axis
y
2
2
Reflected object
Original position
3
x
0 x
=0
1 0 y
0
P = Rfx.P
Rfx = Reflection matrix about x-axis
y
Date: 2065/6/6
1
Original position
2
3
x
3
Reflected object
1
x'
y'
1
0 y
1
= sin 90
0
0 1 0 1 0
=1
0 0
sin 90
cos 90
39
0
0
Downloaded from www.bhawesh.com.np
1 0 0
01
1
0
1
0
0 cos 90
sin 90
0 sin 90
cos 90
1 0
1 0 1 0
1 0
01
0 1
1 0 0
1 0
y = x
0
0
0
0
0 0
0
0
0 1
p(x,y)
p(x,y)
p(x,y)
45
= sin 45
0 1
cos 45
cos 45
0 0
= 1
0 cos 45
0 sin 45
0 0 1
sin 45
= sin 45 cos 45
01
0
0 cos 45
sin 45
0 sin 45
cos 45
0 0 1
sin 45
cos 45
2
1
2
0
2
1
2
0
.i.e x = y
40
Downloaded from www.bhawesh.com.np
0
1
0
0
1 0 0
0 1 0
0 0 1
2
1
2
0
2
1
2
0
0
0
1
1
0
2
1
2
0
0 1
(5) R(0,2)
2
0
2
1
2
0 1 0
1 0 0
0 =
y
(0,2)
0 0 1
y+x = 2
i. e x = -y
y = -x
(2,0)
y
R(45 )
Rfx
R(-45)
R(0,2)
cos
sin
0
1
sin
cos
0 0 b
cos
sin
0 1 0
sin
cos
0 0
0
1
1 b
0 0 1
1 0 0 1
cos
sin
0 sin cos
b sin
b cos
1
0
1 b
0 0 1
41
Downloaded from www.bhawesh.com.np
0
1
1 0 0
0 cos sin 0 cos
sin
0 1
1 0 0
=0 1 b
0
Reflection:
0 1
1 + m2
m
2
1+m
0
1 + m2
1
1+ m
2m
+m2
0
1
1+m
0
1 0 0
=0 1 b
0
1+m
m
1+m
0
1+m
1
1+m
1
1+m
0
1+m
1
2m
2bm2
2
1+ m
1+ m
2
2
m 1 bm +b
1+ m 2
1+ m
(0,3)
1
45
x
2
1
1+m 1+m
1
1 +m 1+m
0
0
1+m
2b
1+m
1
2
= 2mm
(-b,0)
2bm
2m
(0,b)
(-b,0)
42
Downloaded from www.bhawesh.com.np
c(x,y) c(x,y)
clip
The procedure that identifies these portions of the picture that are
either inside or outside of the specified region of span is
clipping .
x1
About x-axis
y = y
x= x+x1 where,
x1 y
x1 = Shx.y
where, Shx is shearing constant.
y = y
x= x+shx.y
In matrix form,
x'1 shx
y'
1
Line clipping:
p2
clip
p1
B
B
y'
= sh
0 0 x
1
p1
0 y
p3
p2
0 x
=0
0 y
1
P = SHy.p
2D window clipping:
43
b4 : above
1000
0001
0000
0010
0100
0101
1010
0110
p3
(x
p2
wmin
,
p3
(x
wmax)
wmax, wmax)
p2
p4
p1
(x
wmin, wmin)
(x
wmax, wmin)
P1 AND P2 = 0
So we need further
calculation. Starting form p1,
Intersection of P 1 with left boundary is
calculated. Region code of P1 = 0000
P1 AND P2 = 0 .
Intersecting of P2 with above boundary is calculated region code
of p2 = 0000
Since both end points have region codes (0000) .So P1, P2
portion of the line is saved.
Similarly,
For P3 , P4.
P3 = 1000
P4 = 0010
P3 AND P4 = 0
So we need further calculations; starting from P3 region code of
P3 is 1000, i.e b4 is high, so intersection of P3 with upper
boundary which yields P3 having region code 1010.
Again p3 AND P4 0
So P3P4 is totally clipped.
The intersection point with vertical boundary can be obtained by
y = y1 + m(x-x 1)
44
Downloaded from www.bhawesh.com.np
Where (x1,y1) and (x2,y2) are end points of line and y is the coordinate value of intersection point where x value is either xwmin
or xwmax and m = y2 y1 / x2 x1 .
Similarly , intersection point with horizontal boundary
x = x1 + (y-y1)/m
Where , y = ywmin or ywmax
# Use cohen Sutherland algorithm to clip the line for the
following dimensions. Line endpoints (15, 45) and (25,15)
Window:
Lower left: ( 10, 20)
Upper right : ( 30, 40)
Date: 2065/6/7
wmax
wmin
wmin
wmax
World Co-ordinate
45
Downloaded from www.bhawesh.com.np
vmax
vmin
x vmin
vmax
Device co-ordinate
Map viewing
Construct world
co-ordinate
scene using
modeling co-ordinate
transformation
co-ordinates to
Normalized viewing NVC
Map normalized
DC
viewpoint to
Co-ordinates
co-ordinates
device
to viewing
co-ordinate
using window
viewpoint
Specification
co-ordinate
Convert world
WC
VC
Viewport
yo
xo
world
World co-ordinate
window
wmax
vmax
y
y
y wmin
wmin
World co-ordinate
46
Downloaded from www.bhawesh.com.np
w max
vmin
vmin
vmin
vmax
Device co-ordinate
( wmax, wmax)
( vmax, vmax)
(x,y)
(u,v)
ux
w min
v min
=x
x
x
w max
w min
v max
v min
yy
uy
w min
v min
Or, y y
= y
y
w max
w min
v max
v min
x x
v max
w min
x
Sx = x
w max
w min
y y
v max
w min
Sy = y
y
w max
( wmin, wmin)
w min
v max
( vmin, vmin)
1
0
0
1 y
x
v min
x
w min
w max
0
v min
Twv
w min
v max
w min
xw min
0 1 y
w min
w max
w min
Net transformation,
Twv = T (xvmin, yvmin). S(sx, sy).T(-xwmin, -ywmin)
47
Downloaded from www.bhawesh.com.np
(ii)
.....................
100
B
C
D
Implementation of Stack:
Stack can be implemented in two ways:
1. pointer (Linked list)
2. Array
Push operation:
Step 1: Check for the overflow
If TOS = size
Output: stack overflow and exit.
Step 2: Increment the pointer value by one
TOS = TOS +1
Step 3: Perform insertion
48
Downloaded from www.bhawesh.com.np
S[TOS] = value
Step 4: Exit
POP operation:
Step 1: Check for the underflow
If TOS = 0
Output: Stack underflow and exit
Step 2: Decrement the pointer value by one
Value = S[TOS]
TOS = TOS-1
Step 3: Return the former information of the stack
Return [value]
Step 4: Exit.
PEEP operation: If one interested only about an information
stored at some location in a stack, then peep operation is
required. In this operation we simply move the pointer to the
desired location and then fetch the information associated with
the location.
Step 1: [ Check for the stack underflow]
If TOS-i+1 < 0
Output : Stack underflow and exit.
th
Step 2: [Return the i element from the top of the stack]
Return[S(TOS i+1)]
Date: 2065/6/8
Update Operation: It is required when the content of some
location in a stack is to be changed. Suppose one wants to update
th
information at the i location in the stack s. We move TOS
th
pointer to the i location from the top of the stack and input the
new value of that location.
Queue:
Deletion
49
Downloaded from www.bhawesh.com.np
Front
insertion
Rear
11 22
Rear
2
3 4
22
33
Front
33 44
Step 4:
Step 5:
3 4
22
33 44
Front
1
Q[rear] = value
[ Set the front pointer ]
If front = 0
Front = 1
Return
Front
Rear
44 55
Rear
Step 4:
Algorithm to insert an elements into queue:
Step 1: [check overflow condition]
If rear size
o/p : overflow and return
Step 2:
nter]
Step 3:
Return (Value )
2 3
11
22 33
44 55
(a)
33
44 55
(c)
6
22 33
44
55
(b)
33
44 55
66
(d)
Circular queue:
Suppose we have an array Q that contains n element in
in the array. When this technique is
50 which Q1 comes after Qn
Downloaded from www.bhawesh.com.np
(viii)
77
66 55
(x)
44 33
77 66
55
Insert 33
Delete 88
F
Q[2]
Linked List :
Q[1]
Node 2
.
Node 3
.
Node 4
.
\o
node
(iv) 99
information
88 77
F
(v)
(ii) 99
R
99 88 77 66
Insert
99
Insert 66
FR
(iii)
99 88
(vi)
88 77 66
Insert 88
Delete 99
F
(vii)
88
77 66 55
(ix)
44
77
Insert 44
Insert 55
F
66 55
T3
T2
N2
N13
N4
N3
N12
information
N5
right link
right link
left link
N6
N8
N9
N11
N10
N18
N7
N14
left link
N15
N16
N17
node
N
N =NULL = \0
ROOT
Binary tree
T1
Left child
Right child
T2
Forest:
N2
N5
N6
N1
Expression :
E = v + u/x* y-z
N3
N7
Z
N18
N8
N14
N9
N15
+
N16
V
N17
y
.
u
Implies that there is only one node in the tree that is root.
e1
v1
Level 0
Level 1
e4
v4
10
11
12
13
14
15
e5
e6
e7
v4
e2
e7
v5
v3
e8
Fig.(e)
v2
e3
v6
e9
Fig.(d)
v2
e1
e4
Level 4
e2
Level 5
e4
e2
v3
e5
v5
Level 3
v2
e3
e6
Level 2
e1
v1
e3
v3
v1
Fig.(f)
RAB
ARB
ABR
v2
Fig.(a)
v1
v2
Fig.(b)
v1
From the figure it is clear that fig. (a) consists of two vertices
each one is stand alone. Fig (b) contains an undirected graph
having one edge and two vertices. Fig. (c) consists of two
vertices and one edge and it is called directed graph. Fig. (d)
illustrates an undirected graph with six vertices and nine edges.
Fig (e) is a directed graph with five vertices and seven edges. Fig
(f) consists of three vertices and four edged in which two edges
are directed and two are undirected known as mixed graph.
Path: A sequence of edges of a digraph (directed graph) such
that the terminal vertex of an edge sequence in the initial vertex
of the next if exits is called the path. For example:
v2
Fig.(c)
54
Downloaded from www.bhawesh.com.np
v1
e5
e6
v2
e8
v4
e4
e2
e7
v5
v3
e3
Similarly in 3D,
x = x1+(x2-x1)u
y = y1+(y2-y1)u
y = z1+(z2-z1)u
Let direction of projection is given by vector [xp,yp,zp] and the
image is to be projected on the xy-plane. If we have a point on
the object at (x1,y1,z1) and the projected point be (x2,y2) then the
equation of the line is ,
x = x1+xpu
y = y1+ypu
z = z1+zpu
But on the xy
plane 0 = z1+zpu
u = -z1/zp
x2 = x1-z1(xp/zp)
y2 = y1-z1(yp/zp)
Parallel projection:
x = x1+(x2-x1)u
y = y1+(y2-y1)u u [0,1]
In Matrix form ,
Date: 2065/7/25
Extension of two-dimensional to three dimensional
transformation:
AB = perspective projection of AB
57
Downloaded from www.bhawesh.com.np
Inverse translation,
T-1 (tx,ty,tz) = T(-tx,-ty tz)
Scaling:
(i) About origin:
Explicit expression:
X = x*sx
Y = y*sy
Z= z*sz
- The matrix representation for the scaling x-formation of a
position p(x,y,z) relative to the co-ordinate origin.
Matrix form:
58
Downloaded from www.bhawesh.com.np
Axis of rotation
X
Y
Z
Rotation:
About y-axis:
Y = y
z = zcos xsin
x = zsin+ x cos
Date: 2065/7/27
(ii) For step II rotation can not be performed directly since the
rotation is not about any of the co-ordinate axis hence. It is done
in two steps.
(a) Rotation by angle about x axis.
(b) Rotate by angle about y axis.
Let p1, p2 be the two end points of axis of rotation then the
axis vector is given by:
Step (a)
Angle for rotation of u around x-axis into xz plane is equal to
angle between u (projection of u on yz plane and z-axis ).
61
Downloaded from www.bhawesh.com.np
Step: 5
T(x1, y1,z1)
Net transformation,
-1
-1
= T(x1,y1,z1). R x( ) R y() R2(). Ry().Rx( )T(-x,-y,-z)
Date:2065/7/28
Steps (b)
U moves to the position u after being rotated by about x axis
so the position of ' ' ur is given by
u = Rx( ).u
Reflection:
(i) About Axis: Reflection about axis is equivalent to 180
rotation about the axis.
About z-axis:
About x-axis:
About y-axis:
Step: 4
(a) R-1 y()
(b) R-1 x( )
62 Net transformation:
Downloaded from www.bhawesh.com.np
63
Downloaded from www.bhawesh.com.np
Date:2065/8/4
64
Downloaded from www.bhawesh.com.np
Date: 2065/8/5
E4
E3
S2
5
E5
V2
E2
V3
Vertex
V1
V2
V3
V4
coordinate
(x1,y1,z1)
(x2,y2,z2)
(x3,y3,z3)
(x4,y4,z4)
V5
V4
E1
E2
E3
E4
E5
Surface table:
Surface
S1
S2
(v1,v2)
(v2,v3)
(v3,v1)
(v1,v5)
(v3,v4)
Edge
(E1,E2,E3)
(E3,E4,E5,E6)
(x5,y5,z5)
65
Downloaded from www.bhawesh.com.np
B(x2,y2,z2)
V2
V1
A(x y z )
1, 1, 1
D(x4,y4,z4)
BV2(x2,y2,z2)
D
C
V3(x3,y3,z3)
1 y 1 z1
A = 1 y2 z 2
y z
1 3
3
x
B=
x1
2
x3
x1
1 z1
1
1
z3
y1 1
C = x2 y 2 1
x3
D=
y3 1
x1 y1
x2 y2
x 3 y3
A
V1(x1,y1,z1)
z1
z2
z3
V2 = OB = (x2,y2,z2)
V3 = OC = (x3,y3,z3)
Taking cross product AB AC
AB = OB OA
= (x2-x1, y2-y1,z2-z1)
AC = OC OA
= (x3-x1,y3-y1,z3-z1)
66
i
g
AB AC =
x1
y 2 y1 z 2
x1
x2
y 3 y1
z3
B(1,1,0)
C(1,1,1)
= i {(z3-z1).(y2-y1) (z2-z1).(y3-y1)}
= -j { (x2 x1)(z3 z1) (z2 z1)(x3-x1)}
= k {(x2-x1) (y3 y1) (y2-y1)(x3-x1)}
Component of y
i=
2
y y
3
y1
0y
R2 R1+R2
R3 R1 +R3
y1
y3 y1
z
1
N = AB AC
AB = OB OA
z1
z
2
z3
1
z
z3
Y
A(1,0,0)
= (1-1,1-0,0-0)
= (0,1,0)
z
1
AC = OC OA
=(1-1,1-0,10) = (0,1,1)
N = AB AC
Similarly,
B = Component of j
C = component of k
Hence , the plane coefficients (A,B,C) gives normal vector to the
plane. Further , if P(x,y,z) be any point on the plane then,
N.P = (A, B, C). (x,y,z)
= Ax+By+Cz
D = -N.P
= (0,1,0)(0,1,1)
= j(j+k)
= 0+i
=i
= (1,0,0)
Therefore, A = 1, B= 0, C=0
r r
D = N .P
Eg.
= -(1,0,0).(1,0,0)
= -1
D =1
equation of plane is
67
Downloaded from www.bhawesh.com.np
Ax+By+Cz+D = 0
Or , x-1 = 0
The plane equation are used ot determine the positon of spatial
points relative to the palne surface of an object .
If p(x,y,z) is any point on the plane then the distance between
the point and the plane is
d=
Ax + By + Cz
2
+B
+C
68
Downloaded from www.bhawesh.com.np
(A,B,C)
Xv
V
Zv
Fig. A polygon surface with plane parameter C<0 in a righthanded co-ordinate system is identified as a back-face when the
viewing direction is along the ve vz axis.
Object is centered at origin if D > 0 (back face) else front face.
Y
2
S1
Xv
(x,y)
Depth buffer: To sore the depth value for each (x,y) position as
surface S are processed.
A Refresh buffer: To store the intensity value for each position.
- Initially , all positions in the depth buffer are set to 0 (minimum
depth) and the refresh buffer is initialized to the back-ground
intensity.
-
Zv
After all surfaces have been processed the depth buffer contins
depth values for visible surfaces and refresh buffer contains
corresponding intensity values for those surface.
Where,
Isurface(x,y) is the projected intensity value for the surface at
pixel position (x,y).
The mathematics involved (Calculation of z-value):
Depth values for a surface position (x,y) are calculated from the
plane equation for each surface.
Z = (-Ax By D)/C
From position (x,y) on a scene line the next position across the
line the next position across the line has co-ordinates(x+1,y) and
the position immediately below on the next line co-ordinates
(x,y-1).
Now we determine the depth of the next position (x+1,y) as
Depth (x+1,y).
Z = [-A(x-1)-ByD]/C Or, z = z A/C
x x
k+1
left edge
intersection
y scan line
71
Downloaded from www.bhawesh.com.np
iii)
y scan line
Scan Line 1
A
S1
S2
Scan Line 2
C
H
D
Scan Line 3
G
x
72
Downloaded from www.bhawesh.com.np
73
Downloaded from www.bhawesh.com.np
II. Scan line across light using background color until flag
goes ON.
III. When one flag is ON , enter intensity of that surface to
refresh buffer.
IV. When two or more flags are ON, do depth sorting and
stored the intensity of pixel nearest to the view plane.
Need for Shading in Engineering Data visualization: The
realism of a raster scan image of a 3D scene depends upon the
successful stimulation of shading effects.
Once visible surface has been identified by hidden surface
algorithm , a shading model is used to compute the intensities
and color to display for the surface.
The Shading model doesnot precisely stimulate the behaviour
of light and surfaces in the real world but only approximation
actual condition.
The shading model has two components.
1. Properties of surfaces
2. Properties of illumination falling on it.
The principle surface property is its reflectance which determine
how much of the incident light is reflected.
- If a surface has different reactance for light of different
wavelength, it will appear to be color.
- If a surface is texture or has a patterned printed on it, the
reflectance will vary with position on the surface.
- Another surface property that play a role in shaded picture is
transparency.
Light Source:
Reflecting surface
eye
74
Downloaded from www.bhawesh.com.np
i=r
or cos ri = cos r
or L . N = N . R
Reflection of light:
I
In ideal reflection i = r
Let L be the unit vector along incident ray. N be the unit vector along
normal ray. R be the unit vector along reflected ray then, 75
Downloaded from www.bhawesh.com.np
Ia
Ia
diff
dA
N
energy
76
Downloaded from www.bhawesh.com.np
Idiff = kd Il cosr
= kdIl ( L.N )
Total diffuse reflection = Diff ( due to amb.)+Diff. due to
pt.source.
= kaIa +kdIL( L.N )
N
L
(small ns)
Shiny surface
(large ns)
Dull surface
Specular Reflection:
In shiny surface we see high light or bright spot from certain
viewing directions called specular reflection. This is due to total
or nearly total reflection of light.
For ideal reflector,
(perfect mirror) = = 0
77
Downloaded from www.bhawesh.com.np
Silver
P
Gold
0.5
N
Dilelectric
(glass)
0
90
= ksIL (V R )
I2
N3
I2
I1
N2
N1
N3
N4
This method is faster and simple but not realistic and holds
following assumptions:
(a) Object is polyhedron and is not an approximation of an
object with a curved surface.
(b) All light sources are sufficiently far from the object so that
r
N . L is constant.
(c) The viewing position is sufficiently far so that V . R is
constant.
Nv
Steps:
(i)
N
i
N +N +N +N
= r1 r2 r3
r4
N1 + N 2 + N3 + N 4
Disadvantage:
- The intensity discontinuity occurs at the border of the two
surfaces.
(ii)
(iii)
79
Downloaded from www.bhawesh.com.np
y1 y2
y4
y1 y2
I2
(x4, I4)
(x5, I5)
(xp, ?)
(y1, I1)
(y2, I2)
(y4, ?)
1
p
N2
N 3
I2
x+1
Similary,
IP = x5 x p I 4 + x p x4 I 5
x5 x4
Nv
x5 x4
Steps:
I = y y2 I1 + y1 y I 2
y1 y2
y1 y2
I = ( y 1) y2 I1 + y1 ( y 1) I 2
y1 y 2
y1 y2
I = I +
I I
2
avg
x5 x4
I = I +
I4 +
Ni
y1 y2
(x +1) x4
I5
x 5 x4
I5 I 4
x5 x4
80
Downloaded from www.bhawesh.com.np
Chapter:4
NEED FOR MACHINE INDEPENDENT GRAPHICAL
LANGUAGE
N
p
Np
N5
N
N2
N
x1
GRAPHICS SOFTWARE
There are two general classifications for graphics:
xp+1
yy
N=
y1 y 2
.N1 +
y y
1
y1 y 2
.N 2
( y 1) y2
.N 1
y1 y2
N2 N 1
N '= N +
y1 y2
+y
( y 1)
.N
y1 y 2
x5 x p
xP x
.N +
N
x5 x
x5 x
x5 x
Comments:
(i)
Requires more calculation and hence time consuming.
(ii) Produces more realistic.
81
Downloaded from www.bhawesh.com.np
SOFTWARE STANDARDS
The primary goal of standardized graphics software is
portability.
When packages
are designed with standard graphics
functions, softwares can
be moved easily from one
hardware system to another.
Without standards, programs designed for one hardware
often cant be transformed to another system without
extensive rewriting of the programs. Thus we require
machine independent graphical language.
and national
standards
planning
International
organizations in many countries have co-operated in an
effort to develop generally accepted standard for computer
graphics.
Graphical Kernel System (GKS) was adopted as the first
graphics software standard by the International standard
Organization (ISO) and by various national standards
organizations, including the American National Standards
Institute (ANSI).
Although GKS was originally designed as a 2D graphics, a
3D GKS extension was subsequently developed.
The second software standard to be developed and
approved by the standards organization was PHIGS
(Programmers
Hierarchical Interactive
Graphics
Standard) which is an extension of GKS.
Increased capabilities for object modeling,
color
specifications and picture manipulations are provided in
PHIGS.
82
Downloaded from www.bhawesh.com.np
All the bitmap based to graphics programs can use any of the
file formats listed in the fig. below:
Format
Description
1. BMP
A graphics format which is used
in windows BMP is used for
wall paper.
2. PICT
(picture). It is generally used on
MACS computers.
3. TIFF
(Tagged Image file format).A bit
map format defined in 1986. by
Microsoft and Aldus and widely
used in both Macs and PCs. This
format is usually the best to use
when exchanging bit map files
that will be printed or edited
further.
4.JPEG
(Joint
photographic
expert
group).This bit map format is
Common on the world wide web
and is often used for photos and
high resolution images.(24-bit or
millions of colors )that will be
viewed on the screen.
5. GIF
(Graphic
Interchange
Format).Like JPEG images GIF
images are often found on world
wide web pages. Unlike JPEG
images, GIF images are reduced
to 256 or fewer unique colors.
6. PNG
(portable, network graphics).
This format was developed as an
alternative
to
GIF
and
JPEG.PNG, like JPEG, can store
the color images in a small
amount of space, but PNG file
can also store transparency
information the way GIF files
do. The PNG format was
initially designed for use in web
pages.
Most vector base programs create and save file in a proprietary
file format. These formats are either incompatible with other
programs not totally supported by other programs. In the later
case, other programs may use import filters to use these file
formats. Import filters never work perfectly because program
using the import filter will not have the same exact features as
the program that created the file. This lack of commonality has
forced the software developer to create universal files formats,
which enables user of one program to work with files created -in
other programs. Only a handful of common file formats such as
date exchange formats (DF) and initial graphics exchange
specifications (IGES), exists for vector graphics. This universal
format should enable you to create a vector file in one program ,
such as AUTOCAD and use it in another program such as corel
DRAW or VISIO.
Graphics software:
1. Paint program: Paint program works with bit map images.
2. Photo manipulation program: It works with bit map images
and are widely used to edit digitized photographs.
83
Downloaded from www.bhawesh.com.np
Chapter:5
PROJECT MANAGEMENT
A project is an inter-related set of activities that has
definite starting and ending point that result in a unique product
or service. Each project is unique, even if it is routined.
Uncertainties such as the advent of new technologies or the
timing of certain events can change the character of projects.
Projects are temporary activities as personal materials and
84
Downloaded from www.bhawesh.com.np
2. PROJECT TEAM
The project team is a group of people often
differential functional areas or organizations, led by
the PM.
Members of the project team may be the represent
the supplier of essential materials, components or
services and may be actively involved in the
conduct of the project.
The size and constituency of the team may fluctuate
during the life of the project.
1. PROJECT MANAGER(PM)
Project manager integrate people from various
functional areas to achieve a specified project goals.
Traditional organization hierarchy tends to slow
progress on project because of lack of
communication, coordination and some time
motivation.
A project manager can overcome these road blocks
to project compilation.
A project manager is responsible for establishing
the project goals and providing the means to achieve
them.
The project manager must also specify how the
work will be done and ensure that the appropriate
85
Downloaded from www.bhawesh.com.np
S
U
3
2
S and T must be
completed before U can
be completed.
2
U
4
1
AON
S
1
T
2
U
3
Activity Relationship
US
Dummy
AOA
Dummy
T
precedes T which
precedes U.
87
Downloaded from www.bhawesh.com.np
U
3
I
A
F
START
FINISH
C
A
B
C
D
E
Select administrative
and medical staff
Select site and do site survey
Select equipment
Prepare final construction
plants and layout.
Bringing utilities to the site
A
B
G
H
I
J
K
2
A
C
START1
C
B
D
A
E,G,H
F,I,J
J
G
FINISH
9
D
4
Jan 1
Jan 15
March 15
April 1
Specification
Design
Code
Nov 15
Specification
Design Database
Design GUI
Part
MIS
Application
Requirement
July 15
Code database
Part
Test
Doucument
Integrate
& test
Database
Part
G.U.I
Part
Database
Part
G.U.I
Part
Detecting Errors:
Correcting Errors:
The first step is attacking logical errors are to find out if
they are present. This can sometimes be accomplished by
testing a new program with data that will yield a known
answer. If the correct results are not obtained, then the
program obviously contains errors. Even if the correct results
are obtained, however, one cannot be absolutely certain that
the program is error-free, since some errors cause incorrect
results only under certain circumstances (as, for example,
with certain values of the input data or with certain program
options). Therefore a new program should receive thorough
testing before it is considered to be debugged. This is
especially true of complicated programs or programs that will
be used extensively by others.
As a rule, a calculation will have to be carried out by hand,
with the aid of a calculator, in order to obtain a known
answer. For some problems, however, the amount of work
involved in carrying out a hand calculation is prohibitive.
(Remember, a calculation that requires a few minutes of
computer time may require several weeks to solve by hand!).
Therefore a sample calculation cannot always be developed to
test a new program. The logical debugging of such programs
90
Downloaded from www.bhawesh.com.np
91
Downloaded from www.bhawesh.com.np