# Line Segment Intersection. Balanced binary search tree Internal nodes: Rightmost leaf in its left subtree Status Structure T.

## Presentation on theme: "Line Segment Intersection. Balanced binary search tree Internal nodes: Rightmost leaf in its left subtree Status Structure T."— Presentation transcript:

Line Segment Intersection

Balanced binary search tree Internal nodes: Rightmost leaf in its left subtree Status Structure T

 p corresponds to lower endpt

L={S5,S4} C={S1,S3} U={S2} Updating T

a: U(a) = {s1}, L(a)=C(a)=   T=[s1] s’=s1,sl= , no-op s”=s1,sr= , no-op s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[b,c,d,e,f] Case 1-1

s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[c,d,e,f] b: U(b) = {s2}, L(b)=C(b)=   T=[s1,s2] s’=s2,sl=s1,FindNewEvent(s1,s2,b) s”=s2,sr= ,no-op Case 1-2

s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[d,e,f]  [x,d,e,f] c: U(c) = {s3}, L(c)=C(c)=   T=[s1,s3,s2] s’=s3,sl=s1,FindNewEvent (s1,s3,c) s”=s3,sr=s2,FindNewEvent(s2,s3,c)  x x Case 1-3

s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[d,e,f] x x: U(x) = L(x)=  C(x)={s2,s3}  report intersection {s2,s3} T:[s1,s3,s2]  [s1]  [s1,s2,s3] s’=s2,sl=s1,FindNewEvent (s1,s2,x) s”=s3,sr= ,no-op Case 1-4

s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[e,f] x d: U(d) = C(d) =  L(d) ={s1} T:[s1,s2,s3]  [s2,s3] sr=s2,sl= ,no-op Case 1-5

s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[f] x e: U(e) = C(e) =  L(e) ={s2} T:[s2,s3]  [s3] sr=s3,sl= ,no-op Case 1-6

s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[ ] x f: U(f) = C(f) =  L(f) ={s3} T:[s3]  [], the end… Case 1-7

a: U(a) = {s1}, L(a)=C(a)=   T=[s1] s’=s1,sl= , no-op s”=s1,sr= , no-op s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[b,c,d,e,f] Case 2-1

s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[c,d,e,f] Case 2-2 b: U(b) = {s2}, L(b)=C(b)=   T=[s1,s2] s’=s2,sl=s1,FindNewEvent(s1,s2,p) s”=s2,sr=  no-op

s1s1 s2s2 s3s3 a b c d e f Event Queue Q=[d,e,f] Case 2-3 c: U(c) = {s3}, L(c)=  C(c)=  s2   report intersection [s2,s3]  T=[s1,s3,s2] s’=s3,sl=s1,FindNewEvent (s1,s3,p)  x  d s”=s3,sr=s2,FindNewEvent(s2,s3,p)

s1s1 s2s2 s3s3 a b c,y d e f Event Queue Q=[e,f] Case 2-4 d: U(d) = , L(d)={s1} C(d)={s3}  report intersection: [s1,s3]  T=[s1,s3,s2]  [s2]  [s3,s2] s’=s3,sl= ,no-op s”=s3,sr=s2,FindNewEvent(s3,s2,d)  above sweep line

s1s1 s2s2 s3s3 a b c,y d e f Event Queue Q=[f] Case 2-5 e: U(e) = , L(e)={s2}, C(e)=   T=[s3,s2]  [s3] sl=s3,sr= ,no-op

s1s1 s2s2 s3s3 a b c,y d e f Event Queue Q=[ ] Case 2-6 f: U(f) = , L(f)={s3}, C(f)=   T=[s3]  [ ].. The end

Download ppt "Line Segment Intersection. Balanced binary search tree Internal nodes: Rightmost leaf in its left subtree Status Structure T."

Similar presentations