|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| |
We
use an event-driven
|
|
|
|
simulation
to move the
|
|
|
|
sweepline
|
|
|
| |
Events
are
|
|
|
|
|
Segment
start
|
|
|
|
|
When
we first encounter a
|
|
|
|
segment
|
|
|
|
|
Segment
end
|
|
|
|
|
When
we reach the
|
|
|
|
segments
other endpoint
|
|
|
|
|
Intersect
segments
|
|
|
|
|
When
we reach a segment
|
|
|
intersection
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| |
Some
of the events, we
|
|
|
|
know
ahead of time
|
|
|
|
|
Segment
start
|
|
|
|
|
Segment
end
|
|
|
| |
If
we knew all events ahead
|
|
|
of
time we could sort them
|
|
|
|
and
do without a Priority
|
|
|
|
Queue,
but we dont...
|
|
|
| |
For segment intersection, we
|
|
|
have
to determine these
|
|
|
events
as we move the
|
|
|
|
sweepline,
so we need a PQ
|
|
|
|