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

extraction of data primitives inside a region of interest
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 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

(xL, yB) (xR, yT)

P Q

xL <= x <= xR yB <= y <= yT Q is inside P is outside

slide-2
SLIDE 2

Line Clipping: Remove portion of line segment

  • utside window
  • Can we use point clipping for the end points?

Point clipping works

1 2

slide-3
SLIDE 3

Line Clipping: Remove portion of line segment

  • utside window
  • How about these lines?

Point clipping does not work

3 4 5

slide-4
SLIDE 4

Cohen and Sutherland

slide-5
SLIDE 5

Cohen and Sutherland

1xxx xxx1 x1xx xx1x 0000

4 bit code to indicate the zone of end points of line with respect to window

slide-6
SLIDE 6

Cohen and Sutherland

0000

4 bit code to indicate the zone of end points of line with respect to window

1000 0001 0100 0010 1001 1010 0101 0110

slide-7
SLIDE 7

Cohen and Sutherland

Trivially accept case

  • line is totally visible
  • if both ends of the line have outcode as 0000

Trivially accept

slide-8
SLIDE 8

Cohen and Sutherland

Trivially reject case

  • line is totally invisible
  • logical AND of the two end points outcodes

Trivially reject

slide-9
SLIDE 9

Cohen and Sutherland

If not trivially reject and accept case

  • line is potentially visible

Potentially visible

slide-10
SLIDE 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 A B A B

Result

slide-11
SLIDE 11

Cohen and Sutherland

  • simple, still popular
  • limited to rectangular region
  • extension to 3D clipping using 3D orthographic

view volume is straightforward

slide-12
SLIDE 12
slide-13
SLIDE 13

Cyrus Beck Line Clipping

(Liang and Barsky)

  • any convex region

Parametric line (input line AB):

) 1 , ( ; ) ( ) ( ∈ − + = t t A B A t L

A B

slide-14
SLIDE 14

Cyrus Beck Line Clipping

(Liang and Barsky) P n

  • Q

Implicit line (window edge): Tells us on which side of the line the point Q is.

n P Q Q l ). ( ) ( − =

slide-15
SLIDE 15

Cyrus Beck Line Clipping

(Liang and Barsky) P n

  • Q

n P Q Q l ). ( ) ( − =

Evaluate If > 0 inside halfspace of line (plane) If < 0 outside halfspace of line (plane) If = 0 on the line Should give indications for trivial accept and reject cases.

Inside Outside

slide-16
SLIDE 16

Cyrus Beck Line Clipping

(Liang and Barsky) P n

  • Q

n P Q Q l ). ( ) ( − =

Inside Outside

) ( ) ( A B t A t L − + =

Window edge Line segment

) ( AND ) ( < < B l A l ) ( AND ) ( > > B l A l

Trivial Reject Trivial Accept

slide-17
SLIDE 17

Cyrus Beck Line Clipping

(Liang and Barsky) P n

slide-18
SLIDE 18

Cyrus Beck Line Clipping

(Liang and Barsky) P n A B

t A B A t L ) ( ) ( − + = t for solve ; )) ( ( = t L l n P Q Q l ). ( ) ( − =

). ( ). ( ). ) ( ( ). ) ( ( = − + − = − − + = − n A B t n P A n P A B t A n P t L

slide-19
SLIDE 19

Cyrus Beck Line Clipping

(Liang and Barsky) P n A B

n P B n P A n P A t n A B n P A t ). ( ). ( ). ( ). ( ). ( − − − − = − − =

slide-20
SLIDE 20

B

n

Which ‘t’ to select ? (t=0) (t=1)

Cyrus Beck Line Clipping

(Liang and Barsky) A

slide-21
SLIDE 21

A B

n

(t=0) (t=1)

Cyrus Beck Line Clipping

(Liang and Barsky)

n A B D n A B n P A t ). ( ). ( ). ( − = − − =

D > 0 label t as tE Entering

slide-22
SLIDE 22

A B

n

(t=0) (t=1)

Cyrus Beck Line Clipping

(Liang and Barsky)

n A B D n A B n P A t ). ( ). ( ). ( − = − − =

D < 0 label t as tL Leaving

slide-23
SLIDE 23

A B

n

(t=0) (t=1)

Cyrus Beck Line Clipping

(Liang and Barsky) t of interest: largest tE smallest tL

max E

t

min L

t

slide-24
SLIDE 24

If

Cyrus Beck Line Clipping

(Liang and Barsky)

min max L E

t t >

Reject

slide-25
SLIDE 25

Arbitrary Convex Window

P1

V1

Cyrus Beck Line Clipping

(Liang and Barsky)

V2 V3 V4 V5 V6 V7 V8

P2 E1 E2 E3 E4 E5 E6 E7 E8

slide-26
SLIDE 26

Arbitrary Convex Window

P1

V1

Cyrus Beck Line Clipping

(Liang and Barsky)

V2 V3 V4 V5 V6 V7 V8

P2 E1 E2 E3 E4 E5 E6 E7 E8

Polygon is convex if for all adjacent edges the sign of cross product is same.

positive xE E positive xE E : :

3 2 2 1

. . .

slide-27
SLIDE 27

Arbitrary Window

Cyrus Beck Line Clipping

(Liang and Barsky) Polygon is non-convex

negative xE E positive xE E positive xE E : : :

4 3 3 2 2 1

. . .

V1 V2 V3 V4 V5 V6 E1 E2 E3 E4

slide-28
SLIDE 28

Arbitrary Window

Cyrus Beck Line Clipping

(Liang and Barsky)

V1 V2 V3 V4 V5 V6 E1 E2 E3 E4

Make the polygon convex by adding the edge V3V5 Clip against the convex polygon => P3P4

P1 P2 P3 P4

slide-29
SLIDE 29

Arbitrary Window

Cyrus Beck Line Clipping

(Liang and Barsky)

V3 V4 V5

Clip against the triangle => P5P4 Subtract P5P4 from P3P4 => P3P5

P3 P4 P5