1. DDA Algorithm(Digital Differential Analyzer)

Size: px
Start display at page:

Download "1. DDA Algorithm(Digital Differential Analyzer)"

Transcription

1 Basic concepts in line drawing: We say these computers have vector graphics capability (the line is a vector). The process is turning on pixels for a line segment is called vector generation and algorithm for them is known as vector generation algorithm. Problems of vector generation: Line is straight but width is no constant. Brightness of line dependent on orientation of the line. Calculate only an approximate line length. Reduce the calculations using simple integer arithmetic. Line Drawing Algorithms 1. DDA Algorithm(Digital Differential Analyzer) DDA algorithm is an incremental scan conversion method. Here we perform calculations at each step using the results from the preceding step. Digital Differential Analyzer (DDA) algorithm is the simple line generation algorithm which is explained step by step here. Procedure for DDA Algorithm: 1. Read line end points(x1,y1) and (x2,y2) such that they are not equal. 2. dy= y2-y1 and dx= x2-x1 3. If ( dx > dy) then Length=dx Else Length=dy 4. dx=(x2-x1)/length dy=(y2-y1)/ Length 5. x=x1+0.5*sign(dx) y=y1+0.5*sign(dy) 6. i=1 while (i< Length) Plot (Integer(x), Integer(y)) X=x+dx Y=y+dy

2 7. i=i+1 8.Stop Program: #include<stdio.h> #include<conio.h> #include<graphics.h> void main() int x1,y1,x2,y2,dx,dy,length,i; float x,y,xinc,yinc; int gd=detect,gm; initgraph(&gd,&gm,"c:\\turboc3\\bgi"); printf("enter the starting coordinates"); scanf("%d%d",&x1,&y1); printf("enter the ending coordinates"); scanf("%d%d",&x2,&y2); dx=x2-x1; dy=y2-y1; if(abs(dx)>abs(dy)) length=abs(dx); else length=abs(dy); xinc=dx/(float)length;

3 yinc=dy/(float)length; x=x1 y=y1 putpixel(x,y,10); for(i=0;i<length;i++) putpixel(x,y,10); x=x+xinc; y=y+yinc; delay(10); getch(); closegraph(); Advantages of DDA Algorithm 1. It is the simplest algorithm and it does not require special skills for implementation. 2. It is a faster method for calculating pixel positions. Disadvantages of DDA Algorithm 1. Floating point arithmetic in DDA algorithm is still time-consuming. 2. The algorithm is orientation dependent. Hence end point accuracy is poor. Example Consider the line from (0, 0) to (-6, -6). Use the simple DDA algorithm line. Sol. Evaluating steps 1 to 5 in the DDA algorithm we have Xl = 0 Y1 = 0 X2 = - 6 Y2 = - 6 Length = l X2-X1l Y2-Y1l = 6

4 X = Y = -1 Initial values for X = * Sign (-1) =-0.5 Y = * Sign (-1) =-0.5 Tabulating the results of each iteration in the step 6 we get, 2. Bresenham's Algorithm. It s an accurate and efficient raster line generating Algorithm. Bresenham's line-drawing algorithm uses an iterative scheme. A key feature of the algorithm is that it requires only integer data and simple arithmetic. This makes the algorithm very efficient and fast. Procedure for Bresenham s algorithm: 1.Read line end points (x1,y1) and (x2,y2) such that they are not equal. 2. dx= x2-x1 and dy= y2-y1 3.x=x1 and y=y1 4.e=2*dy-dx 5.i=1

5 6.plot (x,y) 7.while (e>0) x=y+1 e=e-2*dx x=x+1 e=e+2*dy 8.i=i+1 9.if(i<dx) then goto step Stop. Program- Bresenham Line Drawing Algorithm -: #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> void main() int gd=detect,gm=detect,length,dx,dy,x1,y1,x2,y2,e; float x,y; clrscr(); printf("\n enter coordinates of x1,y1,x2,y2"); scanf("%d%d%d%d",&x1,&y1,&x2,&y2); dx=x2-x1; dy=y2-y1; e=2*(dy-dx); x=x1; y=y1; initgraph(&gd,&gm,"c://turboc3//bgi"); while(x<=x2) if(e<0)

6 x=x+1; y=y; e=e+2*dy; else x=x+1; y=y+1; e=e+2*(dy-dx); putpixel(x,y,15); getch(); closegraph(); Problem: - Consider the line from (5, 5) to (13, 9). Use the Bresenham's algorithm to rasterize the line. Solution :- Evaluating steps 1 through 4 in the Bresenham s algorithm we have, Given: - step 1 :- x1 = 5, y1 = 5 and x2 = 13, y2 = 9. step 2 :- Δx = 13-5 =8 Δy = 9-5 = 4 step 3 :- x = 5, y = 5 step 4 :- e = 2 * Δy - Δx = 2 * 4-8 = 0. Tabulating the results of each iteration in the step 5 through 10.

7 DDA Line Drawing Algorithm vs Bresenhams Line Drawing Algorithm Arithmetic uses floating points Integer points Operations Uses multiplication and division in its operations. Uses only subtraction and addition in its operations. Speed slowly than Bresenhams algorithm faster than DDA Accuracy & Efficiency Drawing not as accurate and efficient DDA algorithm can draw circles and curves but that are not as accurate as Bresenhams algorithm. more efficient &much accurate Draw circles and curves with much more accuracy than DDA algorithm. Round Off DDA algorithm round off the coordinates to Bresenhams algorithm does not round off but takes the

8 integer that is nearest to the line. incremental value in its operation. Expensive expensive. less expensive Circle generating algorithm: Symmetry of circle: A circle is a geometric figure which is round, and can be divided into 360 degrees. A circle is a symmetrical figure which follows 8-way symmetry. 8-Way symmetry: Any circle follows 8-way symmetry. This means that for every point (x,y) 8 points can be plotted. These (x,y), (y,x), (-y,x), (-x,y), (-x,-y), (-y,-x), (y,-x), (x,-y). Drawing a circle: To draw a circle we need two things, the coordinates of the centre and the radius of the circle. Here r is the radius of the circle. If the circle has origin (0,0) as its centre then the above equation can be reduced to x2 + y2 = r2 Bresenham s Algorithm We cannot display a continuous arc on the raster display. Instead, we have to choose the nearest pixel position to complete the arc. From the following illustration, you can see that we have put the pixel at (X, Y) location and now need to decide where to put the next pixel at N (X+1, Y) or at S (X+1, Y-1).

9 This can be decided by the decision parameter d. If d <= 0, then N(X+1, Y) is to be chosen as next pixel. If d > 0, then S(X+1, Y-1) is to be chosen as the next pixel. Breshenham s Algorithm For Circle Drawing 1. Read the radius of circle. 2. Calculate initial decision parameter di=3-2r 3. x=0 and y=r [initialize the starting point] 4. Do 5. Plot(x,y)//plot point(x,y) and other 7 points in all octant if(di<0)then di=di+4x=6 else di=di+4(x-y)+10 y=y-1 x=x+1 while(x<y); 6. stop

10 Program : bresenhams circle drawing algorihm #include<stdio.h> #include<conio.h> #include<math.h> #include<dos.h> #include<graphics.h> void bressn(int,int,int); void plot(int,int,int,int); void plot(int xc,int yc,int x,int y) putpixel(xc+x,yc+y,white); putpixel(xc-x,yc+y,red); putpixel(xc-x,yc-y,green); putpixel(xc+x,yc-y,yellow); putpixel(xc+y,yc+x,white); putpixel(xc-y,yc+x,green); putpixel(xc-y,yc-x,yellow); putpixel(xc+y,yc-x,red); void bressn(int r,int xc,int yc) int d,x,y; d=3-(2*r); x=0; y=r;

11 while(x<y) plot(xc,yc,x,y); x=x+1; if(d<0) d=d+(4*x)+6; else y=y-1; d=d+4*(x-y)+10; plot(xc,yc,x,y); void main() int gd,gm; int xc,yc,radius; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\\turboc3\\bgi"); printf("\n enter xc,yc,radius"); scanf("%d%d%d",&xc,&yc,&radius); bressn(xc,yc,radius);

12 Example : getch(); closegraph(); Calculate the pixel position along the circle path with radius r=10 centered on the origin using Bresenham s circle drawing algorithm from point (0,10) to point x=y. Solution: The value of d is d=3-2r=3-2*10=-17 Tabulating results of step 4 Polygon: x y d A polygon is any 2-dimensional shape formed with straight lines. Triangles, quadrilaterals, pentagons, and hexagons are all examples of polygons. Types of polygon: Every polygon is either convex or concave. The difference between convex and concave polygons lies in the measures of their angles. For a polygon to be convex, all of its interior angles must be less than 180 degrees. Otherwise, the polygon is concave.

13 Inside-Outside Test This method is also known as counting number method. While filling an object, we often need to identify whether particular point is inside the object or outside it. There are two methods by which we can identify whether particular point is inside an object or outside. Odd-Even Rule Nonzero winding number rule Odd-Even Rule In this technique, we will count the edge crossing along the line from any point (x,y) to infinity. If the number of interactions is odd, then the point (x,y) is an interior point; and if the number of interactions is even, then the point (x,y) is an exterior point. The following example depicts this concept.

14 From the above figure, we can see that from the point (x,y), the number of interactions point on the left side is 5 and on the right side is 3. From both ends, the number of interaction points is odd, so the point is considered within the object. Nonzero Winding Number Rule This method is also used with the simple polygons to test the given point is interior or not. Give the value 1 to all the edges which are going to upward direction and all other -1 as direction values. Check the edge direction values from which the scan line is passing and sum up them. If the total sum of this direction value is non-zero, then this point to be tested is an interior point, otherwise it is an exterior point. In the above figure, we sum up the direction values from which the scan line is passing then the total is = 1; which is non-zero. So the point is said to be an interior point. Polygon filling: Polygon filling algorithms are classified as: seed fill algorithm and scan line algorithm. One way to fill polygon is to start from given seed, point known to be inside the polygon and highlight outward from this point i.e. neighboring pixels until we encounter the boundary pixels. This approach is called seed fill. Seed fill algorithm further classified as flood fill and boundary fill algorithm. Algorithms the fill interior defined regions are flood fill algorithms; those that fill boundary defined regions are called boundary fill algorithm. Another approach to fill the polygon is to apply the inside test i.e. to check whether the pixels is inside the polygon or outside the polygon and then highlight pixels which lie inside the polygon. This approach is known as scan-line algorithm.

15 Flood Fill Algorithm Flood fill colors an entire area in an enclosed figure through interconnected pixels using a single color. It is an easy way to fill color in the graphics. One just takes the shape and starts flood fill. The algorithm works in a manner so as to give all the pixels inside the boundary the same color leaving the boundary and the pixels outside. Flood fill algorithm is used for filling the interior of a polygon. Used when an area defined with multiple color boundaries. Start at a point inside a region Replace a specified interior color (old color) with fill color Fill the 4 connected or 8 connected region until all interior points being replaced. 4 Connected Regions From a given pixel, the region that you can get to by a series of 4 way moves (north, south, east, west) void fillcolor(int x,int y,int old_color,int new_color) if(getpixel(x,y)==old_color) delay(5); putpixel(x,y,new_color); fillcolor(x+1,y,old_color,new_color); fillcolor(x-1,y,old_color,new_color); fillcolor(x,y+1,old_color,new_color); fillcolor(x,y-1,old_color,new_color);

16 Program: #include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> void fillcolor(int,int,int,int); void main() int gd,gm; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\\turboc3\\bgi"); rectangle(50,50,100,100); fillcolor(55,55,0,11); getch(); closegraph(); void fillcolor(int x,int y,int old_color,int new_color) if(getpixel(x,y)==old_color) delay(5); putpixel(x,y,new_color); fillcolor(x+1,y,old_color,new_color); fillcolor(x-1,y,old_color,new_color); fillcolor(x,y+1,old_color,new_color); fillcolor(x,y-1,old_color,new_color); 8 Connected Regions From a given pixel, the region that you can get to by a series of 8-way moves (north, south, east, west, NE, NW, SE, SW) void fillcolor(int x,int y,int old_color,int new_color) if(getpixel(x,y)==old_color) delay(5); putpixel(x,y,new_color); fillcolor(x+1,y,old_color,new_color); fillcolor(x-1,y,old_color,new_color); fillcolor(x,y+1,old_color,new_color); fillcolor(x,y-1,old_color,new_color); fillcolor(x+1,y+1,old_color,new_color);

17 fillcolor(x+1,y-1,old_color,new_color); fillcolor(x-1,y-1,old_color,new_color); fillcolor(x-1,y+1,old_color,new_color); Program: #include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> void fillcolor(int,int,int,int); void main() int gd,gm; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\\turboc3\\bgi"); rectangle(50,50,100,100); fillcolor(55,55,0,11); getch(); closegraph(); void fillcolor(int x,int y,int old_color,int new_color) if(getpixel(x,y)==old_color) delay(5); putpixel(x,y,new_color); fillcolor(x+1,y,old_color,new_color); fillcolor(x-1,y,old_color,new_color); fillcolor(x,y+1,old_color,new_color); fillcolor(x,y-1,old_color,new_color); fillcolor(x+1,y+1,old_color,new_color); fillcolor(x+1,y-1,old_color,new_color); fillcolor(x-1,y-1,old_color,new_color); fillcolor(x-1,y+1,old_color,new_color); ADVANTAGE Flood fill algorithm is simplest algorithm.

18 DISADVANTAGE Flood fill algorithm is slow. For large polygon flood fill algorithm is fail because it requires a large frame. Boundary Fill Algorithm Start at a point inside the figure and paint with a particular color. Filling continues until a boundary color is encountered. In boundary fill algorithm Recursive method is used to fill the whole boundary. Start at a point inside a region. Paint the interior outward toward the boundary. The boundary is specified in a single color. 4-connected boundary fill Algorithm:- boundary_fill(x, y, f_colour, b_colour) if(getpixel(x, y)! = b_colour && getpixel(x, y)! = f_colour) putpixel(x, y, f_colour); boundary_fill(x + 1, y, f_colour, b_colour); boundary_fill(x, y + 1, f_colour, b_colour); boundary_fill(x -1, y, f_colour, b_colour); boundary_fill(x, y 1, f_colour, b_colour); Program: #include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> void boundary_fill(int,int,int,int); void main() int gd,gm; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\\turboc3\\bgi"); rectangle(50,50,100,100); boundary_fill(55,55,6,15); getch();

19 closegraph(); void boundary_fill(int x,int y,int fcolor,int bcolor) if((getpixel(x,y)!=bcolor)&&(getpixel(x,y)!=fcolor)) delay(5); putpixel(x,y,fcolor); boundary_fill(x+1,y,fcolor,bcolor); boundary_fill(x-1,y,fcolor,bcolor); boundary_fill(x,y+1,fcolor,bcolor); boundary_fill(x,y-1,fcolor,bcolor); 8-connected boundary fill Algorithm:- boundary_fill(x, y, f_colour, b_colour) if(getpixel(x, y)! = b_colour && getpixel(x, y)! = f_colour) putpixel(x, y, f_colour); boundary_fill(x + 1, y, f_colour, b_colour); boundary_fill(x - 1, y, f_colour, b_colour); boundary_fill(x, y + 1, f_colour, b_colour); boundary_fill(x, y - 1, f_colour, b_colour); boundary_fill(x + 1, y + 1, f_colour, b_colour); boundary_fill (x - 1, y - 1, f_colour, b_colour); boundary_fill(x + 1, y - 1, f_colour, b_colour); boundary_fill(x - 1, y + 1, f_colour, b_colour); Program: #include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> void boundary_fill(int,int,int,int); void main() int gd,gm; detectgraph(&gd,&gm);

20 initgraph(&gd,&gm,"c:\\turboc3\\bgi"); rectangle(50,50,100,100); boundary_fill(55,55,6,15); getch(); closegraph(); void boundary_fill(int x,int y,int fcolor,int bcolor) if((getpixel(x,y)!=bcolor)&&(getpixel(x,y)!=fcolor)) delay(5); putpixel(x,y,fcolor); boundary_fill(x+1,y,fcolor,bcolor); boundary_fill(x-1,y,fcolor,bcolor); boundary_fill(x,y+1,fcolor,bcolor); boundary_fill(x,y-1,fcolor,bcolor); boundary_fill(x+1,y+1,fcolor,bcolor); boundary_fill(x-1,y+1,fcolor,bcolor); boundary_fill(x+1,y-1,fcolor,bcolor); boundary_fill(x-1,y-1,fcolor,bcolor); void fillcolor(int x,int y,int old_color,int new_color) if(getpixel(x,y)==old_color) putpixel(x,y,new_color); fillcolor(x+1,y,old_color,new_color); fillcolor(x-1,y,old_color,new_color); fillcolor(x,y+1,old_color,new_color); fillcolor(x,y-1,old_color,new_color); boundary_fill(x, y, f_colour, b_colour) if(getpixel(x, y)! = b_colour && getpixel(x, y)! = f_colour) putpixel(x, y, f_colour); boundary_fill(x + 1, y, f_colour, b_colour); boundary_fill(x, y + 1, f_colour, b_colour); boundary_fill(x -1, y, f_colour, b_colour); boundary_fill(x, y 1, f_colour, b_colour);

21 void fillcolor(int x,int y,int old_color,int new_color) if(getpixel(x,y)==old_color) putpixel(x,y,new_color); fillcolor(x+1,y,old_color,new_color); fillcolor(x-1,y,old_color,new_color); fillcolor(x,y+1,old_color,new_color); fillcolor(x,y-1,old_color,new_color); fillcolor(x+1,y+1,old_color,new_color); fillcolor(x+1,y-1,old_color,new_color); fillcolor(x-1,y-1,old_color,new_color); fillcolor(x-1,y+1,old_color,new_color); boundary_fill(x, y, f_colour, b_colour) if(getpixel(x, y)! = b_colour && getpixel(x, y)! = f_colour) putpixel(x, y, f_colour); boundary_fill(x + 1, y, f_colour, b_colour); boundary_fill(x - 1, y, f_colour, b_colour); boundary_fill(x, y + 1, f_colour, b_colour); boundary_fill(x, y - 1, f_colour, b_colour); boundary_fill(x + 1, y + 1, f_colour, b_colour); boundary_fill (x - 1, y - 1, f_colour, b_colour); boundary_fill(x + 1, y - 1, f_colour, b_colour); boundary_fill(x - 1, y + 1, f_colour, b_colour); Scan Line Fill Algorithm To successfully fill in a polygon three main components will be used: Edge Buckets, an Edge Table and an Active List. These components will contain an edge s information, hold all of the edges that compose the figure and maintain the current edges being used to fill in the polygon, respectively. When a scan line intersects an edge endpoint, it intersects two edges. Consider, Two cases: Case A: edges are monotonically increasing or decreasing, we should consider this as only ONE edge intersection Case B: edges reverse direction at endpoint; we should consider this as TWO edge intersections

22 Stepwise Procedure 1. Read n, the number of vertices of polygon. 2. Read x and y coordinates of all vertices in array X[n] and y[n]. 3. Find y max and y min 4. Store the initial x value (x1),y values (y1 and y2) and x increment dx from scan line to scan line for each edge in the array edges[n] [4]. a. While doing this check that y1> y2, if not, interchange y1 and y2 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 order of y1, descending order of y2, and ascending order of x2 6. Set y=y max 7. Find the active edges and update active edge list: a. if ( y>y2 and y<y1) i edge is active b. Else i edge is not active 8. Compute the x intersects for all active edges for current y value. Initially x intersect is x1 and x intersects for successive y values can be given as a. x(i+1)dxi+dx b. where dx=-1/m and m=y2-y1/x2-x1 i.e..slope of a line segment. 9. if x intersect is vertex i.e. x intersect =x1 and y=y1 then apply vertex test to check whether to consider one intersect or two intersects. Store all x intersects in the x intersects array. 10. Store x intersects array in the ascending order. 11. Extract pairs of intersects from the sorted x intersect array. 12. Pass pairs of x values to line drawing routine to draw corresponding line segments. 13.-set y=y Repeat steps 7 through 13 until y> ymin

23 15. Stop Program: #include <stdio.h> #include <conio.h> #include <graphics.h> main() int n,i,j,k,gd,gm,dy,dx; int x,y,temp; int a[20][2],xi[20]; float slope[20]; clrscr(); printf("\n\n\tenter the no. of edges of polygon : "); scanf("%d",&n); printf("\n\n\tenter the cordinates of polygon :\n\n\n "); for(i=0;i<n;i++) printf("\tx%d Y%d : ",i,i); scanf("%d %d",&a[i][0],&a[i][1]); a[n][0]=a[0][0]; a[n][1]=a[0][1]; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\\turboc3\\bgi"); /*- draw polygon -*/ for(i=0;i<n;i++) line(a[i][0],a[i][1],a[i+1][0],a[i+1][1]); getch();

24 for(i=0;i<n;i++) dy=a[i+1][1]-a[i][1]; dx=a[i+1][0]-a[i][0]; if(dy==0) slope[i]=1.0; if(dx==0) slope[i]=0.0; if((dy!=0)&&(dx!=0)) /*- calculate inverse slope -*/ slope[i]=(float) dx/dy; for(y=0;y< 480;y++) k=0; for(i=0;i<n;i++) if( ((a[i][1]<=y)&&(a[i+1][1]>y)) ((a[i][1]>y)&&(a[i+1][1]<=y))) xi[k]=(int)(a[i][0]+slope[i]*(y-a[i][1])); k++; for(j=0;j<k-1;j++) /*- Arrange x-intersections in order -*/ for(i=0;i<k-1;i++) if(xi[i]>xi[i+1]) temp=xi[i]; xi[i]=xi[i+1]; xi[i+1]=temp; setcolor(35);

25 for(i=0;i<k;i+=2) line(xi[i],y,xi[i+1]+1,y); getch(); Scan conversion The process of representing continuous graphics objects as a collection of discrete pixels is called scan conversion. Scan conversion serves as a bridge between TV and computer graphics technology. Scan conversion or scan converting rate is a video processing technique for changing the vertical / horizontal scan frequency of video signal for different purposes and applications. The device which performs this conversion is called a scan converter. The application of scan conversion: video projectors, cinema equipment, TV and video capture cards, standard and HDTV televisions, LCD monitors, radar displays and many different aspects of picture processing. There are two distinct methods for changing a picture's data rate: Analog Methods (Non retentive, memory-less or real time method) This conversion is done using large numbers of delay cells and is appropriate for analog video.it may also be performed using a specialized scan converter vacuum tube. In this case polar coordinates (angle and distance) data from a source such as a radar receiver, so that it can be displayed on a raster scan (TV type) display. Digital methods (Retentive or buffered method) In this method, a picture is stored in a line or frame buffer with n1 speed (data rate) and is read with n2 speed.

26 Frame buffer: Each screen pixel corresponds to a particular entry in a 2D array residing in memory. This memory is called a frame buffer or a bit map. The number of rows in the frame buffer equals to the number of raster lines on the display screen. The number of columns in this array equals to the number of pixels on each raster line. Frame buffer is a large part of computer memory used to store display image. Different kind of memory can be used for frame buffers like drums, disk or IC shift registers. To generate a pixel of desired intensity to read the disk or drum. The information stored in disk or drum is in digital for, hence it is necessary to convert it into analog from using DAC and then this analog signal is used to generate the pixel. Character Generation Most of the times characters are builts into the graphics display devices, usallay as hardware but sometimes through software. There are basic three methods:

27 Stroke method Starbust method Bitmap method 1. Stroke method This method uses small line segments to generate a character. The small series of line segments are drawn like a strokes of a pen to form a character as shown in figure. We can build our own stroke method. By calling a line drawing algorithm. Here it is necessary to decide which line segments are needed for each character and Then drawing these segments using line drawing algo. This method supports scaling of the character. 2. Starbust method It does this by changing the length of the line segments used for character drawing. In this method a fix pattern of line segments are used to generate characters. As shown in figure, there are 24 line segments. Out of 24 line segments, segments required to display for particular character, are highlighted This method is called starbust method because of its characteristic appearance.

28 This method of character generation has some disadvantages. They are 1. The 24-bits are required to represent a character. Hence more memory is required 2. Requires code conversion software to display character from its 24-bit code 3. Character quality is poor. It is worst for curve shaped characters. 3. Bitmap Method Also known as dot matrix because in this method characters are represented by an array of dots in the matrix form. It s a two dimensional array having columns and rows : 5 X 7 as shown in figure. 7 X 9 and 9 X 13 arrays are also used. Higher resolution devices may use character array 100 X 100.

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by: Lecture 3 Output Primitives Assuming we have a raster display, a picture is completely specified by: - A set of intensities for the pixel positions in the display. - A set of complex objects, such as trees

More information

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics Announcements Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class 1 Scan Conversion Overview of Rendering Scan Conversion Drawing Lines Drawing Polygons

More information

Graphics (Output) Primitives. Chapters 3 & 4

Graphics (Output) Primitives. Chapters 3 & 4 Graphics (Output) Primitives Chapters 3 & 4 Graphic Output and Input Pipeline Scan conversion converts primitives such as lines, circles, etc. into pixel values geometric description a finite scene area

More information

Agenda. Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms. Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm

Agenda. Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms. Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm Polygons UNIT - III Agenda Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm A Polygon Vertex = point in space (2D or 3D)

More information

Chapter 8: Implementation- Clipping and Rasterization

Chapter 8: Implementation- Clipping and Rasterization Chapter 8: Implementation- Clipping and Rasterization Clipping Fundamentals Cohen-Sutherland Parametric Polygons Circles and Curves Text Basic Concepts: The purpose of clipping is to remove objects or

More information

February 1. Lab Manual INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR COMPUTER GRAPHICS & MUTIMEDIA

February 1. Lab Manual INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR COMPUTER GRAPHICS & MUTIMEDIA Lab Manual February 1 2014 COMPUTER GRAPHICS & MUTIMEDIA INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR SOFTWARE REQUIREMENT : 1. Turbo C++ IDE (TurboC3) 2. Borland Turbo C++ (Version 4.5) LIST

More information

LAB MANUAL OF COMPUTER GRAPHICS BY: Mrs. Manisha Saini

LAB MANUAL OF COMPUTER GRAPHICS BY: Mrs. Manisha Saini LAB MANUAL OF COMPUTER GRAPHICS BY: Mrs. Manisha Saini INTRODUCTION TO COMPUTER GRAPHICS Computer Graphics is the pictorial representation of information using a computer program. In Computer Graphics,

More information

Computer Graphics Lecture Notes

Computer Graphics Lecture Notes Computer Graphics Lecture Notes UNIT- Overview of Computer Graphics. Application of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe

More information

Scan Conversion. Drawing Lines Drawing Circles

Scan Conversion. Drawing Lines Drawing Circles Scan Conversion Drawing Lines Drawing Circles 1 How to Draw This? 2 Start From Simple How to draw a line: y(x) = mx + b? 3 Scan Conversion, a.k.a. Rasterization Ideal Picture Raster Representation Scan

More information

Chapter - 2: Geometry and Line Generations

Chapter - 2: Geometry and Line Generations Chapter - 2: Geometry and Line Generations In Computer graphics, various application ranges in different areas like entertainment to scientific image processing. In defining this all application mathematics

More information

Einführung in Visual Computing

Einführung in Visual Computing Einführung in Visual Computing 186.822 Rasterization Werner Purgathofer Rasterization in the Rendering Pipeline scene objects in object space transformed vertices in clip space scene in normalized device

More information

Unit 2 Output Primitives and their Attributes

Unit 2 Output Primitives and their Attributes Unit 2 Output Primitives and their Attributes Shapes and colors of the objects can be described internally with pixel arrays or with sets of basic geometric structures, such as straight line segments and

More information

Points and lines. x x 1 + y 1. y = mx + b

Points and lines. x x 1 + y 1. y = mx + b Points and lines Point is the fundamental element of the picture representation. It is nothing but the position in a plan defined as either pairs or triplets of number depending on whether the data are

More information

Digital Differential Analyzer Bresenhams Line Drawing Algorithm

Digital Differential Analyzer Bresenhams Line Drawing Algorithm Bresenham s Line Generation The Bresenham algorithm is another incremental scan conversion algorithm. The big advantage of this algorithm is that, it uses only integer calculations. Difference Between

More information

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored. From Vertices to Fragments: Rasterization Reading Assignment: Chapter 7 Frame Buffer Special memory where pixel colors are stored. System Bus CPU Main Memory Graphics Card -- Graphics Processing Unit (GPU)

More information

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete Scan Conversion CMP 477 Computer Graphics S. A. Areete What is Scan-Conversion? 2D or 3D objects in real world space are made up of graphic primitives such as points, lines, circles and filled polygons.

More information

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives. D Graphics Primitives Eye sees Displays - CRT/LCD Frame buffer - Addressable pixel array (D) Graphics processor s main function is to map application model (D) by projection on to D primitives: points,

More information

SIR C.R.R COLLEGE OF ENGINEERING, ELURU.

SIR C.R.R COLLEGE OF ENGINEERING, ELURU. SIR C.R.R COLLEGE OF ENGINEERING, ELURU. DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING GRAPHICS AND MULTIMEDIA LAB MANUAL ACADEMIC YEAR: 2016-2017 CLASS : 4/4 B.Tech CSE I SEMESTER SUBJECT : Graphics &

More information

Rasterization: Geometric Primitives

Rasterization: Geometric Primitives Rasterization: Geometric Primitives Outline Rasterizing lines Rasterizing polygons 1 Rasterization: What is it? How to go from real numbers of geometric primitives vertices to integer coordinates of pixels

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS LECTURE 14 RASTERIZATION 1 Lecture Overview Review of last class Line Scan conversion Polygon Scan conversion Antialiasing 2 Rasterization The raster display is a matrix of picture

More information

SE Mock Online Test 1-CG

SE Mock Online Test 1-CG SE Mock Online Test 1-CG 1. Email address * 2. 1. For gentle slope line, slope m is -1

More information

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi Output Primitives Dr. S.M. Malaek Assistant: M. Younesi Output Primitives Output Primitives: Basic geometric structures (points, straight line segment, circles and other conic sections, quadric surfaces,

More information

UNIT 2 GRAPHIC PRIMITIVES

UNIT 2 GRAPHIC PRIMITIVES UNIT 2 GRAPHIC PRIMITIVES Structure Page Nos. 2.1 Introduction 46 2.2 Objectives 46 2.3 Points and Lines 46 2.4 Line Generation Algorithms 48 2.4.1 DDA Algorithm 49 2.4.2 Bresenhams Line Generation Algorithm

More information

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line walters@buffalo.edu CSE 480/580 Lecture 8 Slide 1 2D Graphics Primitives II Additional issues in scan converting lines 1)Endpoint order Want algorithms to draw the same pixels for each line How handle?

More information

Efficient Plotting Algorithm

Efficient Plotting Algorithm Efficient Plotting Algorithm Sushant Ipte 1, Riddhi Agarwal 1, Murtuza Barodawala 1, Ravindra Gupta 1, Prof. Shiburaj Pappu 1 Computer Department, Rizvi College of Engineering, Mumbai, Maharashtra, India

More information

MODULE - 4. e-pg Pathshala

MODULE - 4. e-pg Pathshala e-pg Pathshala MODULE - 4 Subject : Computer Science Paper: Computer Graphics and Visualization Module: Midpoint Circle Drawing Procedure Module No: CS/CGV/4 Quadrant 1 e-text Before going into the Midpoint

More information

Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading.

Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading. Group A Assignment No A1. Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading. Aim: To draw line using DDA and Bresenham s algorithm

More information

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo) CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo) www.vucybarien.com Question No: 1 What are the two focusing methods in CRT? Explain briefly. Page no : 26 1. Electrostatic focusing

More information

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Rasterization Rasterization (scan conversion)

More information

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines COMP30019 Graphics and Interaction Scan Converting Polygons and Lines Department of Computer Science and Software Engineering The Lecture outline Introduction Scan conversion Scan-line algorithm Edge coherence

More information

From Ver(ces to Fragments: Rasteriza(on

From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments 3D vertices vertex shader rasterizer fragment shader final pixels 2D screen fragments l determine fragments to be covered l interpolate

More information

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Downloaded from :www.comp.dit.ie/bmacnamee/materials/graphics/006- Contents In today s lecture we ll have a loo at:

More information

MET71 COMPUTER AIDED DESIGN

MET71 COMPUTER AIDED DESIGN UNIT - II BRESENHAM S ALGORITHM BRESENHAM S LINE ALGORITHM Bresenham s algorithm enables the selection of optimum raster locations to represent a straight line. In this algorithm either pixels along X

More information

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005 INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Renderer Implementation: Basics and Clipping David Carr Virtual Environments, Fundamentals Spring 2005 Feb-28-05 SMM009, Basics and Clipping 1

More information

Raster Scan Displays. Framebuffer (Black and White)

Raster Scan Displays. Framebuffer (Black and White) Raster Scan Displays Beam of electrons deflected onto a phosphor coated screen Phosphors emit light when excited by the electrons Phosphor brightness decays -- need to refresh the display Phosphors make

More information

Computer Graphics D Graphics Algorithms

Computer Graphics D Graphics Algorithms ! Computer Graphics 2014! 2. 2D Graphics Algorithms Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2014-09-26! Screen Nikon D40 Sensors 3 Rasterization - The task of displaying a world modeled

More information

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization. Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática Chap. 2 Rasterization Rasterization Outline : Raster display technology. Basic concepts: pixel, resolution,

More information

Computer Graphics D Graphics Algorithms

Computer Graphics D Graphics Algorithms Computer Graphics 2015 2. 2D Graphics Algorithms Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2015-09-21 Screen - Linear Structure Nikon D40 Sensors 3 RGBW Camera Sensor RGBW Camera Sensor

More information

Overview of Computer Graphics

Overview of Computer Graphics Application of Computer Graphics UNIT- 1 Overview of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe outline form. Multi-window

More information

Chapter 3. Sukhwinder Singh

Chapter 3. Sukhwinder Singh Chapter 3 Sukhwinder Singh PIXEL ADDRESSING AND OBJECT GEOMETRY Object descriptions are given in a world reference frame, chosen to suit a particular application, and input world coordinates are ultimately

More information

Rasteriza2on and Clipping

Rasteriza2on and Clipping Overview Scan conversion Computer Graphics Rasterizaon and Clipping Polygon filling Clipping in D Aleksandra Pizurica Raster Display PIEL (picture element) RASTER (a rectangular array of points or dots)

More information

RASTERIZING POLYGONS IN IMAGE SPACE

RASTERIZING POLYGONS IN IMAGE SPACE On-Line Computer Graphics Notes RASTERIZING POLYGONS IN IMAGE SPACE Kenneth I. Joy Visualization and Graphics Research Group Department of Computer Science University of California, Davis A fundamental

More information

Rasterization, or What is glbegin(gl_lines) really doing?

Rasterization, or What is glbegin(gl_lines) really doing? Rasterization, or What is glbegin(gl_lines) really doing? Course web page: http://goo.gl/eb3aa February 23, 2012 Lecture 4 Outline Rasterizing lines DDA/parametric algorithm Midpoint/Bresenham s algorithm

More information

CS Rasterization. Junqiao Zhao 赵君峤

CS Rasterization. Junqiao Zhao 赵君峤 CS10101001 Rasterization Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Vector Graphics Algebraic equations describe

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

Windowing And Clipping (14 Marks)

Windowing And Clipping (14 Marks) Window: 1. A world-coordinate area selected for display is called a window. 2. It consists of a visual area containing some of the graphical user interface of the program it belongs to and is framed by

More information

Computer Graphics. - Rasterization - Philipp Slusallek

Computer Graphics. - Rasterization - Philipp Slusallek Computer Graphics - Rasterization - Philipp Slusallek Rasterization Definition Given some geometry (point, 2D line, circle, triangle, polygon, ), specify which pixels of a raster display each primitive

More information

1 Introduction to Graphics

1 Introduction to Graphics 1 1.1 Raster Displays The screen is represented by a 2D array of locations called pixels. Zooming in on an image made up of pixels The convention in these notes will follow that of OpenGL, placing the

More information

CS 543: Computer Graphics. Rasterization

CS 543: Computer Graphics. Rasterization CS 543: Computer Graphics Rasterization Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu (with lots

More information

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes Line Attributes Fill-Area Attributes Scan-Line

More information

Computer Graphics 7 - Rasterisation

Computer Graphics 7 - Rasterisation Computer Graphics 7 - Rasterisation Tom Thorne Slides courtesy of Taku Komura www.inf.ed.ac.uk/teaching/courses/cg Overview Line rasterisation Polygon rasterisation Mean value coordinates Decomposing polygons

More information

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA) CSCI 420 Computer Graphics Lecture 14 Rasterization Jernej Barbic University of Southern California Scan Conversion Antialiasing [Angel Ch. 6] Rasterization (scan conversion) Final step in pipeline: rasterization

More information

CSCI 4620/8626. Coordinate Reference Frames

CSCI 4620/8626. Coordinate Reference Frames CSCI 4620/8626 Computer Graphics Graphics Output Primitives Last update: 2014-02-03 Coordinate Reference Frames To describe a picture, the world-coordinate reference frame (2D or 3D) must be selected.

More information

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li. Fall 2015 CSCI 420: Computer Graphics 7.1 Rasterization Hao Li http://cs420.hao-li.com 1 Rendering Pipeline 2 Outline Scan Conversion for Lines Scan Conversion for Polygons Antialiasing 3 Rasterization

More information

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1 General scheme of a 2D CG application 2D Image Synthesis Balázs Csébfalvi modeling image synthesis Virtual world model world defined in a 2D plane Department of Control Engineering and Information Technology

More information

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes t Line Attributes Fill-Area Attributes Scan-Line

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics r About the Tutorial To display a picture of any size on a computer screen is a difficult process. Computer graphics are used to simplify this process. Various algorithms and techniques are used to generate

More information

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms Computer Graphics: Graphics Output Primitives Line Drawing Algorithms By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, 1 Outlines 1. Basic concept of lines in OpenGL 2. Line Equation 3. DDA Algorithm 4. DDA

More information

CS6504 & Computer Graphics Unit I Page 1

CS6504 & Computer Graphics Unit I Page 1 Introduction Computer contains two components. Computer hardware Computer hardware contains the graphics workstations, graphic input devices and graphic output devices. Computer Software Computer software

More information

Filled Area Primitives. CEng 477 Introduction to Computer Graphics METU, 2007

Filled Area Primitives. CEng 477 Introduction to Computer Graphics METU, 2007 Filled Area Primitives CEng 477 Introduction to Computer Graphics METU, 2007 Filled Area Primitives Two basic approaches to area filling on raster systems: Determine the overlap intervals for scan lines

More information

Topic #1: Rasterization (Scan Conversion)

Topic #1: Rasterization (Scan Conversion) Topic #1: Rasterization (Scan Conversion) We will generally model objects with geometric primitives points, lines, and polygons For display, we need to convert them to pixels for points it s obvious but

More information

An Improved Algorithm for Scan-converting a Line

An Improved Algorithm for Scan-converting a Line An Improved Algorithm for Scan-converting a Line *Md. Hasanul Kabir 1, Md. Imrul Hassan 2, Abdullah Azfar 1 1 Department of Computer Science & Information Technology (CIT) 2 Department of Electrical &

More information

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels Pixels Pixel: Intensity or color sample. Raster Image: Rectangular grid of pixels. Rasterization: Conversion of a primitive s geometric representation into A set of pixels. An intensity or color for each

More information

CS 130. Scan Conversion. Raster Graphics

CS 130. Scan Conversion. Raster Graphics CS 130 Scan Conversion Raster Graphics 2 1 Image Formation Computer graphics forms images, generally two dimensional, using processes analogous to physical imaging systems like: - Cameras - Human visual

More information

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines Emmanuel Agu 2D Graphics Pipeline Clipping Object World Coordinates Applying world window Object subset window to viewport mapping

More information

Pipeline implementation II

Pipeline implementation II Pipeline implementation II Overview Line Drawing Algorithms DDA Bresenham Filling polygons Antialiasing Rasterization Rasterization (scan conversion) Determine which pixels that are inside primitive specified

More information

Line Drawing. Foundations of Computer Graphics Torsten Möller

Line Drawing. Foundations of Computer Graphics Torsten Möller Line Drawing Foundations of Computer Graphics Torsten Möller Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism Reading Angel

More information

Realtime 3D Computer Graphics Virtual Reality

Realtime 3D Computer Graphics Virtual Reality Realtime 3D Computer Graphics Virtual Reality From Vertices to Fragments Overview Overall goal recapitulation: Input: World description, e.g., set of vertices and states for objects, attributes, camera,

More information

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,

More information

CPSC / Scan Conversion

CPSC / Scan Conversion CPSC 599.64 / 601.64 Computer Screens: Raster Displays pixel rasters (usually) square pixels in rectangular raster evenly cover the image problem no such things such as lines, circles, etc. scan conversion

More information

(Refer Slide Time: 00:03:51)

(Refer Slide Time: 00:03:51) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 17 Scan Converting Lines, Circles and Ellipses Hello and welcome everybody

More information

Graphics Output Primitives

Graphics Output Primitives Important Graphics Output Primitives Graphics Output Primitives in 2D polgons, circles, ellipses & other curves piel arra operations in 3D triangles & other polgons Werner Purgathofer / Computergraphik

More information

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller Line Drawing Introduction to Computer Graphics Torsten Möller / Mike Phillips Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Color Interaction Texture/ Realism

More information

Output Primitives Lecture: 4. Lecture 4

Output Primitives Lecture: 4. Lecture 4 Lecture 4 Circle Generating Algorithms Since the circle is a frequently used component in pictures and graphs, a procedure for generating either full circles or circular arcs is included in most graphics

More information

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into 2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into the viewport of the current application window. A pixel

More information

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE DRAWING PRIMITIVES: LEGACY VS. NEW Legacy: specify primitive in glbegin() glbegin(gl_points); glvertex3f(1,5,0);

More information

Overview of Transformations (18 marks) In many applications, changes in orientations, size, and shape are accomplished with

Overview of Transformations (18 marks) In many applications, changes in orientations, size, and shape are accomplished with Two Dimensional Transformations In many applications, changes in orientations, size, and shape are accomplished with geometric transformations that alter the coordinate descriptions of objects. Basic geometric

More information

CSC Computer Graphics

CSC Computer Graphics // CSC. Computer Graphics Lecture Kasun@dscs.sjp.ac.lk Department of Computer Science University of Sri Jayewardanepura Polygon Filling Scan-Line Polygon Fill Algorithm Span Flood-Fill Algorithm Inside-outside

More information

(Refer Slide Time: 00:02:00)

(Refer Slide Time: 00:02:00) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 18 Polyfill - Scan Conversion of a Polygon Today we will discuss the concepts

More information

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California CSCI 420 Computer Graphics Lecture 14 Rasterization Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California 1 Rasterization (scan conversion) Final step in pipeline:

More information

Display Technologies: CRTs Raster Displays

Display Technologies: CRTs Raster Displays Rasterization Display Technologies: CRTs Raster Displays Raster: A rectangular array of points or dots Pixel: One dot or picture element of the raster Scanline: A row of pixels Rasterize: find the set

More information

Topics. From vertices to fragments

Topics. From vertices to fragments Topics From vertices to fragments From Vertices to Fragments Assign a color to every pixel Pass every object through the system Required tasks: Modeling Geometric processing Rasterization Fragment processing

More information

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Scan Converting Lines, Circles and Ellipses Hello everybody, welcome again

More information

Lab Manual. Computer Graphics. T.E. Computer. (Sem VI)

Lab Manual. Computer Graphics. T.E. Computer. (Sem VI) Lab Manual Computer Graphics T.E. Computer (Sem VI) Index Sr. No. Title of Programming Assignments Page No. 1. Line Drawing Algorithms 3 2. Circle Drawing Algorithms 6 3. Ellipse Drawing Algorithms 8 4.

More information

Scan Converting Circles

Scan Converting Circles Scan Conversion Algorithms CS 460 Computer Graphics Professor Richard Eckert Circles Ellipses and Other 2-D Curves Text February 16, 2004 Scan Converting Circles Given: Center: (h,k) Radius: r Equation:

More information

(Refer Slide Time: 9:36)

(Refer Slide Time: 9:36) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 13 Scan Converting Lines, Circles and Ellipses Hello and welcome to the lecture

More information

Computer Engineering and Intelligent Systems ISSN (Paper) ISSN (Online) Vol.5, No.4, 2014

Computer Engineering and Intelligent Systems ISSN (Paper) ISSN (Online) Vol.5, No.4, 2014 Implementation of an Efficient Scan-Line Polygon Fill Algorithm Dr. Ismail Al-Rawi Arab Open University (Kuwait Branch), P.O 830 Al Ardia, P.C 92400, Kuwait *E-Mail: ism_49@hotmail.com Abstract Area filling

More information

Computer Graphics: 6-Rasterization

Computer Graphics: 6-Rasterization Computer Graphics: 6-Rasterization Prof. Dr. Charles A. Wüthrich, Fakultät Medien, Medieninformatik Bauhaus-Universität Weimar caw AT medien.uni-weimar.de Raster devices In modern devices the smallest

More information

Advantages: Disadvantages: Q.1 Explain raster scan display with its advantages and disadvantages?

Advantages: Disadvantages: Q.1 Explain raster scan display with its advantages and disadvantages? Max Marks: 10 Subject: Computer Graphics & Multimedia (7 th Semester IT 2017-18) Time: 1hr Q.1 Explain raster scan display with its advantages and disadvantages? Ans: In a raster scan system, the electron

More information

POLYGON FILLING ALGORITHM

POLYGON FILLING ALGORITHM POLYGON FILLING ALGORITHM http://www.tutorialspoint.com/computer_graphics/polygon_filling_algorithm.htm Copyright tutorialspoint.com Polygon is an ordered list of vertices as shown in the following figure.

More information

Rendering. Basic Math Review. Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers.

Rendering. Basic Math Review. Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers. Rendering Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers Basic Math Review Slope-Intercept Formula For Lines Given a third point on the line: P = (X,Y)

More information

Scan Converting Lines

Scan Converting Lines Scan Conversion 1 Scan Converting Lines Line Drawing Draw a line on a raster screen between two points What s wrong with the statement of the problem? it doesn t say anything about which points are allowed

More information

Scan Conversion. Lines and Circles

Scan Conversion. Lines and Circles Scan Conversion Lines and Circles (Chapter 3 in Foley & Van Dam) 2D Line Implicit representation: αx + βy + γ = 0 Explicit representation: y y = mx+ B m= x Parametric representation: x P= y P = t y P +

More information

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU FROM VERTICES TO FRAGMENTS Lecture 5 Comp3080 Computer Graphics HKBU OBJECTIVES Introduce basic implementation strategies Clipping Scan conversion OCTOBER 9, 2011 2 OVERVIEW At end of the geometric pipeline,

More information

CS452/552; EE465/505. Clipping & Scan Conversion

CS452/552; EE465/505. Clipping & Scan Conversion CS452/552; EE465/505 Clipping & Scan Conversion 3-31 15 Outline! From Geometry to Pixels: Overview Clipping (continued) Scan conversion Read: Angel, Chapter 8, 8.1-8.9 Project#1 due: this week Lab4 due:

More information

Line Drawing Week 6, Lecture 9

Line Drawing Week 6, Lecture 9 CS 536 Computer Graphics Line Drawing Week 6, Lecture 9 David Breen, William Regli and axim Peysakhov Department of Computer Science Drexel University Outline Line drawing Digital differential analyzer

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Objectives Survey Line Drawing Algorithms - DDA - Bresenham 2 Rasterization

More information

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 ) CSCI 4620/8626 Computer Graphics Clipping Algorithms (Chapter 8-5 ) Last update: 2016-03-15 Clipping Algorithms A clipping algorithm is any procedure that eliminates those portions of a picture outside

More information

? Which intermediate. Recall: Line drawing algorithm. Programmer specifies (x,y) of end pixels Need algorithm to determine pixels on line path

? Which intermediate. Recall: Line drawing algorithm. Programmer specifies (x,y) of end pixels Need algorithm to determine pixels on line path Recall: Line drawing algorithm Programmer specifies (x,y) of end pixels Need algorithm to determine pixels on line path 8 7 6 5 4 3 2 1 (3,2) (9,6) Line: (3,2) -> (9,6)? Which intermediate pixels to turn

More information