Sei sulla pagina 1di 30

Amity Campus Uttar Pradesh India 201303

ASSIGNMENTS PROGRAM: BSc IT SEMESTER-V SUBJECT NAME GRAPHICS STUDY COUNTRY ROLL NUMBER (Reg.No.) STUDENT NAME INSTRUCTIONS Students are required to submit all three assignment sets. ASSIGNMENT DETAILS Assignment A Assignment B Assignment C Five Subjective Questions Three Subjective Questions + Case Study Objective or one line Questions MARKS 10 10 10 : INTRODUCTION TO : UGANDA : BSCIT01152009-2012059 :NAJJITA LILIAN COMPUTER

Total weight age given to these assignments is 30%. OR 30 Marks All assignments are to be completed as typed in word/pdf. All questions are required to be attempted. All the three assignments are to be completed by due dates and need to be submitted for evaluation by Amity University. The students have to attach a scan signature in the form. : : _________ ________________________

Signature Date

________11/06/2012_________________________

( ) Tick mark in front of the assignments submitted Assignment A Assignment B Assignment C

COMPUTER GRAPHICS Q.1 write down the steps Sutherland- Hodgman polygon clipping method. Sutherland- Hodgman method is where a polygon is clipped within a window and it has got four steps which are; Step 1: If the first vertex is outside the window boundary and the second vertex is inside the window then the intersection point with the boundary edge of window and the vertex which is inside the window is stored in the output vertex list i.e., it acts as new vertex point

X Window A P1 B

D Polygon Y

So, i.e., store only P1B in output vertex list. So, our array has [p1, B] at this stage.

Step 2: If both the first and second vertex of a polygon are inside the window boundary then store only the second vertex in the output vertex list

X A P1 B window

D Polygon Y

P2

So, our array has now [p1,B,C] at this stage.

Step 3 If the first vertex is inside the window and the second vertex is outside the window then we store only the intersection point of that edge of polygon with window in the output vertex list. Therefore, store only C in the output vertex list. So, our array has now [p1,B,C] at this stage.

X A P1 B window

D Polygon Y

P2

i.e., store only P2 in the output vertex list. So,our array has now [P1,B, C,P2] at this stage

Step 4 If both the first and second vertex of a polygon are outside the windows boundary then no vertex is stored in output vertex list.

X A P1 B window

D Polygon Y

P2

So our output remains as it is (p1,B,C,p2)

Apply Sutherland-Hodgman polygon clipping method to the polygon whose vertices are A(16,7), B(24,7), C(36,10), D(27,19), E(6,12). The window edges are at x=10 and 30, and y=5 and 15. Solution Polygon being clipped D Polygon

P3 E p4

P2

P5 P1 A B

Window Considering the clipping Window as in the above graph, edge AB is inside, so vertices A(16,7) and B(24,7) are clipped inside the window. The lower-left Clipping Window edge clips edges ED and EA hence cutting off the vertex E(6,12). Edge BC and CD of the polygon are clipped by the upper-right edge of the Clipping Window cutting off the vertex C(36,10) of the polygon. The upper-left Clipping Window edge clips the polygon edge DE cutting off the vertex D(27,19). Therefore, the resulting clipped image that is to be displayed on the screen for viewing will appear as in the graph below;

Diagram showing the clipped image P3(15.5, 15) p2(30, 15)

p4(10, 13.5)

p5(10, 10) P1(30, 8.5)

A(16, 7)

B(24, 7)

Q.2 a) Consider a raster system with a resolution of 1024X 1024. What is the size of Raster(in bytes) needed to store 4 bites per pixel? Solution (1024 * 1024 * 4)/8 bits per byte =524,288KB Therefore, in bytes its equals to 524,288 b) Does interlacing have any effect on refresh process in a raster scan monitor? Interlacing uses two fields in display of images on the screen, such that the content of one field will be used on all the odd-numbered lines on the screen, and for the other field will be displayed on the even lines. Interlacing reduces flickering brought about by the advantage of persistence of vision effectsince image is captured twice.

It doubles the perceived frame rate without consuming extra bandwidth. During Interlacing, the input lag is reduced.

Q.3.what is the need of projection? Projection is needed to transform a given geometry to a new volume (canonical view volume). Explain parallel projection. Parallel projection ignores the Z-extent of all points, thereby imitating and looking at things or objects in real world format. By only considering X and Y values of a coordinate, makes it a cheap and easy as compared to perspective projection. Parallel projections have lines of projection that are parallel both in reality and in the projection plane. Parallel projection corresponds to a perspective projection with an infinite focal length. Within parallel projection, there is an ancillary category known as pictorials. Pictorials show an image of an object as viewed from a skew direction in order to reveal all three directions(axes) of space in one picture. Because pictorial projections innately contain this distortion, in the rote, seffect. Parallel projection corresponds to a perspective projection with a hypothetical viewpoint; i.e. one where the camera lies an infinite distance away from the object and has an infinite focal length, or zoom. A parallel projection preserves relative proportions of objects, & this is the method used in drafting to produce scale drawings of 3-D objects. Accurate views of the various sides of an object are obtained with a parallel projection, but this does not give us a realistic representation of the appearance of a 3D object on the other hand, a perspective projection produces realistic views but does not preserve relative proportions. Q.4. What is the significance of a composite matrix? A composite matrix is the heart of computer graphics that employs the techniques of coordinate geometry thus translation, scaling, and rotation. It makes complex transformations very easy to compute when designing graphics.

Give the explicit form of a Composite matrix representing the transformation: Scaling by a factor of 2 In the x- direction and then rotation about a point (2,1). Are the above Transformation commutative?

Considering the coordinate point (2,1); Transformations above are NOT commutative because different orders of multiplication give different results, thus x '' =T ( 2,3 ) R ( 30 ) x is not equals to x '' =R ( 30 )T ( 2,3 ) x

Q.5. Distinguish between a window and a viewport. Illustrate the effect of changing the Size and position of the window in the world Coordinate system. Whereas a Window may refer to the subset of the overall model world that is to be displayed on the screen, depending on the viewing parameters selected, the

model window may be rectalinear or a distorted viewing frustrum of some kind. The window on the screen refers to an infinite region where we can define what we want to display whereas the Viewport refers to part of the display window where the contents of the clipping window is mapped to or drawn The Viewport refers to a subset of the screen space where the model window is to be displayed. Typically the viewport will occupy the entire screen window, or even the entire screen, but it is also possible to set up multiple smaller viewports within a single screen window. Adjusting the Window size will tell how big or small, more or fewer scenes will be captured in the World Coordinate system, and consequently what will be displayed on the screen. command like width.scale (5,1) issued to increase the width five times. b) Find the normalization transformation that maps a window whose lower left corner is at (1,1) and upper right corner is at (3,5) onto a viewport that is the entire normalized devices screen.

Solution

Using UNV (left handed) system; U=NV N=U/V = (3-1)/(5-1) = 2/4 = 0.5

Normalized transformation matrix =

Q.6. write down a technical note on the following a) Segments They are defined in terms of their two endpoints and are usually straight. A line segment may also be produced by means of illuminating a set of intermediary pixels between the two endpoints. For example: A computed line position of (10.48, 20.51) is converted to pixel position (10, 21). Segments are the form of array like table which stored the commands in order to form the display in the screen. It has four parts; 1. Index 2. Size 3. Position 4. Visibility. Shadow mask method Shadow mask CRT has three phosphor color dots at each pixel position. One phosphor dot emits a red light, another emits green light, and the third emits blue light. This type of CRT has three electron guns, one for each color dot, and a shadow mask grid just behind the phosphor coated screen. The three electron beams are reflected and focused as a group onto the shadow mask, which contains a series of hole aligned with the phosphor-dot patterns. When the three beams pass through a hole in the shadow mask, they activate a dot triangle, which appears as a small color spot on the screen. The phosphor dots in the triangles are arranged so that each electron beam can activate only its corresponding color dot when it passes through the shadow mask.

Color variations in a shadow-mask CRT can be obtained by varying the intensity levels of the three electron beams. For example, a activating all three dots with equal intensity. Shadow mask method is commonly used in raster scan systems; they produce a much wider range of colors than the beam-penetration method.

ASSIGNMENT B Q1.(A)The process of representing continuous picture or graphics object as a collection of discrete pixels is called Scan Conversion. To achieve best approximation to the true image we have to select those pixels in the raster that fall the least distance from the true image. Decision parameters are used to determine which pixel has the least distance and need to be turn on. Derive the decision parameters of CIRCLE. To draw a part of circle, we take unit steps in the positive x direction and make use of a decision parameter to determine which of the two possible y positions is close to the circle path at each step. The two possible y positions are yi and yi -1 at the sampling position xi+1. We have to determine whether the pixel at position(xi+1,yi) or at position (xi +1,yi-1)is closer to the circle. For this, decision parameter is used. It uses the circle function (fcircle(x, y) = x2 + y2 r2 ) evaluated at the midpoint between these two pixels. fcircle(x, y) = x2 + y2 r2 <0 (x,y) inside the circle =0 (x,y) on the circle >0 (x,y) outside the circle The coordinates of the point halfway between pixel T and pixel S are (xi+1,yi-1/2). This is called the midpoint and we use it to define a decision parameter. pi = fcircle(xi+1, yi - ) = (xi + 1)2 + (yi - )2 r2 If pi < 0, this midpoint is inside the circle and the pixel on the scan line yi is closer to the circle boundary. So we choose pixel T. Otherwise, the midpoint is outside or on the circle boundary, and we select the pixel on scan line yi -1 and we choose pixel S. The decision parameter for the next step is

pi+1 = fcircle(xi+1+1, yi+1- ) = [(xi+1) + 1]2 + (yi+1 - )2 r2 [xi+1= xi+1] 49

Since xi+1= xi+1,we have pi+1 pi= [(xi +1)+1)2 - (xi +1)2 + (yi+1 - )2 (yi - )2 Hence pi+1 = pi + 2(xi + 1) + 1 + (y2i+1 y2i) (yi+1 yi) If pi < 0 (T is chosen),we have yi+1 = yi pi+1 = pi + 2(xi + 1) + 1 -----------(Eq. 1) If pi >= 0 (S is chosen),we have yi+1 = yi-1 pi+1 = pi + 2(xi + 1) + 1 -2(yi-1) ---------(Eq.2) Solving Eq.1 & Eq.2 in terms of (xi,yi) ,we have pi+1= pi + 2xi + 3 if pi <0 pi + 2(xi yi) + 5 if pi>=0 In terms of (xi+1,yi+1) pi+1 = pi + 2xi+1 + 1 if pi <0 pi + 2(xi+1 yi+1) + 1 if pi>=0 The initial decision parameter is obtained by evaluating the circle function at the start position (x1, y1) = (0, r) p1 = fcircle (1, r - ) = 1 + (r - )2 r2 = 1 + r2 r + - r2 = 5\4 r If the radius r is specified as an integer, we can simply round p1 to 1 r (b) Write down the steps of the algorithm and rasterize the circle radius 10. Input radius r and circle center (xc , yc ), then set the coordinates for the first point on the circumference of a circle centered on the origin as (x0 , y0 ) = (0, r ) Calculate the initial value of the decision parameter as 5/4r or p1 = 1 r

At each xk position, starting at k = 0, perform the following test. If pk < 0, the next point along the circle centered on (0, 0) is (xk+1 , yk ) and p0 =3. pk+1 = pk + 2xk+1 + 1 Otherwise, the next point along the circle is (xk + 1, yk 1) and pk+1 = pk + 2xk+1 + 1 2yk+1 where 2xk+1 = 2xk + 2 and 2yk+1 = 2yk 2. Determine symmetry points in the other seven octants. Move each calculated pixel position (x, y) onto the circular path centered at (xc , yc ) and

plot the coordinate values: x = x + xc , y = y + yc Repeat steps 3 through 5 until x y.

Therefore, from the calculated initial decision parameter, 5/4-r, given radius of 10 and rounding off to the net pixel; 1-r = 1-10 = -9 (c) Explain how DDA differs from Bresehams line drawing algorithm. DDA uses float numbers and uses operators such as division and multiplication in its calculation. Bresenhams algorithm uses ints and only uses addition and subtraction. Due to the use of only addition, subtraction and bit shifting (multiplication and division use more resources and processor power) Bresenhams algorithm is faster than DDA in producing the line. Fixed point DDA algorithms are generally superior to Bresenhams algorithms on modern computers. The reason is that bresenhams algorithm uses a conditional branch in the loop, and this results in frequent branch mispredictions in the CPU. Fixed point DDA also has fewer instructions in the loop body (one bit shift, one increment and one addition to be exact. In addition to the loop instructions and the actual plotting). As CPU pipelines become deeper, misprediction penalties become more severe. Since DDA uses rounding off of the pixel position obtained by multiplication or division, causes an accumulation of error in the preceding pixels whereas in Bresenhams line algorithm the new pixel is calculated with a small unit change in one direction and checking of the nearest pixel with the decision variable satisfying the line equation. But this error can be calculated and will not cause problems for typical line drawing applications. Lines longer than what fits on a typical computer screen(a few thousand pixels) will be identical to bresenhams lines when using 32 bit integers. Fixed point DDA also has another advantage: since it does not require conditional jumps, you can compute several lines in parallel with SIMD (Single Instruction Multiple Data) techniques.

For 10 X 10 frame buffer,interpret the Bresenhams algorithm by hand to find which pixels are turned on for the line segment (1,2) and (7,6). (10) Given segment (1,2) and (7,6) Slope =y/x=6-2/7-1=4/6=2/3=0.67 With X=6 and y=4 Initial decision parameter has the value P0 = 2y-x = 2x4-6 =2 And the increment for calculating successive decision parameters are; 2y = 8 2y-2x = 8-12 = -4 We plot the initial point (x0,y0) = (1,2) and determine the successive pixels position along the line path from the decision parameters. Using the equation : Pk= 2y.Xk-2X.Yk + c, Where c= 2y+x(2b-1) From y= mx+b b= y-x = 6-0.67x7 = 6-4.69 = 1.31 At k=0, Pk = 2x4x7-2x6x6+17.72 = 56-72+17.72 Since pk >0, then at k=1 Pk+1 = Pk+2y-2x = 2+2x4-2x6 using (7,6) C = 2x4+6(2x1.31-1) = 8+6x1.62 = 8+9.72 = 17.72

= 1.72 = 2 (positive)

= 2+8-12 = -2 (negative)

Since Pk+1<0, then at K=2 Pk+1=Pk+2y = -2+2x4 = -2+8 = 6(positive) Since Pk+1>0, then at k=4 Pk+1 = Pk+2y-2x = 2+8-12 = -2 (negative)

Since Pk+1>0, k=3 Pk+1 = Pk+2y-2x =6+8-12 = 2(positive)

Since Pk+1<0, then at k=5 Pk+1 = Pk+2y = -2+8 = 6 (positive)

K 0 1 2 3 4 5

Pk 2 -2 6 2 -2 6

(Xk+1,Yk+1) (2,3) (3,3) (4,4) (5,5) (6,5) (7,6)

ASSIGNMENT C Q: 1- End product of computer graphics is a) Photo b) Picture c) Movie d) All of the above

Q: 2- Pictures are represented in a) Computer architecture b) Computer organization c) Computer graphics d)All of the above

Q:3 _____________is a graphical component a) Digital memory b) Television monitor above c) Display controller d) All of the

Q: 4- The image must be passed repeatedly to the monitor ____ a seconds. a) 30 b) <30 c) >30 d) Seconds

Q: 5- Inside the frame buffer the image is stored as a pattern of digital numbers. a) Octal b) Binary c) Hexadecimal d) Decimal

Q: 6- The segment names are usually taken as a. characters b. Numbers c. Alphanumeric d. None of the above

Q: 7-Computer Graphics are used in common television sets. a) Random scan CRT b) RGB-CRT c) Raster scan CRT d) None of the above

Q: 8- The most commonly used devices is the CRT. a) Input b) Output c) Storage d) None of the above

Q: 9- The major Components of CRT is a) Electron gun b) Phosphorous coated screen c) Control electrodes d) Deflection yoke f) All of the above

Q: 10electron gum causes elections to congregate at the end of a) Heater b) Cathode c) Both a and b d) None of the above

Q: 11- There is a________coating on the inside front of every CRT. a) Nitrogen b) Phosphorous c) Hydrogen d) All of the above

Q: 12- The glow given off by the, phosphor during exposure of the electron beam is known as . a) Fluorescence b) Phosphorescence c) Persistence d) All of the above

Q: 13- The continuing glow given off after the beam is removed is known as. a) Fluorescence b) Phosphorescence c) Persistence d) All of the above

Q14- In Computer Graphics, an example of image space method algorithm is (a)Back Face detection method (b)Painters Algorithm (c)Scan line Algorithm (d)All of the above

Q15- Raster is a synonym for the term a) Array b) Matrix c) Model d) All of the above

Q: 16- Each bytes is composed of _________ bits a) 2 b) 4 c) 8 d) 16

Q: 17- The majority of_____________systems assign 1 bit in the memory map to one pixel on the display. a) Monochromatic b) Dichromatic c) Polychromatic d) Tri-chromatic

Q: 18- Most display terminals provide the uses with keyboard. a) Alphabetic b) Numeric c) Alpha numeric d) All of the above

Q19- Two types of graphical interaction area a) Partitioning and positioning b) Partitioned and painting c) Positioning and pointing d) None of the above

Q: 20- The process of determining which pixels will provide the better approximation to the desired line is known as____ a) Scan conversion b) Randomization c) Rasterization

d) Recreation

21 & 22 Consider the following figure.

21 Which of the following five line segments can be trivially rejected on the first pass of Cohen-Sutherland line clipping? Computer Graphics (a) AB (b) CD (c) EF (d) GH (e) IJ Answer Questions 21) and 22) using the following. Consider the line which starts at (5, 14) and ends at (21, 2).

22 How many pixels will there be in this line? (a) 12 (b) 16 (c) 24

(d) 20 (e) 10

23 With the DDA (Digital Differential Analyzer) algorithm, what will be the amount added to the secondary component each time through the loop (incrementing value)? (a) -1/2 (b) 3/4 (c) 3/4 (d) 1/2 (e) -4/3

24) The techniques of transformation one object into another is known as a. Translation b. Morphing c. Scaling d. None of the above

25 In DDA algorithm when the value of m>1 we sample at a. unit x intervals b. unit y intervals c. twice x interval d. twice y interval

26. A many sided closed figure is known as a. polygon

c. array b. circle d. line

27. Among the following, which is the output of Line rasterization algorithm (Bresenham) for a line segment with end points (0,0) and (5,3) ? (a) (0,0), (1,0), (2,1), (3,1), (4,2), (5,3) (b) (0,0), (1,1), (2,1), (3,2), (4,2), (5,3) (c) (0,0), (1,1), (2,2), (3,2), (4,3), (5,3) (d) (0,0), (1,0), (2,0), (3,1), (4,2), (5,3) (e) (0,0), (0,1), (2,0), (3,1), (4,2), (5,3)

28. A pixel from where we start filing the polygon is known as: a. PEL b. ROOT c. SEED d. None of the above Computer Graphics

29.If you rotate the point (20,30) by 90 degrees anticlockwise and then translate it by (20,0) and then scale it by (2,1), where will the point be?

(a) (100,-20) (b) (100,-20) (c) (100, 10) (d) (-100,20) (e) (100,20)

30. During 2D rotations,clockwise direction means angle is a. +ve b. -ve c. both a and b d. none of the above

31. The initial size of the segment will be a. zero b. one c. two d. none of the above

32. The value of decision parameter while scan converting a circle by midpoint circle algorith m is a. r-1 b.1-r c. r+1 d. r-1

33. The process of calculating the product of matrix of a number of different transformations in a sequence is known as a. composite transformation b. Transformation c. Translation d. none of the above

34. - Control electrode is connected to a) Repeater b) Amplifier c) Both a and b d) None of the above

35. The process of changing the sizes,orientations or positions of any object by a mathematical operation is called as a. Rotation b. Scaling c. Transformation d. Translation Computer Graphics

36 An example of object space method algorithm is (a) Back Face detection method (b) Painters Algorithm

(c) Roberts Algorithm (d) All of the above

37 The technique of maintaining two images is known as a. Double buffering b. Paging c. segmentation d. none of the above

38 A phosphor will no longer be fluorescent it is said to be a) Burned b) Buried c) Browned d) All of the above

39 CRT stands for a) Cathode Ray tube c) Converted Ray Tube b) Colored Ray tube d) All of the above

40 The algorithm used to color an entire area of connected pixels with the same color is known as a) Flood fill b) Boundary fill

c) line fill d) Forest free

Potrebbero piacerti anche