-
Notifications
You must be signed in to change notification settings - Fork 1
/
ComputerGraphics.txt
448 lines (342 loc) · 20.3 KB
/
ComputerGraphics.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
Introduction :-
CG is the field of visual computing where one utilised computers both to genrate visual image and to integrate or alter visual
information sampled from the real world.
This field can be diveded into sevral areas into real time 3D used in vedio games, vedio capture and vedio creation spcial
effects edditing for movies and telivision, image edditing and modeling devlopment in CG was first devloped by academic
intrest and government sponsership.
Application Area of CG :-
-> Computer edit degine application (CAD)
-> Computer games
-> Computer annimation
-> Geographical information system (GIS)
-> Education and training
-> Classroom demostration
-> Working model of any machienry
-> visualigation
-> Comrcial application
-> Computer edit degine application (CAD) :-
It allow for simple degine of building, electronic circuit board, machinal system and engeenring degine in both 2D and 3D.
It save time and energy for example car manifecturing compney the manager wants to devlop.
CAD can also be of diffrent form possible type can be.
--> Machinal degine
--> Arcitectural field
--> Electronic circuit degine
--> Arrow dynamic modeling and degine field
-> Computer Games :-
CG is very usefull for devloping computer games such as PUBG, Pacman, Donkey Kong, Mario.
The early version of games are 2D grapgics but the latter versions have 3D objects.
annimation is a standerd component.
-> Computer Annimation :-
is the art of creating moving image via the use of computer it is a sub field of CG and annimation it created by 3D computer
grapgics.
Video Display Device :-
The operation of most vedio devices based on standerd CRT
/|
/\ / |
Base / \ / |fosfours coated screen
+----+-------------------------+ +------+ |
----|----+ +-+ Electronic bean |
----|----+---+-+--------------------------------+ |
----|----+ +-+ \ |
----|----+ Electric gun \|
Connecter +----+------------------------+ +-------+ |
pins \ / \ |
\/ \ |
magnetic coil \|
There are 2 type of display
-> Raster scan display
The most coman type of grapgics moniter is the raster scan display based on TV technology in it the raster scan system
system the electronic beam is swep acrose the screen one raw at a time from top to bottom.
-> Randam scan display :
Here the electronic beam are directed only to the part of the screen where a picture is to be drown.
Colour CRT Display :
A CRT display Colour picture by using a combination of fosfours that emmit diffrent Colour lite the 2 basic technique for
producing Colour display with a CRT are the
-> Beam pantration method
it for displaying method for displaying Colour picture has been used with Randam scan moniter 2 layers of fosfours
red and green are coated onto the inside of the CRT screen.
/||
/\ / ||
Base / \ / ||fosfours coated screen
+----+-------------------------+ +------+ ||
----|----+ +-+ Electronic bean ||
----|----+---+-+--------------------------------+ ||
----|----+ +-+ \ ||
----|----+ Electric gun \||
Connecter +----+------------------------+ +-------+ ||
pins \ / \ ||
\/ \ ||
magnetic coil \||green
Red
-> Shadow mask method
it used in raster scan system including Colour TV because they produce a varity of Colour then beam pantration
+-------+ +--------+
B --------------------| shado |---------------------| R |
G --------------------| mask |---------------------| G |
R --------------------| |---------------------| B |
+-------+ +--------+
GUI (Grsphical user interface ) :-
It's an interface that allow user to intrect with diffrent electronic devices using icons and other visual indicaters the GUI
were created because CLI were quit complicated and it was diffcult to learn all the commands in it
User
|
|
GUI
|
|
Display server
|
|
Kernael
|
|
Hardware
GUI are used in many devices Computr, Mobiles, Smart phones, Mp3 players e.t.c element in GUI
-> Windo
-> Menu
-> Icons
-> Controle
-> Tabs
-> Windo
This is the element that display the information on the screen it is very easy to manipulate a windo it can be opened or
closed.with the click of an icon it can be moved to any area by dragging it in a multitasking environment multiple windose
can be open at the same time there are multiple types of windo in a such as contaner windo, browser windo, test terminal
windo, child window and message windo.
-> Menu
A menu contains a list of choises and it allow it user to select 1 from them a menu bar is displayed horigently acrose the
screen such as pull down menu.
Another type of menu is the context menue.
-> Icons
Files, Programs, Web pages can be repersentid using a small picture in a GUI this picture is known as icon.
-> Controle
Information is an application can be directly need using the Graphical Controle element.
-> Tabs
A tab is associated with a view pin it usially contains a text level or a Graphical icon they are used in varius web
browser such as internet explorer, Firefox, Safari, Opera, edge and Chrome.
Raster scan system :-
It Employ sevral processing unit as CPU, Processer and Video controler.
/|
/ |
+------- ---------+ +-------------------+ +-------------------+ +----------+ |
| CPU | | system memory | | Video | | Moniter |
| |--| |-------| Controler |------->| |
+-----------------+ +-------------------+ +-------------------+ +----------+ |
| | | \ |
| | | \|
| | |
+---------------------------------------------------------------+
| System BUS |
+---------------------------------------------------------------+
|
|
I/O devices
/|
/ |
+-----+ +-----------------+-------------------+ +-------------------+ +-------+ |
| CPU | | system | Frame | | Video | | Moniter |
| |--| memory | Buffer |------>| Controler |------->| |
+-----+ +-----------------+-------------------+ +-------------------+ +-------+ |
| \ |
| \|
|
+-----------------------------------------------------------+
| system BUS |
+-----------------------------------------------------------+
|
Input Output Device
-> Video contaner
The fixed area of the system memory is reserved for the frame buffer and the Video controler is given direct acces to the
frame buffer memory, frame buffer location and the coresponding screen poition are refrenced in cartition cordinate.
+-------------------------------------------+
| +-----------------------------------+ |
| |...................................| |
| |.....Y|............................| |
| |......|............................| |
| |......|............................| |
| |......|............................| |
| |......|............................| |
| |......+-------------------X........| |
| |...................................| |
| +-----------------------------------+ |
+-------------------------------------------+
The origen of cordinate system for identifying screen poition is usualy specified in the lower left
corner.
/|
/ |
+-----------------------+-------------------+ +-------------------+ +-------+ |
| Display processer | Frame | | Video | | Moniter |
| memory | Buffer |------>| Controler |------->| |
+-----------------------+-------------------+ +-------------------+ +-------+ |
| \ |
| \|
|
+-------+ +--------------+ +--------------------+
| CPU | | Display | | system memory |
| | | processer | | |
+-------+ +--------------+ +--------------------+
| | |
+-----------------------------------------------------------+
| system BUS |
+-----------------------------------------------------------+
|
Input Output Device
Randam scan system :-
An application Programs is input and stored in the system memory along with a grapgics package grapgics commands in the appl-
-ication program are translated by the package into a display file stored in the system memory.
/|
/ |
+----------+ +---------+ +---------------+ +----------+ |
| CPU | | system | | Display | | Moniter | |
| |--| memory |---| processer |------->| | |
+----------+ +---------+ +---------------+ +----------+ |
| | | \ |
| | | \|
| | |
+-----------------------------------------------------------+
| system BUS |
+-----------------------------------------------------------+
|
Input Output Device
grapgics pattern are drown on a randam scan system by directing the electron beam along the component lines of the picture
lines are defined by the values for there cordinate and points and thise input cordinate values are converted into x and y
diflection voltag.
Line Drowing algorithem :-
+
|
|
Y1 |-------+
| |\
| | \
Y2 |-------|--+
| | |
| | |
+--------------------------------+
X1 X2
The cartition slope intersept equation for a state line is
+-------------+
| y = mx + b |
+-------------+
m = slope
b = intersept
given that the 2 end points of a line segment are specified x1, y1 and x2, y2 then
+-------------+
| y2-y1 |
| m = ----- |
| x2-x1 |
+-------------+
Δx = x2-x1
Δy = y2-y1
Δy
m = ----
Δx
Δy
Δx = ----
m
Δy = m.Δx
These equation 6 & 7 make the bases for determining deflaction voltege in analog device for lines with slope magnitude
Δx can be set to a small horigental diflection voltege
Δy can be set to a small vertical diflection voltege
|m| < 1 if [ Δy < Δx ]
|m| > 1 if [ Δy > Δx ]
|m| = 1 if [ Δy = Δx ]
DDA(Digital Difrential Analyser) :-
It's a scan convertion algorithem is the scan convertion algorithem based on calculating Δy and Δx. which sample the line at
unit interwells in one cordinate and determine coresponding integer values nearest the line path suppose a line with +ve slope
if the slope is < or = to 1 then we sample at unit x interwells Δx = 1 then each sucessive y values as
Δx = 1
Yk+1 = Yk + m
subscript k take starting value from k=1, m can be any real number between 0 and 1
for lines with a +ve slope > then 1
Δy = 1
Xk+1 = Xk + 1/m
equation 1 and 2 based on the that the line are to be processed from left end point to the right end point. If the processes is
reversed so that the starting end point
Δx = -1
Yk+1 = Yk - m
Δy = -1
Xk+1 = Xk - 1/m
eq 3 and 4 can also be used to calculate pixal poition along a line with -ve slope the DDA algorithem is faster mathod for pixel
poition.
Circle Genreting Algorithem :-
Digram ========== 1
Circle is a frequently used component in picture and graphs a circle is defined as the st of point that are at a given distence
r from a center poition (Xc,Yc)
In above figure un equal spacing shown in figure to remove un equal spacing using poler cordinate r and θ expressing the circle
equation in paramatric poler form
Digram ========= 2
x = Xc + rcosθ
y = Yc + rsinθ
when a display genrated with this equation using a fixed anguler step size a circle is ploted with equaly spaced point th step
size choosen for θ depend on the application and the display device
Digram ========= 3
The shape of the circle is same in each quadrent
2-D Viewing :-
A world cordinate area selected for display is called a window
Digram ========= 4
An area on a display device to which a windo is mapped is called a view port the windo define where is to be displayed windo and
view ports are rectangle in standerd poition.
Digram ========= 5
A Viewing transformation using standerd rectangles for the window and view port.
Windo to view port cordinate transformation :-
Digram ========= 6
Digram ========= 7
Cleaping :-
--> point cleaping
--> line cleaping
A line cleaping procedure involves sevral parts we process line through the inside outside test by checking the line end points
a line with both end points inside all cliping bounderys such as the line from P1 to P2 is saved. a line with both end point
outside any one of the clip bounderys ( line P3 and P4 ) is outside the windo.
equation : for a line segment with end points (x1,y1) and (x2,y2) and one or both end points outside the cliping rectangle
the paramatric repersentation is following
u is a paramatr for
--> area cleaping (polygon cleaping)
to clip polygon we need to modefy the line cliping procedure a polygon boundery processed with a line cliper depending on the
oreantion of the polygon to the cliping windo. for polygon cliping we require an algorithem that will genrate one or more closed
areas the Output of a polygon cliper should be a sequance of vertics that define the cliped polygon bounderys.
--> curve cleaping
area with curved bounderys can be cliped with mathods.
It will involves non liner equation the bounding rectangle for a circle or other curve objects can be used first to test
for overlap with a rectangle clicp windo if the bounding rectangle for the objects is complicately inside the windo we save
the object if the rectangle is outside the windo we disgard the object.
--> Text cleaping
there are several technique that can be used to provide text cliping in a graphics package.
The simplest method for processing character string relative to a windo boundery is to use all or none string cliping
strategy shown in figure.
and alternative to rejecting entire character string that overlaps a windo boundery is to use the all or none character
cliping strategy.
a final method for handling text cliping is to click the components of indivisual character
-------------------------------------------------------- Extra -------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
Coordinate repersation :-
Most GUI package use cartition cordinate repersation where
objects are specified as MC ( modeling cordinates )
And then they are placed with WC ( world cordinate )
Then they converted into NC ( normalised device cordinate )
and at last they are changed into DC ( device cordinate )
MC ---> WC ---> NC ---> DC
Graphics Functions :-
Output premitive :-
For Drowing picture ( points, line ...)
Attributes of output premitive :-
like length, width
Geomatric transformation :-
translate, rotate of any objects.
Viewing :-
changing camera view
Projection :-
displaying on the screen
Software Standerd :-
Rewritting of code not required
Follow rules
Follow GKS
Follow PHIGS
--> GKS
Follow all standerd and
format 2D objects don't support 3-d
--> PHIGS ( Programmer's Hierarchical Interactive Graphics System )
Follow all standerd and
format 2D objects
make 3D
Follow GKS
extension of PHIGS