Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 3 1.

Similar presentations


Presentation on theme: "Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 3 1."— Presentation transcript:

1 Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 3 1

2 2 Nicholl-Lee-Nicholl Line Clipping (NLN)  Creating more regions around the clip window to avoid multiple clipping of an individual line segment.  Different to Cohen where Cohen require multiple calculation along the path of a single line before an intersection on the clipping rectangle is locate or completely rejected.  NLN eliminate extra calculations through new region created.

3 3 Nicholl-Lee-Nicholl Line Clipping (NLN) Compared to Cohen and Liang; NLN perform fever comparisons and division. The trade-off is that NLN can only be applied two two-dimensional clipping only.

4 4 Nicholl-Lee-Nicholl Line Clipping (NLN) How its work? First, need to determine the endpoints P 1 and P 2 from the possible nine regions. Out of nine, NLN only interested on three regions. If P 1 lies in any one of other six regions, symmetry transformation will be applied first. Then, is to determine where P 2 is. If P 1 is inside and P 2 is outside we will follow the first case where intersection with appropriate window boundary is carried out. Four regions of L,T,R,B which contains P 2 are introduced. If P 1 and P 2 are inside the clipping rectangle, we save the entire line.

5 5 L NLN (2,2)(6,2) (6,6) (2,6) P1 (1,4) LT LR LB P2 (6,7)

6 6 NLN For example when P 2 is in region LT if Slope P 1 P TR < Slope P 1 P 2 < Slope P 1 P TL Or (Y T - Y 1 )/(X R – X 1) ) < (Y 2 - Y 1 )/(X 2 – X 1 ) < (Y T – Y 1 )/(X L – X 1 ) Ex: (6-4)/(6-1) < (7-4)/(6-1) < (6-4)/(2-1) 2/5 < 3/5 < 2 And we clip the entire line if (Y T – Y 1 )(X 2 – X 1 ) < (X L – X 1 )(Y 2 – Y 1 )

7 7 NLN From the parametric equations: x = x 1 + (x 2 – x 1 )u y = y 1 + (y 2 – y1)u An intersection position on the left boundary is x = x L with u = (x L – x 1 )/(x 2 – x 1 ) will give coordinate y = y 1 +((y 2 – y 1 )/(x 2 – x 1 )) * (x L – x 1 ) An intersection position on the top boundary has y = y T with u = (y T – y 1 )/(y 2 – y 1) will give coordinate x = x 1 +((x 2 – x 1 )/(y 2 – y 1 )) * (y T – y 1 )

8 8 Line Clipping Using Nonrectangular Clip Windows Some applications clip lines against arbitrarily shaped polygons. Liang and Cyrus-Beck algorithm can be extended to convex polygon windows. For concave polygon-clipping regions, we need to split the concave polygon into set of convex polygons. Circles or other curved-boundary clipping regions are also possible but slower because intersection calculations involve nonlinear curve equation. Line can be identified as completely inside if the distance for both endpoints of a line is less than or equal to the radius squared. If not, then intersection calculation is performed.


Download ppt "Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 3 1."

Similar presentations


Ads by Google