1 / 8

Introduction to Computer Graphics

Introduction to Computer Graphics. Chapter 6 – 2D Viewing Pt 3. Nicholl-Lee-Nicholl Line Clipping (NLN). Creating more regions around the clip window to avoid multiple clipping of an individual line segment.

oprah-cook
Télécharger la présentation

Introduction to Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  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. 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. Nicholl-Lee-Nicholl Line Clipping (NLN) • How its work? • First , need to determine the endpoints P1 and P2 from the possible nine regions. • Out of nine, NLN only interested on three regions. • If P1 lies in any one of other six regions, symmetry transformation will be applied first. • Then, is to determine where P2 is. • If P1 is inside and P2 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 P2 are introduced. • If P1 and P2 are inside the clipping rectangle, we save the entire line.

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

  6. NLN • For example when P2 is in region LT if Slope P1PTR < Slope P1P2 < Slope P1PTL • Or (YT - Y1)/(XR – X1)) < (Y2 - Y1)/(X2 – X1) < (YT – Y1)/(XL – X1) • 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  (YT – Y1)(X2 – X1)< (XL – X1)(Y2 – Y1)

  7. NLN • From the parametric equations: x = x1 + (x2 – x1)u y = y1 + (y2 – y1)u • An intersection position on the left boundary is x = xLwith u = (xL – x1)/(x2 – x1)will give coordinate y = y1 +((y2 – y1)/(x2 – x1)) * (xL – x1) • An intersection position on the top boundary has y = yT with u = (yT – y1)/(y2 – y1) will give coordinate x = x1 +((x2 – x1)/(y2 – y1)) * (yT – y1)

  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.

More Related