Download presentation

Presentation is loading. Please wait.

Published byRhett Eubank Modified over 2 years ago

1
Introduction Abstract C-S clip V-window1 V-window2 Summary Clipping is an basic operation of computer graphics Classical line clipping algorithms 1)Cohen-sutherland algorithm 2)Midpoint-subdivision algorithm 3)liang-Baskey algorithm Some rules of clipping algoritnm 1)avoid unnecessary intersection calculation 2)quicken the process of intersection calculaiton 3)deal the special intersection quickly and robustly K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2

2
Firstly reject lines as A by Encoding&code checking technique of Cohen-Sutherland algorithm. Secondly we construct a diamond enclosing box of original box of the original window (Fig1) called V window to reject another portion of visible lines such as line f. Lastly we construct a virtual enclosing box of the original window called K window to identify all the remaining lines (line e is rejected ). The new algorithm consists of three steps as follows Abstract of the new algorithm Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

3
Cohen-sutherland’s clipping The traditional Encoding &code technique The two-dimensional plane is divided into nine non-overlapping reginons as Shown in fig2 A four-digit-code is used to indicate the two endpoints of the line are located If code(p1)|code(p2 )=0 /*line is totally visible*/ else if code(p1)&code(p2)!=0/*line is partially visible*/ else /*line is totally unvisible */ Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

4
Redundant line clipping with v-window1 New encoding&code by v-window Traditional technique can’t Reject lines as line f; A diamond enclosing box of the original window is constructed as shown in fig 3 Such window we call it v-window cuts the plane into nine regions Each of the regions is also indicated by a four-digit-code as shown in fig 3 Since the v-window is aligned 45°to the X- axis the encoding procedure is simple Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

5
Redundant line clipping with v-window2 The encoding procedure Let the boundary of the original clipping window be left-(XL),right-(XR),top-(YT),bottom-(YB). The encoding procedure can be described as follows #define LEFT 1 If(x+y-YB

6
Remaining line clipping with K-window Rejecting of remaining redundant lines Lines such as line e is still can’t be rejected after the previous steps; The virtual window(k-window) is consturcted which aligns with direction of the line to be clipped,as shown in fig4 Now the line e is easily rejected by this means. If(b b2) return FALSE; b=Ya-kXa; /*redundant lines such as line e */ b1=YB-kXR; Else {… …} b2=YT-kXL; Here b,b1,b2 are calculated as following : k=(Ya-Yb)/(Xa-Xb); now all the redundant lines have been rejected! Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

7
Suppose k isthe slop of the line and K_WINDOW is the slop of the original diagonal. If(k<=K_WINDOW) The broken lines In Fig5 constitute the reduced K-Window. Else The Broken lines in Fig6 constitute the reduced K-Window. By comparing the y_intercept of the line that of V1 an V2,two edges of the reduced V-window shown in Fig5 or Fig 6. Fast intersection calculation1 Two cases of lines that intersect with the Clipping window Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

8
The Exact edges of the original window that intersect Fast intersection calculation 2 with the line can be determined as follows If (b<=b4) line can only intersect with right edge and the bottom edge(line E2 in Fig5 and Fig6 ) Else if (b>=b3) line can only be intersect with left edge and top edge (line E1 in Fig5 And Fig 6) Else {if (k<=K_WINDOW) line can only Intersect with left edge and right edge (line E3 in Fig 5) Else {… …}line can only intersect with top Edge and bottom edge(line E3 in Fig 6) } Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

9
Here b3 and b4 are y-intercepts of V1 and V2 They are determined as folllows : If(k>=K_WINDOW ) Else { {b3=b1+YT-YB; b4=b1+YT-YB; b4=b2+YT-YB;} b3=b2-YT-YB;} The results of the six cases of intersection Calculation are listed bellow: Line E1 of Fig5 and Fig6: (XL,YT-b2+b),(XL+(b2-b)/k,YT) Line E2 of Fig5 and Fig6: (XR,YB+b-b1),(XR-(b-b1)/k,YB) Line E3 of Fig5: (XL,YB+b-b3),(XR,YT-b4+b) Line E3of Fig6: (XL+(b4-b)/k,YB),(XR-(b-b3)/k,YT) Fast intersection calculation 3 Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

10
Implementation of the new clipping algorithm : – We implemented the new algorithm on PC and compared its performance than of Cohen-Sutherland algorithm C-S for short. – Our machine is based on Pentium Ⅱ 350MHZ,and the compile is Turbo C 2.0 running on Windows 2000 – Six thousand lines that satisfy the case are clipped by C-S and our algorithm in seconds.(table1) Line types are specified as follows Note that lines perpendicular to X-axis belong to a special subset,which need separate treating. Fast intersection calculation4 Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

11
Line types1 A1: can only rejected by C-S algorithm after one time of intersection calculation and it can be rejected by V-WINDOW A2: can only rejected by C-S algorithm after two time of intersection calculation and it can be rejected by V-WINDOW B1: can only rejected by C-S algorithm after one time of intersection calculation and it can be rejected by k-WINDOW B2: can only rejected by C-S algorithm after two time of intersection calculation and it can be rejected by k-WINDOW C1: can only rejected by C-S algorithm after two time of intersection calculation and it can be rejected by reduced k-WINDOW C2: can only rejected by C-S algorithm after three time of intersection calculation and it can be rejected by reduced k-WINDOW C3: can only rejected by C-S algorithm after four time of intersection calculation and it can be rejected by reduced k-WINDOW Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

12
Line types2 D: combined lines that are made up of such lines 1) One thousand lines which can be accepted by tranditional Encoding&Code checking technique. 2) one thousand lines which can be rejected by tranditional Encoding&Code checking technique. 3) One thousand lines which can be rejected by V-window. 4) One thousand lines which can be rejected by K-window. 5) One thousand lines with one endpoint inside the clipping window and the other outside it. 6) One thousand partially visible lines which can be clipped with reduced k-Window. Statistics in Table1 Suggests the potential of our new algorithm! Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

13
Discussion of our new algorithm1 How much is the chance for lines to be rejected by the V-window? Traditional Encodint&code technique Can reject or accept such lines that totally in the regions of, ABGL,BCIF, CDKH,and DAEJ,MNOP.So the ratio of lines which can be rejected is: Similarly,V-window rejects lines of four portions trivially,lines whose two endpoints locate,respectively,in the regions of XLM and ESM,in the regions of QKP and JVP,in the regions of WIO and THO,and in the regions of RFN and UGN.examples of such lines are a-d in Fig8.the ratio of lines within each portion to all lines is : Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

14
Discussion of our new algorithm2 The ratio of lines rejected by V-Window to lines remaining after the first clipping step can be deduced as follows : Table 2 list the value of M1 and M2 when t is specified to different values.If t>100,there are nearly a half of lines that can be trivially rejected by V-Window.The greater t is.the larger the ratio M2 will be.Apparently,V-Window does contribute to the high efficiency of line clipping. Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

15
Summary Line clipping is a fundamental operation of computer graphics. In this new algorithm,we pays more attention to the efficiency of rejection. With adaptively constructed V-Window and K- Window,our algorithm can quickly reject all invisible lines,which may otherwise incur unnecessary intersection calculation in traditional clipping algorithms Moreover,the exact edges of the original clipping windows,which intersect with a partially visible line can be easily identified by our algorithm. Introduction Abstract V-window1 V-window2 Summary K-window Intersection1 Intersection2 Intersection3 Line types 1 Intersection4 Line types 2 Discussion 1 Discussion 2 C-S clip

Similar presentations

OK

Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.

Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on first conditional esl Ppt on prepaid energy meter Ppt on purchase order Ppt on wind power plant Ppt on porter's five forces analysis template Ppt on renewable energy source biomass Download ppt on teamviewer Ppt on smart card based electronic passport system Ppt on area of parallelogram with vertices Ppt on indian politics funny