1
#ifndef SEEN_LIVAROT_SWEEP_EVENT_QUEUE_H
2
#define SEEN_LIVAROT_SWEEP_EVENT_QUEUE_H
4
* A container of intersection events.
7
#include <libnr/nr-forward.h>
13
* The structure to hold the intersections events encountered during the sweep. It's an array of
14
* SweepEvent (not allocated with "new SweepEvent[n]" but with a malloc). There's a list of
15
* indices because it's a binary heap: inds[i] tell that events[inds[i]] has position i in the
16
* heap. Each SweepEvent has a field to store its index in the heap, too.
21
SweepEventQueue(int s);
24
int size() const { return nbEvt; }
26
/// Look for the topmost intersection in the heap
27
bool peek(SweepTree * &iLeft, SweepTree * &iRight, NR::Point &oPt, double &itl, double &itr);
28
/// Extract the topmost intersection from the heap
29
bool extract(SweepTree * &iLeft, SweepTree * &iRight, NR::Point &oPt, double &itl, double &itr);
30
/// Add one intersection in the binary heap
31
SweepEvent *add(SweepTree *iLeft, SweepTree *iRight, NR::Point &iPt, double itl, double itr);
33
void remove(SweepEvent *e);
34
void relocate(SweepEvent *e, int to);
37
int nbEvt; ///< Number of events currently in the heap.
38
int maxEvt; ///< Allocated size of the heap.
39
int *inds; ///< Indices.
40
SweepEvent *events; ///< Sweep events.
43
#endif /* !SEEN_LIVAROT_SWEEP_EVENT_QUEUE_H */
48
c-file-style:"stroustrup"
49
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
54
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :