Windowing And Clipping (14 Marks)
|
|
- Amelia Willis
- 5 years ago
- Views:
Transcription
1 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 a window decoration. 3. A window defines a rectangular area in world coordinates. Viewport: 1. An area on a display device to which a window is mapped is called a viewport. 2. A viewport is a polygon viewing region in computer graphics. The viewport is an area expressed in rendering-device-specific coordinates, e.g. pixels for screen coordinates, in which the objects of interest are going to be rendered. Window to viewport transformation: The window defines what is to be viewed; the viewport defines where it is to be displayed. 1. Window-to-Viewport transformation is the process of transforming a two-dimensional, world-coordinate scene to device coordinates. 2. In particular, objects inside the world or clipping window are mapped to the viewport. The viewport is displayed in the interface window on the screen. Figure: window and viewport The picture is stored in the computer memory using any convenient Cartesian co-ordinate system, referred to as World Co-Ordinate System (WCS). However, when picture is displayed on the display device it is measured in Physical Device Co-Ordinate System (PDCS) corresponding to the display device. The viewing transformation which maps picture co-ordinates in the WCS to display co-ordinates in PDCS is performed by the following transformations.
2 Converting world co-ordinates to viewing co-ordinates. Normalizing viewing co-ordinates. Converting normalized viewing co-ordinates to device co-ordinates. Figure: Two-dimensional viewing-transformation pipeline. The steps involved in viewing transformation:- 1. Construct the scene in world co-ordinate using the output primitives and attributes. 2. Obtain a particular orientation for the window by setting a two-dimensional viewing co-ordinate system in the world co-ordinate plane and define a window in the viewing co-ordinate system. 3. Use viewing co-ordinates reference frame to provide a method for setting up arbitrary orientations for rectangular windows. 4. Once the viewing reference frame is established, transform descriptions in world co-ordinates to viewing co-ordinates. 5. Define a view port in normalized co-ordinates and map the viewing co-ordinates description of the scene to normalized co-ordinates. 6. Clip all the parts of the picture which lie outside the viewport. Line clipping: In line clipping, we will cut the portion of line which is outside of window and keep only the portion that is inside the window. Cohen Sutherland Line Clipping Algorithm Different cases which are to be consider before clipping line are, i) Completely inside. ii) Completely outside. iii) Partly inside.
3 As shown in fig three lines are given in which one line is inside window so that is displayed, second line is completely outside so it is discarded after clipping, and third line is clipped as it is partially in so that much part is displayed and remaining part is discarded. Line clipping in given window.
4 Algorithm: 1. Read 2 end points of line as p1(x1,y1) and p2(x2,y2) 2. Read 2 corner points of the clipping window (left-top and right-bottom) as (wx1,wy1) and (wx2,wy2) 3. Assign the region codes for 2 endpoints p1 and p2 using following steps:- initialize code with 0000 Set bit 1 if x<wx1 Set bit 2 if x>wx2 Set bit 3 if y<wy2 Set bit 4 if y>wy1 4. Check for visibility of line a. If region codes for both endpoints are zero then line is completely visible. Draw the line go to step 9. b. If region codes for endpoints are not zero and logical ANDing of them is also nonzero then line is invisible. Discard the line and move to step 9. c. If it does not satisfy 4.a and 4.b then line is partially visible. 5. Determine the intersecting edge of clipping window as follows:- a. If region codes for both endpoints are nonzero find intersection points p1 and p2 with boundary edges. b. If region codes for any one end point is non zero then find intersection point p1 or p2. 6. Divide the line segments considering intersection points.
5 7. Reject line segment if any end point of line appears outside of any boundary. 8. Draw the clipped line segment. 9. Stop. Program: #include<stdio.h> #include<graphics.h> void main() int gd=detect, gm; float i,xmax,ymax,xmin,ymin,x11,y11,x22,y22,m; float a[4],b[4],c[4],x1,y1; clrscr(); initgraph(&gd,&gm,"c:\\turboc3\\bgi"); printf("\nenter the bottom-left coordinate of viewport: "); scanf("%f %f",&xmin,&ymin); printf("\nenter the top-right coordinate of viewport: "); scanf("%f %f",&xmax,&ymax); rectangle(xmin,ymin,xmax,ymax); printf("\nenter the coordinates of 1st end point of line: "); scanf("%f %f",&x11,&y11); printf("\nenter the coordinates of 2nd endpoint of line: "); scanf("%f %f",&x22,&y22); line(x11,y11,x22,y22); for(i=0;i<4;i++) a[i]=0; b[i]=0; m=(y22-y11)/(x22-x11); if(x11<xmin) a[3]=1; if(x11>xmax) a[2]=1; if(y11<ymin) a[1]=1; if(y11>ymax) a[0]=1; if(x22<xmin) b[3]=1; if(x22>xmax) b[2]=1; if(y22<ymin) b[1]=1; if(y22>ymax) b[0]=1; printf("\nregion code of 1st pt "); for(i=0;i<4;i++)
6 printf("%f",a[i]); printf("\nregion code of 2nd pt "); for(i=0;i<4;i++) printf("%f",b[i]); printf("\nanding : "); for(i=0;i<4;i++) c[i]=a[i]&&b[i]; for(i=0;i<4;i++) printf("%f",c[i]); getch(); if((c[0]==0)&&(c[1]==0)&&(c[2]==0)&&(c[3]==0)) if((a[0]==0)&&(a[1]==0)&&(a[2]==0)&&(a[3]==0)&& (b[0]==0)&&(b[1]==0)&&(b[2]==0)&&(b[3]==0)) clrscr(); clearviewport(); printf("\nthe line is totally visible\nand not a clipping candidate"); rectangle(xmin,ymin,xmax,ymax); line(x11,y11,x22,y22); getch(); else clrscr(); clearviewport(); printf("\nline is partially visible"); rectangle(xmin,ymin,xmax,ymax); line(x11,y11,x22,y22); getch(); if((a[0]==0)&&(a[1]==1)) x1=x11+(ymin-y11)/m; x11=x1; y11=ymin; else if((b[0]==0)&&(b[1]==1)) x1=x22+(ymin-y22)/m; x22=x1; y22=ymin;
7 if((a[0]==1)&&(a[1]==0)) x1=x11+(ymax-y11)/m; x11=x1; y11=ymax; else if((b[0]==1)&&(b[1]==0)) x1=x22+(ymax-y22)/m; x22=x1; y22=ymax; if((a[2]==0)&&(a[3]==1)) y1=y11+m*(xmin-x11); y11=y1; x11=xmin; else if((b[2]==0)&&(b[3]==1)) y1=y22+m*(xmin-x22); y22=y1; x22=xmin; if((a[2]==1)&&(a[3]==0)) y1=y11+m*(xmax-x11); y11=y1; x11=xmax; else if((b[2]==1)&&(b[3]==0)) y1=y22+m*(xmax-x22); y22=y1; x22=xmax; clrscr(); clearviewport(); printf("\nafter clippling:"); rectangle(xmin,ymin,xmax,ymax); line(x11,y11,x22,y22); getch(); else
8 clrscr(); clearviewport(); printf("\nline is invisible"); rectangle(xmin,ymin,xmax,ymax); getch(); closegraph(); getch(); Reference : Cyrus Beck algorithm Convex region, boundary point and inner normal Cyrus and Beck developed an algorithm for clipping to arbitrary convex regions. Cyrus- Beck algorithm uses the normal vector for determining whether a point is inside, on, or outside a window. Consider a convex planar polygon R. Consider the parametric representation of a line from P1 to P2. If f is a boundary point of the convex region R and n is an inner normal for one of its boundaries, then for any particular value of t, i.e. any particular point on line P1P2.
9 Together these conditions show that for a convex polygon, an infinite line, which intersects the boundary of the region, does so at precisely two points. Further, these two points do not lie on the same boundary edge. Thus n [P(t) f] = 0 has only one solution. If the point f lies in the boundary edge for which n is the inner normal, then that point (t) on the line P(t) which satisfies this condition is the intersection of the line and the boundary edge. Algorithm:
10 Liang-Barsky Line Clipping The ideas for clipping line of Liang-Barsky and Cyrus-Beck are the same. The only difference is Liang-Barsky algorithm has been optimized for an upright rectangular clip window. Liang and Barsky have created an algorithm that uses floating-point arithmetic but finds the appropriate end points with at most four computations. This algorithm uses the parametric equations for a line and solves four inequalities to find the range of the parameter for which the line is in the viewport. 1. parametric equation of line segment: X = X1 + U ΔX Y = Y1 + U ΔY Where, ΔX = X2 X1 and ΔY = Y2 Y1
11 2. Using these equations Cyrus and Beck developed an algorithm that is generated more efficient than the Cohen Sutherland algorithm. 3. Later Liang and Barsky independently devised an even faster parametric line clipping algorithm. 4. In the Liang-Barsky approach we first the point clipping condition in parametric form: Xmin X1+UΔX XmaxXmin X1+UΔX Xmax Ymin Y1+UΔY YmaxYmin Y1+UΔY Ymax 5. Each of these four inequalities can be expressed as: μpk qk for k=1,2,3,4 6. The parameters p & q are defined as: p1 = -ΔX and q1 = X1 Xmin (Left Boundary) p2 = ΔX and q2 = Xmax - x1 (Right Boundary) P3 = -ΔY and q3 = Y1- Ymin (Bottom Boundary) P4 = ΔY and q4 = Ymax - y1 (Top Boundary) 7. If a line is parallel to a view window boundary, the p value for that boundary is zero. 8. If the line is parallel to the X axis, for example then p1 and p2 must be zero. o o Given pk = 0, if qk < 0 then line is trivially invisible because it is outside view window. Given pk = 0, if qk > 0 then the line is inside the corresponding window boundary. 9. When pk < 0, as U increase line goes from the outside to inside i.e. entering. 10. When pk > 0, line goes from inside to outside i.e. exiting. 11. If there is a segment of line inside the clip region, a sequence of infinite line intersections must go entering, entering, exiting, and exiting as shown in figure.
12 Algorithm:
13 Advantages 1. More efficient than other algorithms as line intersection with boundaries calculations are reduced. 2. Intersections of line are computed only once. Program for Line Clipping Using Liang Barsky Algorithm: #include<stdio.h> #include<conio.h>
14 #include<graphics.h> #include<dos.h> #define ROUND(a)((int)(a+0.5)) int cliptest(float p,float q,float *u1,float *u2) float r; int retval=1; if(p<0.0) r=q/p; if(r>*u2) retval=0; if(r>*u1) *u1=r; else if(p>0.0) r=q/p; if(r<*u1) retval=0; if(r<*u2) *u2=r; else if(q<0.0) retval=0; return(retval); void clipline(int minx,int miny,int maxx,int maxy,int x1,int y1,int x2,int y2) float u1=0.0,u2=1.0,dx=x2-x1,dy; if(cliptest(-dx,x1-minx,&u1,&u2)) if(cliptest(dx,maxx-x1,&u1,&u2)) dy=y2-y1; if(cliptest(-dy,y1-miny,&u1,&u2)) if(cliptest(dy,maxy-y1,&u1,&u2)) if(u2<1.0) x2=x1+u2*dx;
15 y2=y1+u2*dy; if(u1>0.0) x1+=u1*dx; y1+=u1*dy; line(x1,y1,x2,y2); void main() int gdriver=detect,gmode,x1,y1,x2,y2,minx,miny,maxx,maxy; initgraph(&gdriver,&gmode,"c:\\turboc3\\bgi"); clrscr(); printf("enter the min & max x values: "); scanf("%d %d",&minx,&maxx); printf("enter the min & max y values: "); scanf("%d %d",&miny,&maxy); printf("enter the first endpoint: "); scanf("%d %d",&x1,&y1); printf("enter the second endpoint: "); scanf("%d %d",&x2,&y2); clrscr(); printf("before Clipping"); line(x1,y1,x2,y2); rectangle(minx,maxy,maxx,miny); getch(); clrscr(); printf("after Clipping"); clipline(minx,miny,maxx,maxy,x1,y1,x2,y2); rectangle(minx,maxy,maxx,miny); getch(); Midpoint subdivision algorithm: Midpoint subdivision algorithm is an extension of the Cyrus Beck algorithm. This algorithm is mainly used to compute visible areas of lines that are present in the view port are of the sector or the image.
16 Algorithm : 1)Read two end points of line P1 (x1,y1) and P2 (x2,y2). 2) Read corners of window (Wx1, Wy1) and (Wx2, Wy2). 3) Assign region codes for P1 and P2. A region code is a 4 digit bit code which indicates one of nine regions having the end point of line. Initialize code with bits 0000 Set Bit 1 if (x<wx1) Set Bit 2 if (x>wx2) Set Bit 3 if (y<wy2) Set Bit 4 if (y>wy1) 4) Check visibility of line P1P2 a) If region codes for both end points P1 and P2 are 0 = > Line is completely visible. Draw Line and Go to Step 3. b) If region codes for both end points P1 and P2 are not 0 and logical ANDing of them is also not zero = > Line is completely invisible. Reject line and Go to Step 3. c) If a) and b) both are not satisfied, line is partially visible.
17 5) Divide partially visible line segments to equal parts and repeat steps 3 through 5 for both sub divided line segments until you get completely visible and completely invisible line segments. 6) Stop. Program: //MIDPOINT SUBDIVISION LINE CLIPPING #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<dos.h> #include<math.h> #include<graphics.h> typedef struct coordinate int x,y; char code[4]; PT; void drawwindow(); void drawline (PT p1,pt p2,int cl); PT setcode(pt p); int visibility (PT p1,pt p2); PT resetendpt (PT p1,pt p2); main() int gd=detect, gm,v; PT p1,p2,ptemp; initgraph(&gd,&gm,"c:\\turboc3\\bgi "); cleardevice(); printf("\n\n\t\tenter END-POINT 1 (x,y): "); scanf("%d%d",&p1.x,&p1.y); printf("\n\n\t\tenter END-POINT 2 (x,y): "); scanf("%d%d",&p2.x,&p2.y); cleardevice(); drawwindow(); getch(); drawline(p1,p2,15); getch();
18 cleardevice(); drawwindow(); midsub(p1,p2); getch(); closegraph(); return(0); midsub(pt p1,pt p2) PT mid; int v; p1=setcode(p1); p2=setcode(p2); v=visibility(p1,p2); switch(v) case 0: /* Line conpletely visible */ drawline(p1,p2,15); break; case 1: /* Line completely invisible */ break; case 2: /* line partly visible */ mid.x = p1.x + (p2.x-p1.x)/2; mid.y = p1.y + (p2.y-p1.y)/2; midsub(p1,mid); mid.x = mid.x+1; mid.y = mid.y+1; midsub(mid,p2); break; void drawwindow() setcolor(red); line(150,100,450,100); line(450,100,450,400); line(450,400,150,400); line(150,400,150,100);
19 void drawline (PT p1,pt p2,int cl) setcolor(cl); line(p1.x,p1.y,p2.x,p2.y); PT setcode(pt p) PT ptemp; if(p.y<=100) ptemp.code[0]='1'; /* TOP */ else ptemp.code[0]='0'; if(p.y>=400) ptemp.code[1]='1'; /* BOTTOM */ else ptemp.code[1]='0'; if (p.x>=450) ptemp.code[2]='1'; /* RIGHT */ else ptemp.code[2]='0'; if (p.x<=150) /* LEFT */ ptemp.code[3]='1'; else ptemp.code[3]='0'; ptemp.x=p.x; ptemp.y=p.y; return(ptemp); int visibility (PT p1,pt p2) int i,flag=0; for(i=0;i<4;i++) if((p1.code[i]!='0') (p2.code[i]!='0')) flag=1; if(flag==0)
20 return(0); for(i=0;i<4;i++) if((p1.code[i]==p2.code[i]) &&(p1.code[i]=='1')) flag=0; if(flag==0) return(1); return(2); Polygon clipping: There are several well-known polygon clipping algorithms, each having its strengths and weaknesses. The oldest one (from 1974) is called the Sutherland-Hodgman algorithm. In its basic form, it is relatively simple. It is also very efficient in two important cases, one being when the polygon is completely inside the boundaries, and the other when it's completely outside. Sutherland - Hodgeman Polygon Clipping: Each edge of the polygon must be tested against each edge of the clip rectangle. New edges must be added, and existing edges must be discarded, retained, or divided. Multiple polygons may result from clipping a single polygon. We need an organized way to deal with all these cases. Steps of Sutherland-Hodgeman's polygon clipping algorithm: i. Polygons can be clipped against each edge of the window one at a time. ii. Vertices which are kept after clipping against one window edge are saved for clipping against the remaining edges. iii. Note that the number of vertices usually changes and will often increases.
21 Four Cases of polygon clipping against one Edge: The clip boundary determines a visible and invisible region. The edges from vertex can be one of four types: Case 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 vertex which is inside the window is stored in a output vertex list. Case 2: If both, first and second vertexes of a polygon are lying inside the window, and then we have to store the second vertex only in output vertex list. Case 3: If the first vertex is inside the window and second vertex is outside the window then we have to store only intersection point of that edge of polygon with window in output vertex list. Case 4: If both the vertex first and second vertex of a polygon is lying outside the window then no vertex is stored in output vertex list.
22 Algorithm: Program:
Two-Dimensional Viewing. Chapter 6
Two-Dimensional Viewing Chapter 6 Viewing Pipeline Two-Dimensional Viewing Two dimensional viewing transformation From world coordinate scene description to device (screen) coordinates Normalization and
More information3D Rendering Pipeline (for direct illumination)
Clipping 3D Rendering Pipeline (for direct illumination) 3D Primitives 3D Modeling Coordinates Modeling Transformation Lighting 3D Camera Coordinates Projection Transformation Clipping 2D Screen Coordinates
More informationComputer Graphics Viewing Objective
Computer Graphics Viewing Objective The aim of this lesson is to make the student aware of the following concepts: Window Viewport Window to Viewport Transformation line clipping Polygon Clipping Introduction
More informationFrom Vertices To Fragments-1
From Vertices To Fragments-1 1 Objectives Clipping Line-segment clipping polygon clipping 2 Overview At end of the geometric pipeline, vertices have been assembled into primitives Must clip out primitives
More informationDHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI
DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI Department of Computer Science and Engineering CS6504-COMPUTER GRAPHICS Anna University 2 & 16 Mark Questions & Answers Year / Semester: III / V Regulation:
More informationClipping Lines. Dr. Scott Schaefer
Clipping Lines Dr. Scott Schaefer Why Clip? We do not want to waste time drawing objects that are outside of viewing window (or clipping window) 2/94 Clipping Points Given a point (x, y) and clipping window
More informationClipping Points Consider a clip window which is rectangular in shape. P(x, y) is a point to be displayed.
Usually only a specified region of a picture needs to be displayed. This region is called the clip window. An algorithm which displays only those primitives (or part of the primitives) which lie inside
More informationCS123 INTRODUCTION TO COMPUTER GRAPHICS. Clipping. Concepts, Algorithms for line clipping. 1 of 16. Andries van Dam. Clipping - 10/12/17
Clipping Concepts, Algorithms for line clipping 1 of 16 Line Clipping in 2D Clipping endpoints If x min x x max and y min y y max, the point is inside the clip rectangle. Endpoint analysis for lines: if
More informationChapter 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 informationPart IV. 2D Clipping
Part IV 2D Clipping The Liang-Barsky algorithm Boolean operations on polygons Outline The Liang-Barsky algorithm Boolean operations on polygons Clipping The goal of clipping is mainly to eliminate parts
More informationComputer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) OpenGL Stages After projection, several stages before objects drawn
More informationCSCI 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 informationBinghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science. Computer Graphics. State University of New York.
Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced
More information2D 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 information2D Viewing. Viewing Pipeline: Window-Viewport Transf.
Viewing Pipeline: Window-Viewport Transf. 2D Viewing yw max clipping window: what to display viewport: where to be viewed translation, rotation, scaling, clipping,... Clipping Window yv max Viewport yv
More informationOverview 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 informationPart 3: 2D Transformation
Part 3: 2D Transformation 1. What do you understand by geometric transformation? Also define the following operation performed by ita. Translation. b. Rotation. c. Scaling. d. Reflection. 2. Explain two
More informationCS602 MCQ,s for midterm paper with reference solved by Shahid
#1 Rotating a point requires The coordinates for the point The rotation angles Both of above Page No 175 None of above #2 In Trimetric the direction of projection makes unequal angle with the three principal
More informationComputer Graphics. - Clipping - Philipp Slusallek & Stefan Lemme
Computer Graphics - Clipping - Philipp Slusallek & Stefan Lemme Clipping Motivation Projected primitive might fall (partially) outside of the visible display window E.g. if standing inside a building Eliminate
More informationComputer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL
Computer Graphics Chapter 6 The Two-Dimensional Viewing Somsak Walairacht, Computer Engineering, KMITL Outline The Two-Dimensional Viewing Pipeline The Clipping Window Normalization and Viewport Transformations
More informationViewing Transformation. Clipping. 2-D Viewing Transformation
Viewing Transformation Clipping 2-D Viewing Transformation 2-D Viewing Transformation Convert from Window Coordinates to Viewport Coordinates (xw, yw) --> (xv, yv) Maps a world coordinate window to a screen
More information521493S Computer Graphics Exercise 1 (Chapters 1-3)
521493S Computer Graphics Exercise 1 (Chapters 1-3) 1. Consider the clipping of a line segment defined by the latter s two endpoints (x 1, y 1 ) and (x 2, y 2 ) in two dimensions against a rectangular
More informationClipping and Scan Conversion
15-462 Computer Graphics I Lecture 14 Clipping and Scan Conversion Line Clipping Polygon Clipping Clipping in Three Dimensions Scan Conversion (Rasterization) [Angel 7.3-7.6, 7.8-7.9] March 19, 2002 Frank
More informationExamples. Clipping. The Rendering Pipeline. View Frustum. Normalization. How it is done. Types of operations. Removing what is not seen on the screen
Computer Graphics, Lecture 0 November 7, 006 Eamples Clipping Types of operations Accept Reject Clip Removing what is not seen on the screen The Rendering Pipeline The Graphics pipeline includes one stage
More information1. DDA Algorithm(Digital Differential Analyzer)
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
More informationComputer Graphics: 7-Polygon Rasterization, Clipping
Computer Graphics: 7-Polygon Rasterization, Clipping Prof. Dr. Charles A. Wüthrich, Fakultät Medien, Medieninformatik Bauhaus-Universität Weimar caw AT medien.uni-weimar.de Filling polygons (and drawing
More information2D 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 informationLAB 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 informationUnit 3 Transformations and Clipping
Transformation Unit 3 Transformations and Clipping Changes in orientation, size and shape of an object by changing the coordinate description, is known as Geometric Transformation. Translation To reposition
More informationUNIT 2. Translation/ Scaling/ Rotation. Unit-02/Lecture-01
UNIT 2 Translation/ Scaling/ Rotation Unit-02/Lecture-01 Translation- (RGPV-2009,10,11,13,14) Translation is to move, or parallel shift, a figure. We use a simple point as a starting point. This is a simple
More informationCOMPUTATIONAL GEOMETRY
Thursday, September 20, 2007 (Ming C. Lin) Review on Computational Geometry & Collision Detection for Convex Polytopes COMPUTATIONAL GEOMETRY (Refer to O'Rourke's and Dutch textbook ) 1. Extreme Points
More informationCS452/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 informationRealtime 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 informationComputer Graphics Geometry and Transform
! Computer Graphics 2014! 5. Geometry and Transform Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2014-10-11! Today outline Triangle rasterization Basic vector algebra ~ geometry! Antialiasing
More informationComputer Graphics. Brian Wyvill. Clipping. cpsc/enel P 1 H K AB AC DE FG HI JK
Comuter Grahic 1001 A 1000 F 1010 0001 0000 0010 G E C B D 0101 H 0100 0110 K I J P2 P3 Outide Inide P4 P1 Cliing by AB AC DE FG HI JK 1001 1001 0000 0000 0101 0110 0000 0001 0000 1000 0010 0110 AND 0000
More informationRenderer 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 informationTwo Dimensional Viewing
Two Dimensional Viewing Dr. S.M. Malaek Assistant: M. Younesi Two Dimensional Viewing Basic Interactive Programming Basic Interactive Programming User controls contents, structure, and appearance of objects
More informationVISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH
VISIBILITY & CULLING Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH Visibility Visibility Given a set of 3D objects, which surfaces are visible from a specific point
More informationTopics. 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 informationSet the Viewport. Set the Viewport Clipping. Set the Viewport. Set the Viewport. Set the Viewport. Resizing the Viewport W = H
To draw an undistorted version of the data in a viewport, you need to ensure the viewport and the window have the same aspect ratio. i.e. W H window window W = H viewport viewport Computer Graphics CSC470
More informationA New Algorithm for Pyramidal Clipping of Line Segments in E 3
A New Algorithm for Pyramidal Clipping of Line Segments in E 3 Vaclav Skala 1, Duc Huy Bui Department of Informatics and Computer Science 2 University of West Bohemia Univerzitni 22, Box 314 306 14 Plzen
More informationClipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling
Clipping & Culling Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling Lecture 11 Spring 2015 What is Clipping? Clipping is a procedure for spatially partitioning geometric primitives,
More informationFebruary 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//2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING. #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<stdlib.
//2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING #include #include #include #include #include void main() int gd=detect,gm,i,x[10],y[10],a,b,c,d,n,tx,ty,sx,sy,ch;
More informationGraphics System. Processor. Output Display. Input Devices. Frame Buffer. Memory. Array of pixels. Resolution: # of pixels Depth: # of bits/pixel
Graphics System Input Devices Processor Memory Frame Buffer Output Display Array of pixels Resolution: # of pixels Depth: # of bits/pixel Input Devices Physical Devices: Keyboard, Mouse, Tablet, etc. Logical
More informationLab 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 informationClipping and Intersection
Clipping and Intersection Clipping: Remove points, line segments, polygons outside a region of interest. Need to discard everything that s outside of our window. Point clipping: Remove points outside window.
More informationLast class. A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization
Lecture 6 Last class Last lecture (clip coordinates): A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization normalized view
More informationCS602- Computer Graphics Solved MCQS From Midterm Papers. MIDTERM EXAMINATION Spring 2013 CS602- Computer Graphics
CS602- Computer Graphics Solved MCQS From Midterm Papers Dec 18,2013 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 Question No: 1 ( Marks: 1 ) - Please choose one DDA abbreviated for. Discrete
More informationCs602-computer graphics MCQS MIDTERM EXAMINATION SOLVED BY ~ LIBRIANSMINE ~
Cs602-computer graphics MCQS MIDTERM EXAMINATION SOLVED BY ~ LIBRIANSMINE ~ Question # 1 of 10 ( Start time: 08:04:29 PM ) Total Marks: 1 Sutherland-Hodgeman clipping algorithm clips any polygon against
More informationCS-184: Computer Graphics. Today. 2D Scan Conversion. Tuesday, October 7, Drawing Lines Drawing Curves Filled Polygons Filling Algorithms
CS-184: Computer Graphics Lecture #9: Scan Conversion Prof. James O Brien University of California, Berkeley V2008-F-09-1.0 1 Today 2D Scan Conversion Drawing Lines Drawing Curves Filled Polygons Filling
More informationLINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM
Ex.no :1 Date: LINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM AIM: To write a program to implement Bresenham s algorithms for line, circle and ellipse drawing. ALGORITHM: Step1: Create a function
More informationLecture 7 of 41. Viewing 4 of 4: Culling and Clipping Lab 1b: Flash Intro
Viewing 4 of 4: Culling and Clipping Lab 1b: Flash Intro William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://bit.ly/hgvxlh / http://bit.ly/evizre Public mirror
More informationCS-184: Computer Graphics
CS-184: Computer Graphics Lecture #9: Scan Conversion Prof. James O Brien University of California, Berkeley V2009-F-09-1.0 Today 2D Scan Conversion Drawing Lines Drawing Curves Filled Polygons Filling
More informationMODULE - 9. Subject: Computer Science. Module: Line Clipping. Module No: CS/CGV/9
Quadrant 1 e-text e-pg Pathshala MODULE - 9 Subject: Computer Science Paper: Computer Graphics and Visualization Module: Line Clipping Module No: CS/CGV/9 Objectives: Understand Cohen-Sutherland Line Clipping
More informationHidden Surfaces II. Week 9, Mon Mar 15
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Hidden Surfaces II Week 9, Mon Mar 15 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 ews yes, I'm granting the request
More informationUNIT -8 IMPLEMENTATION
UNIT -8 IMPLEMENTATION 1. Discuss the Bresenham s rasterization algorithm. How is it advantageous when compared to other existing methods? Describe. (Jun2012) 10M Ans: Consider drawing a line on a raster
More information3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination
Rendering Pipeline 3D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination 3D Polygon Rendering What steps are necessary to utilize spatial coherence while drawing
More informationFrom 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 informationCS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination
CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks) Figure 1: A perspective view of a polyhedron on an infinite plane. Cameras and Perspective Rendering
More information(Refer Slide Time: 00:02:02)
Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 20 Clipping: Lines and Polygons Hello and welcome everybody to the lecture
More informationCS 325 Computer Graphics
CS 325 Computer Graphics 02 / 29 / 2012 Instructor: Michael Eckmann Today s Topics Questions? Comments? Specifying arbitrary views Transforming into Canonical view volume View Volumes Assuming a rectangular
More informationCSE528 Computer Graphics: Theory, Algorithms, and Applications
CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin Stony Brook University (SUNY at Stony Brook) Stony Brook, New York 11794-2424 Tel: (631)632-845; Fax: (631)632-8334 qin@cs.stonybrook.edu
More informationFast Algorithms for Line Segment and Line Clipping in E 2
Fast Algorithms for Line Segment and Line Clipping in E 2 Duc Huy Bui, Václav Skala Department of Informatics and Computer Science 1 University of West Bohemia Univerzitní 22, Box 314 306 14 Plzen Czech
More informationCS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks)
CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks) Cameras and Perspective Figure 1: A perspective view of a polyhedron on an infinite plane. Rendering
More informationComputer Graphics: Two Dimensional Viewing
Computer Graphics: Two Dimensional Viewing Clipping and Normalized Window By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, 1 Outlines 1. End 2 Transformation between 2 coordinate systems To transform positioned
More informationOverview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal
Overview Pipeline implementation I Preliminaries Clipping Line clipping Hidden Surface removal Overview At end of the geometric pipeline, vertices have been assembled into primitives Must clip out primitives
More informationFROM 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 informationCS 591B Lecture 9: The OpenGL Rendering Pipeline
CS 591B Lecture 9: The OpenGL Rendering Pipeline 3D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination Spring 2007 Rui Wang 3D Polygon Rendering Many applications
More informationComputer Graphics Course Notes
Clipping Algorithms Real world objects can be represented relative to a reference world coordinate system. It is difficult to view all the objects on computer screen at the same time in one screen shot
More informationComputer Graphics Geometry and Transform
Computer Graphics 2012 5. Geometry and Transform Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2012-09-26 上机实践 地址 :ftp://give.zju.edu.cn 用户 :cgzhang 密码 :cgzhang 请大家把上机作业结果和报告内容, 上传至 学号 _ 姓名
More informationCSE328 Fundamentals of Computer Graphics
CSE328 Fundamentals of Computer Graphics Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 794--44 Tel: (63)632-845; Fax: (63)632-8334 qin@cs.sunysb.edu
More informationIllumination Models III: Ray Tracing (View Dependent Global Illumination)
Illumination Models III: Ray Tracing (View Dependent Global Illumination) The University of Texas at Austin 1 Basic Definitions Ray Tracing/Casting: Setting: eyepoint, virtual screen (an array of virtual
More informationComputer Graphics (CS 543) Lecture 10 (Part 1): 3D Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Graphics (CS 543) Lecture 10 (Part 1): 3D Clipping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Liang Barsky 3D Clipping Goal: Clip object edge-by-edge against
More information4.5 VISIBLE SURFACE DETECTION METHODES
4.5 VISIBLE SURFACE DETECTION METHODES A major consideration in the generation of realistic graphics displays is identifying those parts of a scene that are visible from a chosen viewing position. There
More informationTransformation Pipeline
Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate
More information3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy
3D Graphics Pipeline II Clipping Instructor Stephen J. Guy 3D Rendering Pipeline (for direct illumination) 3D Geometric Primitives 3D Model Primitives Modeling Transformation 3D World Coordinates Lighting
More informationThree-Dimensional Viewing Hearn & Baker Chapter 7
Three-Dimensional Viewing Hearn & Baker Chapter 7 Overview 3D viewing involves some tasks that are not present in 2D viewing: Projection, Visibility checks, Lighting effects, etc. Overview First, set up
More informationSung-Eui Yoon ( 윤성의 )
CS380: Computer Graphics Clipping and Culling Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg/ Class Objectives Understand clipping and culling Understand view-frustum, back-face
More informationTó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 informationThe Graphics Pipeline. Interactive Computer Graphics. The Graphics Pipeline. The Graphics Pipeline. The Graphics Pipeline: Clipping
Interactive Computer Graphics The Graphics Pipeline: The Graphics Pipeline Input: - geometric model - illumination model - camera model - viewport Some slides adopted from F. Durand and B. Cutler, MIT
More informationClipping Algorithms; 8-5. Computer Graphics. Spring CS4815
Computer Graphics Spring 2016-2017 Outline Clipping Algorithms; 8-5 1 Clipping Algorithms; 8-5 Announcements Mid-term: Week07?? Clipping: Introduction It is common for a region to be defined so that only
More informationCOMP3421. Vector geometry, Clipping
COMP3421 Vector geometry, Clipping Transformations Object in model co-ordinates Transform into world co-ordinates Represent points in object as 1D Matrices Multiply by matrices to transform them Coordinate
More informationRasteriza2on 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 informationMET71 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 informationGeneral Hidden Surface Removal Algorithms. Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science CS 460/560
Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced
More informationRendering. 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+ b. From this we can derive the following equations:
A. GEOMETRY REVIEW Pythagorean Theorem (A. p. 58) Hypotenuse c Leg a 9º Leg b The Pythagorean Theorem is a statement about right triangles. A right triangle is one that contains a right angle, that is,
More informationChapter. Graph Solve. 9-1 Before Using Graph Solve 9-2 Analyzing a Function Graph 9-3 Graph Solve Precautions
Chapter Graph Solve You can use any of the following methods to analyze function graphs and approximate results. Root extraction Determination of the maximum and minimum Determination of the y-intercept
More informationHidden-Surface Removal.
Hidden-Surface emoval. Here we need to discover whether an object is visible or another one obscures it. here are two fundamental approaches to remove the hidden surfaces: ) he object-space approach )
More informationALGORITHMS COMPLEXITY AND LINE CLIPPING PROBLEM SOLUTIONS
ALGORITHMS COMPLEXITY AND LINE CLIPPING PROBLEM SOLUTIONS Vaclav Skala 1 Department of Informatics and Computer Science University of West Bohemia, Univerzitní 22, Box 314 306 14 Plzen Czech Republic Skala@kiv.zcu.cz
More informationCS-184: Computer Graphics. Today
CS-184: Computer Graphics Lecture #2: Scan Conversion Prof. James O Brien University of California, Berkeley V2005-02-1.3 Today 2D Scan Conversion Drawing Lines Drawing Curves Filling Algorithms 2 Basically,
More informationEinfü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 informationWrite 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 informationComputer Science 474 Spring 2010 Viewing Transformation
Viewing Transformation Previous readings have described how to transform objects from one position and orientation to another. One application for such transformations is to create complex models from
More informationCS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK
CS2401 Computer Graphics CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK CS2401- COMPUTER GRAPHICS UNIT 1-2D PRIMITIVES 1. Define Computer Graphics. 2. Explain any 3 uses of computer graphics applications.
More informationEECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing
EECE 478 Rasterization & Scenes Rasterization Learning Objectives Be able to describe the complete graphics pipeline. Describe the process of rasterization for triangles and lines. Compositing Manipulate
More information2D TRANSFORMATIONS AND MATRICES
2D TRANSFORMATIONS AND MATRICES Representation of Points: 2 x 1 matrix: x y General Problem: B = T A T represents a generic operator to be applied to the points in A. T is the geometric transformation
More informationOutput 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 informationGraphics (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