extraction of data primitives inside a region of interest
play

Extraction of data/primitives inside a region of interest window - PowerPoint PPT Presentation

Extraction of data/primitives inside a region of interest window => Discard (parts of ) primitives outside window. Point Clipping: Remove points outside window. A point is either entirely inside the window or not (x R , y T ) Q x L


  1. Extraction of data/primitives inside a region of interest “ window ” => Discard (parts of ) primitives outside window. Point Clipping: Remove points outside window. • A point is either entirely inside the window or not (x R , y T ) Q x L <= x <= x R P y B <= y <= y T Q is inside P is outside (x L , y B )

  2. Line Clipping: Remove portion of line segment outside window • Can we use point clipping for the end points? 1 2 Point clipping works

  3. Line Clipping: Remove portion of line segment outside window • How about these lines? 3 5 4 Point clipping does not work

  4. Cohen and Sutherland

  5. Cohen and Sutherland 4 bit code to indicate the zone of end points of line with respect to window 1xxx xx1x xxx1 0000 x1xx

  6. Cohen and Sutherland 4 bit code to indicate the zone of end points of line with respect to window 1001 1000 1010 0001 0000 0010 0101 0110 0100

  7. Cohen and Sutherland Trivially accept case • line is totally visible • if both ends of the line have outcode as 0000 Trivially accept

  8. Cohen and Sutherland Trivially reject case • line is totally invisible • logical AND of the two end points outcodes Trivially reject

  9. Cohen and Sutherland If not trivially reject and accept case • line is potentially visible Potentially visible

  10. Cohen and Sutherland If potentially visible • subdivide into segments and apply trivial acceptance and rejection test • segments by intersection with window edges • edges in any order but consistent (e.g., top-bottom, right-left) D B B A A Result

  11. Cohen and Sutherland • simple, still popular • limited to rectangular region • extension to 3D clipping using 3D orthographic view volume is straightforward

  12. Cyrus Beck Line Clipping (Liang and Barsky) • any convex region B Parametric line (input line AB): L ( t ) A ( B A ) t ; t ( 0 , 1 ) = + − ∈ A

  13. Cyrus Beck Line Clipping (Liang and Barsky) P Implicit line (window edge): n l ( Q ) ( Q P ). n = − • Q Tells us on which side of the line the point Q is.

  14. Cyrus Beck Line Clipping (Liang and Barsky) Evaluate l ( Q ) ( Q P ). n = − If > 0 inside halfspace of line (plane) P If < 0 outside halfspace of line (plane) n If = 0 on the line Outside • Q Should give indications for trivial accept and reject cases. Inside

  15. Cyrus Beck Line Clipping (Liang and Barsky) l ( Q ) ( Q P ). n Window edge = − Line segment L ( t ) A t ( B A ) = + − P n Trivial Reject l ( A ) 0 AND l ( B ) 0 Outside < < • Q Trivial Accept l ( A ) 0 AND l ( B ) 0 > > Inside

  16. Cyrus Beck Line Clipping (Liang and Barsky) P n

  17. Cyrus Beck Line Clipping (Liang and Barsky) L ( t ) A ( B A ) t = + − l ( Q ) ( Q P ). n = − B A l ( L ( t )) 0 ; solve for t = P ( L ( t ) P ). n 0 n − = ( A t ( B A ) P ). n 0 + − − = ( A P ). n t ( B A ). n 0 − + − =

  18. Cyrus Beck Line Clipping (Liang and Barsky) ( A P ). n − t = B A ( B A ). n − ( A P ). n − t = P n ( A P ). n ( B P ). n − − −

  19. Cyrus Beck Line Clipping (Liang and Barsky) B (t=1) n Which ‘ t ’ to select ? A (t=0)

  20. Cyrus Beck Line Clipping (Liang and Barsky) B (t=1) ( A P ). n − t = ( B A ). n − n D ( B A ). n = − D > 0 label t as t E Entering (t=0) A

  21. Cyrus Beck Line Clipping (Liang and Barsky) B (t=1) ( A P ). n − t = ( B A ). n − D ( B A ). n = − n D < 0 label t as t L Leaving (t=0) A

  22. Cyrus Beck Line Clipping (Liang and Barsky) B (t=1) t of interest: max t largest t E E min smallest t L t n L (t=0) A

  23. Cyrus Beck Line Clipping (Liang and Barsky) max min t t If > E L Reject

  24. Cyrus Beck Line Clipping (Liang and Barsky) Arbitrary Convex Window V 6 V 5 P 2 E 5 E 6 V 7 V 4 E 4 E 3 E 7 V 3 P 1 V 8 E 8 E 2 E 1 V 1 V 2

  25. Cyrus Beck Line Clipping (Liang and Barsky) Arbitrary Convex Window E xE : positive 1 2 V 6 V 5 P 2 E xE : positive E 5 2 3 E 6 . V 7 V 4 E 4 . E 3 . E 7 V 3 P 1 V 8 E 8 E 2 E 1 Polygon is convex if for all V 1 V 2 adjacent edges the sign of cross product is same.

  26. Cyrus Beck Line Clipping (Liang and Barsky) Arbitrary Window E xE : positive 1 2 E xE : positive V 5 V 6 2 3 E 4 E xE : negative V 4 3 4 . V 3 . E 3 . E 2 E 1 V 1 V 2 Polygon is non-convex

  27. Cyrus Beck Line Clipping (Liang and Barsky) Arbitrary Window Make the polygon convex by adding the edge V 3 V 5 V 5 V 6 P 2 P 4 E 4 V 4 Clip against the convex polygon V 3 => P 3 P 4 E 3 P 3 E 2 E 1 P 1 V 1 V 2

  28. Cyrus Beck Line Clipping (Liang and Barsky) Arbitrary Window Clip against the triangle V 5 => P 5 P 4 P 4 V 4 Subtract P 5 P 4 from P 3 P 4 V 3 P 5 => P 3 P 5 P 3

Recommend


More recommend