1 / 16

# CP = E[ s 2 , s 5 , s 1 , s 3 , s 2 ’ , s 3 ’ , s 4 , s 1 ’ , s 4 ’ , s 5 ’ ] S[] I[]

s 2. s 5. s 1. s 3. s 2 ’. s 3 ’. s 4. s 1 ’. s 4 ’. s 5 ’. Plane Sweep Algorithm for Line-Segment Intersection Problem. CP = E[ s 2 , s 5 , s 1 , s 3 , s 2 ’ , s 3 ’ , s 4 , s 1 ’ , s 4 ’ , s 5 ’ ] S[] I[]. CP=Current Point E=Event Queue S=Status Queue I=Intersection List.

## CP = E[ s 2 , s 5 , s 1 , s 3 , s 2 ’ , s 3 ’ , s 4 , s 1 ’ , s 4 ’ , s 5 ’ ] S[] I[]

E N D

### Presentation Transcript

1. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Plane Sweep Algorithm for Line-Segment Intersection Problem CP = E[ s2 , s5 , s1 , s3 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[] I[] CP=Current Point E=Event Queue S=Status Queue I=Intersection List

2. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = E[ s2 , s5 , s1 , s3 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ ] I[ ] New CP = s2 E[ s2 , s5 , s1 , s3 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 ] I[ ]

3. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ previous sweep line Previous CP = s2 E[ s5 , s1 , s3 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 ] I[ ] new sweep line New CP = s5 E[ s5 , s1 , s3 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 , s5 ] I[ ] Compare s2 with s5 => no intersection

4. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s5 E[ s1 , s3 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 , s5 ] I[ ] s21 New CP = s1 E[ s1 , s3 , s21, s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 , s1, s5 ] I[s21 ] Compare s`1 with s2 => s21 Compare s`1 with s5 => no intersection

5. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s1 E[ s3 , s21 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 , s1 , s5 ] I[s21 ] s21 s53 New CP = s3 E[ s3 , s53 , s21 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 , s1 , s5 , s3 ] I[s21 , s53 ] Compare s`3 with s5 => s53

6. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s3 E[ s53 , s21 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 , s1 , s5 , s3 ] I[s21 , s53 ] s21 s53 New CP = s53 E[ s53 , s21 , s13 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 , s1 , s3 , s5] I[s21 , s53 , s13 ] s13 Compare s`3 with s1 => s13

7. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s53 E[ s21 , s13 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s2 , s1 , s3 , s5 ] I[s21 , s53 , s13 ] s21 s53 New CP = s21 E[ s21 , s23 , s13 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s1 , s2, s3 , s5 ] I[s21 , s53 , s13 , s23 ] s23 s13 Compare s`2 with s3 => s23

8. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s21 E[ s23 , s13 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s1 , s2 , s3 , s5 ] I[s21 , s53 , s13 , s23 ] s21 s53 New CP = s23 E[ s23 , s13 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s1 , s3 , s2, s5 ] I[s21 , s53 , s13 , s23 ] s23 s13 Compare s`3 with s1 => s13 (already in the list) Compare s`2 with s5 => no intersection

9. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s23 E[ s13 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s1 , s3 , s2 , s5 ] I[s21 , s53 , s13 , s23 ] s21 s53 New CP = s13 E[ s13 , s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s3 , s1, s2 , s5 ] I[s21 , s53 , s13 , s23 ] s23 s13 Compare s`1 with s2 => s21 (already in the list)

10. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s13 E[ s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s3 , s1 , s2 , s5 ] I[s21 , s53 , s13 , s23 ] s21 s53 New CP = s2’ E[ s2’ , s3’ , s4 , s1’ , s4’ , s5’ ] S[ s3 , s1 , s2 , s5 ] I[s21 , s53 , s13 , s23 ] s23 s13 Compare s`1 with s5 => no intersection

11. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s2’ E[ s3’ , s4 , s1’ , s4’ , s5’ ] S[ s3 , s1 , s5 ] I[s21 , s53 , s13 , s23 ] s21 s53 New CP = s3’ E[ s3’ , s4 , s1’ , s4’ , s5’ ] S[ s3 , s1 , s5 ] I[s21 , s53 , s13 , s23 ] s23 s13

12. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s3’ E[ s4 , s1’ , s4’ , s5’ ] S[ s1 , s5 ] I[s21 , s53 , s13 , s23 ] s21 s53 New CP = s4 E[ s4 , s54 , s1’ , s4’ , s5’ ] S[ s1 , s5 , s4 ] I[s21 , s53 , s13 , s23 , s54 ] s23 s13 s54 Compare s`4 with s5 => s54

13. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s4 E[ s54 , s1’ , s4’ , s5’ ] S[ s1 , s5 , s4 ] I[s21 , s53 , s13 , s23 , s54 ] s21 s53 New CP = s54 E[ s54 , s1’ , s4’ , s5’ ] S[ s1 , s4 , s5] I[s21 , s53 , s13 , s23 , s54 ] s23 s13 s54 Compare s`4 with s1 => no intersection

14. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s54 E[ s1’ , s4’ , s5’ ] S[ s1 , s4 , s5 ] I[s21 , s53 , s13 , s23 , s54 ] s21 s53 New CP = s1’ E[ s1’ , s4’ , s5’ ] S[ s1 , s4 , s5 ] I[s21 , s53 , s13 , s23 , s54 ] s23 s13 s54

15. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s1’ E[ s4’ , s5’ ] S[ s4 , s5 ] I[s21 , s53 , s13 , s23 , s54 ] s21 s53 New CP = s4’ E[ s4’ , s5’ ] S[ s4 , s5 ] I[s21 , s53 , s13 , s23 , s54 ] s23 s13 s54

16. s2 s5 s1 s3 s2’ s3’ s4 s1’ s4’ s5’ Previous CP = s4’ E[ s5’ ] S[ s5 ] I[s21 , s53 , s13 , s23 , s54 ] s21 s53 New CP = s5’ E[ s5’ ] S[ s5 ] I[s21 , s53 , s13 , s23 , s54 ] s23 s13 s54 Event Queue Is Empty, therefore STOP

More Related