mc0072

Download MC0072

Post on 06-Sep-2014

818 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

MC0072 Computer Graphics Set-1 1. Explain the development of hardware and software for computer graphics. Ans: Development of Hardware and Software for Computer Graphics The development of hardware of computer graphics involves the development of input and output device technology. Therefore, in all development of computer graphics involves the development in three fields: 1. Output technology 2. Input technology and 3. Software technology 1 Output Technology Fig. 1.3 shows the historical development in the output technology. In early days of computer the hardcopy devices such as teletype printer and line printer were in use with computer driven CRT displays. In mid fifties command and control CRT display consoles were introduced. The more display devices developed in mid-sixties and in common use until the mid-eighties, are called vector, stroke, line drawing or calligraphic displays. The term vector is used as a synonyms for line; a stroke is a short line, and characters are made of sequence of such strokes.

Fig. 1.3

2 Input Technology Input technology has also improved greatly over the years. Number of input devices were developed over the years. These devices are punch cards, light pens, keyboard, tables, mouse and scanners. 3 Software Technology Like output and input technology there is a lot of development in the software technology. In early days low level software were available. Over the years software technology moved from low level to device dependent and then to device independent packages. The device independent packages are high level packages with can drive a wide variety of display and printer devices. As a need for the device independent package a standardization is made and specification are decided. The first graphics specification to be officially standardized was GKS (the Graphical Kernel System). GKS supports the grouping of logically related primitives such as lines, polygons, and character strings and their attributes in collected form called segments. In 1988, a 3D extension of GKS, became an official standard, as did a much more sophisticated but even more complex graphics system called PHIGS (Programmers Hierarchical Interactive Graphics System). PHIGS, as its name implies, supports nested hierarchical grouping of 3D primitives, called structures. In PHIGS, all primitives are subjected to geometric transformations such as scaling, rotation and translation to accomplish dynamic movement. PHIGS also supports a database of structures the programmer may edit and modify. PHIGS automatically updates the display whenever the database has been modified.

2. Explain the use of video lookup table Ans: Video lookup table In a color raster system, the number of color choices available depends on the amount of storage provided per pixel in the frame buffer. Also, color-information can be stored in the frame buffer in two ways: We can store color codes directly in the frame buffer, or we can put the color codes in a separate table and use pixel values as an index into this table. With the direct storage scheme, whenever a particular color code is specified in an application program, the corresponding binary value is placed in the frame buffer for each-component pixel in the output primitives to be displayed in that color. A minimum number of colors can be provided in this scheme with 3 bits of storage per pixel, as shown in the table 2.5.

Each of the three bit positions is used to control the intensity level (either on or off) of the corresponding electron gun in an RGB monitor. The leftmost bit controls the red gun, the middle bit controls the green gun, and the rightmost bit controls the blue gun. Adding more bits per pixel to the frame buffer increases the number of color choices. With 6 bits per pixel, 2 bits can be used for each gun. This allows four different intensity settings for each of the three color guns, and a total of 64 color values are available for each screen pixel. With a resolution of 1024 by 1024, a full-color (24bit per pixel) RGB system needs 3 megabytes of storage for the frame buffer. Color tables are an alternate means for providing extended color capabilities to a user without requiring large frame buffers. Lower cost personal computer systems, in particular, often use color tables to reduce frame-buffer storage requirements. Color tables In color displays, 24- bits per pixel are commonly used, where 8-bits represent 256 levels for each color. Here it is necessary to read 24-bits for each pixel from frame buffer. This is very time consuming. To avoid this video controller uses look up table (LUT) to store many entries of pixel values in RGB format. With this facility, now it is necessary only to read index to the look up table from the frame buffer for each pixel. This index specifies the one of the entries in the look-up table. The specified entry in the loop up table is then used to control the intensity or color of the CRT. Usually, look-up table has 256 entries. Therefore, the index to the look-up table has 8-bits and hence for each pixel, the frame buffer has to store 8-bits per pixel instead of 24 bits. Fig. 2.6 shows the organization of a color (Video) look-up table.

Organization of a Video look-up table There are several advantages in storing color codes in a lookup table. Use of a color table can provide a "reasonable" number of simultaneous colors without requiring Iarge frame buffers. For most applications, 256 or 512 different colors are sufficient for a single picture. Also, table entries can be changed at any time, allowing a user to be able to experiment easily with different color combinations in a design, scene, or graph without changing the attribute settings for the graphics data structure. In visualization and imageprocessing applications, color tables are convenient means for setting color thresholds so that all pixel values above or below a specified threshold can be set to the same color. For these reasons, some systems provide both capabilities for color-code storage, so that a user can elect either to use color tables or to store color codes directly in the frame buffer.

3. Explain the steps in DDA line drawing algorithm Ans: DDA Line Drawing Algorithm Step 1:[Determine The Dx & Dy] Dx=Xb-Xa Dy=Yb-Ya Step 2:[Determine Slope is Gentle or Sharp] If |Dx|>|Dy| then Gentle Slope M=Dy/Dx Set The Starting Point If Dx>0 Then C=CELING(Xb) D=Yb+M*(C-Xb) F=FLOOR(Xa)

R=FLOOR(D+0.5) H=R-D+M IF M>0 Then Positive Gentle Slope M1=M-1 Now Step Through The Columns WHILE C y2, if not interchange y1 and y2 and corresponding x1 and x2 so that for each edge, y1 represents its maximum y coordinate and y2 represents its minimum y coordinate. 5. Sort the rows of array, edges [n][4] in descending of y1, descending order of y2 and ascending order of x2. 6. Set y=ymax 7. Find the active edges and update active edge list: 8. If(y > y2 and y =ymin 20. Stop

5. Explain the Cyrus-Beck algorithm for generalized line clipping Ans: Generalized Clipping with Cyrus-beck Algorithm The algorithms explained above assume that the clipping window is a regular rectangle. These algorithms are not applicable for non rectangular clipping windows. Cyrus and Beck have developed a generalized line clipping algorithm. This algorithm is applicable to an arbitrary convex region. This algorithm uses a parametric equation of a line segment to find the intersection points of a line with the clipping edges. The parametric equation of a line segment from P1 to P2 is P(t) = P1 + (P2- P1)t ;0< t =0, the midpoint is outside or on thee circle boundary. And yi-1 I closer to the circle boundary. Now calculate di+1. There are 2 cases Case 1: if di < 0 then

=

Case 2: if di >0

If di 0 then we can write

The initial value of the decision parameter can be obtained by evaluating circle function at the start position (x0, y0)=(0,r)

Algorithm 1. read the radius r of the circle 2. initialize starting position as x=0, y=r 3. calculate the initial value of the decision parameter as d=1.25-r 4. do { Plot( x, y) If(d