Partial preview of the text
Download CG SOLVED QUESTION PAPER BY IMP NOTES and more Assignments Computer Science in PDF only on Docsity!
Total No, of Questions : 4] RS SEAT No. : or PA-4982 o [Total No. of Pages : 2 reonsg?234 S.E. (rigs echnology) (Insem.) PUTER GRAPHICS corgi (214453) (Semester - II) Time:1 Hour] S v [Max. Marks : 30 ae ns whe candidat oe OP Que Ri oe, Que 3 or Que 4. Vv K iagfams must be drawn wherever necessary. w 3) Fighresdg-the right indicate full marks. xO 4) Assuph® Suitable data, if necessary. 2) “ & Q1) ) @dhsider aline fromA(5,7) toB sah ud patine drawing algorithm 9 eee the line from AtoB ing wise rasterization of Line. g * [8] b) Explain display file nef, Yay file interpreter used? Which are the commands useaylspigy ile interpreter . [7] fe) ws oe Q2) a) Explain Midpoint le 3 drawing algorithm? List its advantagescand disadvantages o' DA cle drawing algorithm. <8) b) Whatis aliasing and antPaliasing? How aliasing effect is removedin vector generation algorithe” x 7] \ N oY aK Q3) a) Apply the sheBting transformation to square WIth A gp ,B (1,0), C(1, 1), D(0, 1) as given below. 2s) 2 NX ) Shear Parameter value of 0.5 nth the we Y_tef = - ii) Shear Parameter value of 0.5 rel toaphlne X_ref=-1. b) Explain concave and convex poly 5s wiygdTagrams. Explain even-odd method fortesting a Painside or outside the polygon. v [7] OR ee oY ® PT.O. For Joining Whatsapp Group Q4) a) Perform a 450 rotation of triang@ A (0,0), BC 1,1), C (5,2) [3] i) About the origin (0,0) PNd ii) About P (-1, -1) & b) Whatare the steps invalved in filling polygon in scan line algorithm? [7] NX Q-1 (b) Differentiate between Random Scan and Raster Scan. 6 Marks Base of Difference | Raster Scan System Random Sean System Electron Beam The electron beam is swept across the | The electron beam is directed only to the screen, one row at a time, from top to | parts of screen where a picture is to be bottom. drawn. Resolution Its resolution is poor because raster | Its resolution is good because this system system in contrast produces zigzag | produces smooth lines drawings because lines that are plotted as discrete point | CRT beam directly follows the line path. sets. Picture Definition _ | Picture definition is stored as a set of | Picture definition is stored as a set of line intensity values for all screen points, | drawing instructions in a display file, called pixels in a refresh buffer area Realistic Display The capability of this system to store | These systems are designed for line- intensity values for pixel makes it well | drawing and can’t display realistic shaded suited for the realistic display of scenes | scenes. contain shadow and color pattern. Draw an Image Screen points/pixels are used to draw | Mathematical functions are used to draw an image. an image. Q-2 (a) Define the term: Resolution, Aspect Ratio, Frame Buffer, Refresh Rate 4 Marks Resolution: It refers to the maximum number of dots or points that can be displayed on the screen without overlap on the Cathode Ray Tube (CRT). It is expressed as the number of points per centimeter that can be plotted horizontally and vertically. Resolution depends on the type of phosphor, the intensity to be displayed and the focusing and deflection systems used in the CRT. The most commonly used four resolutions today are: 640 * 480, 1024 = 768, 800 « 600, 1280 = 1024. Aspect Ratio: This number gives the ratio of vertical points to horizontal points necessary to produce equal-length line in both directions on the screen. Sometimes it is also referred to as the ratio of horizontal to vertical points. An aspect ratio of 5/6 means that a vertical line plotted with 5 points has the same length as a horizontal line plotted with 6 points. eg. aspect ratio of 12° = 16” display is 12/16 = 3/4. Frame Buffer: special area of memory is dedicated to graphics only, and picture definition is stored In this memory area which is called frame buffer or refresh buffer. This memory area holds the set of intensity values for all the screen points and the stored intensity value are then retrieved from this frame buffer and painted on the screen one row at a time to display picture Q-2 (b)Compare DDA Line Drawing Algorithm with DDA Line Drawing Algorithm. 6 Marks Vector Generation Algorithm’ Bresenham’s Line Algorithm DDA Line Algorithm ett uses Floating point It uses only integer addition, arithmetic subtraction and multiplication by 2 * Due to floating point It is quicker than arithmetic and rounding vector generation algorithm function it takes more time. © Less efficient More efficient e Where speed is important this Hardware implementation — is algorithm need to be not required. implemented in hardwere Q-3 (a) Write a short note on “Handling Keyboard Inputs with GLUT. 6 Marks glutKeyboardFunc sets the keyboard callback for the current window. Function : void glutKeyboardFunc(void (“func)(unsigned char key, int x, int y)); Description glutKeyboardFunc sets the keyboard callback for the current window. When a user types into the window, each key press generating an ASCII character will generate a keyboard callback, The key callback parameter is the generated ASCII character. The state of modifier keys such as Shift cannot be determined directly; their only effect will be on the returned ASCII data. The x and y callback parameters indicate the mouse location in window relative coordinates when the key was pressed. During a keyboard callback, glutGetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred. KeyDownEvent : A KeyDownEvent is sent each time you press a key on the keyboard. The key pressed contains the keyCode property for that event. If that key press has text input associated with it, additional events are sent for each character of text input. The character property contains the character for those events. KeyUpEvent: A KeyUpEvent is sent when you release a key on the keyboard. The keyCode property for that event contains the key being released. KeyDownEvent has additional events sent when a keystroke has an associated text input. + If d variable will contain either +ve value then B point is closer to circle Point B when d>=0 d =f(A)+f(B) = (x,#1)+(yp)?o07# (Kat) (YQ)? ¢ Put initial value (xO,yO) is (O,r) * f(A)=f(x,+1.y,) = (Xo#1)?+(Yo)?-1? =(O+1)?+(r)?-r? =1 e f(B)=f(x,+1, y, -1) = (Xo#1)?#(Yo-1)?-F? =(0+1)?+(r-1)?-r? =2-2r d= 1+2-2r * Casel: d<0 * Previous point is A either select C or D which is nearer + f(C)=f(x,+2,y,) = (x, +2)?+{y,)?-1? * £(D)=f(x,+2,y,-1) = (x,+2)*+(y,-1)-1? * d=f(C)+f(D) = (x42)? +(y,)?-1? +(x,42)? (Yq )2-17 = 2x,2+4x,+3+ 2y,2-y,-217 +4x, +6 *| d=d+4x,+6 * Case2: d >=0 * Previous point is B Next point will be either D or E. F(D)=f(x,+2, y,-2) = (xyt2)*(Y_r APP * F(E)=f(x,+2,y,,-2) = (x,+2)2+(y,-2)-r2 d=f(C}+f(D) = (x,t2 PP +(y,-1)2? +(x,42)2+(y,°2)2-r d=d+4(x,-y,) +10 . Q-4 (a) Describe OpenGL architecture with block diagram In detalL. 6 Marks Immediate Mode Geometric Pipeline PerVertex Polynomial} | Operations & Evahistor Primitive Assembly Display Per Fragment |_| Frame cpu Hn aeration Fs "Sy Cratonr beater | Texture Memory Pinel Operations 6 e The first stage provides an efficient means for approximating curve and surface geometry by evaluating polynomial functions of input values. e The next stage operates on geometric primitives described by vertices: points, line segments, and polygons. In this stage vertices are transformed and lit, and primitives are clipped to a viewing volume in preparation for the next stage, rasterization, e The rasterizer produces a series of framebuffer addresses and values using a two-dimensional description of a point, line segment, or polygon. e Each fragment produced is fed to the next stage that performs operations on individual fragments before they finally alter the framebuffer. Q-5 (a) Write and explain with example Sutherland-Hodgman polygon clipping algorithm. 5 Marks A polygon boundary processed with a line clipper may be displayed as a series of unconnected line segments, depending on the orientation of the polygon to the clipping window. For polygon clipping, We require an algorithm that will generate one or more closed areas that are then scan converted for the appropriate area. The output of a polygon clipper should be a sequence of vertices that defines the clipped polygon boundaries. Original polygon Len ctippes Right chpped Top clipped Bottom clipped Fig. (1) Clipping a polygon against successive window boundaries Sutherland Hodgeman Polygon Clipping Algorithm: We can correctly clip a polygan by processing the polygon boundary as a whole against each window edge. This could be accomplished by processing all polygon vertices against each clip rectangle boundary in turn. There are four possible cases when processing vertices in sequence around the perimeter of a polygon: 1. If the first vertex passes to a window boundary and the second vertex is inside, both the intersection point of the polygon edge with the window boundary and the second vertex are added to the output vertex List. 2. If both input vertices are inside the window boundary, only the second vertex is added to the output vertex list. 3. If the first vertex is inside the window boundary and the second vertex is outside the window boundary, only the edge intersection with the window boundary is added to the output vertex first. Q-5 (b) Let ABCD be the rectangle window with A(20,20), B(90,20), C((90,70), D(20,70). Find Region Codes for endpoints, use Cohen Sutherland algorithm to clip the lines P1P2 with (10,30) and P2(80,90). 5 Marks women ao Too” Aone 2a cheery Aaa — A Gp 0000 goto exe, 1 Rae Ce = —}—O:02 Rinw! OO —for—_fi_Civ, 3 _xX4 Xwomin__ ———s 9 6 Btn —tnde_—4_ 001 Frac pA CL0,- i ae = en ea — Eh FB nai — po SS X= RL ye qe, eg ag —____ eT 4 =a re Q-6(a) Explain Boundary Fill algorithm. © This is a recursive algorithm that begins with a starting interior pixel called a seed, and continues painting towards the boundary. e The algorithm checks to see if this pixel is a boundary pixel or has already filled. @ If not it fills the pixel and makes a recursive call to itself using each and every Q-6 (b) 5 Marks toe a . GEEEEIELED Clip the fine PQ having coordinates P(4, 1) and Q(6, 4) against the clip window having vertices A(3, 2), B(7, 2), C(7, 6) and D(3, 6) using Cohen Sutherland line clipping algorithm. Solution : Line : A (4, 1), B (6,4), x, = 3.¥5 = 2, xp = 7 v7 = 6 Point Endcode ANDing Position r o1do8 oo00 Partially visible Q 0000 Line slope m = 225 =3 3.6)0 (7.6)¢ . = Lip (6,4) yar = x4(Z}o0 yo fa | = xpt|—](Q-yp) (3.2) 2) (=) Pp A ft (40) 2 2.044 P 3 3 Fig. 5.4.9 I= (ypex yo)=(4. 2)