Inkscape
Vector Graphics Editor
|
The structure to hold the intersections events encountered during the sweep. More...
#include <sweep-event-queue.h>
Public Member Functions | |
SweepEventQueue (int s) | |
virtual | ~SweepEventQueue () |
int | size () const |
Number of events currently stored. | |
bool | peek (SweepTree *&iLeft, SweepTree *&iRight, Geom::Point &oPt, double &itl, double &itr) |
Look for the top most intersection in the heap. | |
bool | extract (SweepTree *&iLeft, SweepTree *&iRight, Geom::Point &oPt, double &itl, double &itr) |
Extract the top most intersection from the heap. | |
SweepEvent * | add (SweepTree *iLeft, SweepTree *iRight, Geom::Point &iPt, double itl, double itr) |
Add an intersection in the binary heap. | |
void | remove (SweepEvent *e) |
Remove event from the event queue. | |
void | relocate (SweepEvent *e, int to) |
Relocate the event e to the location to. | |
Private Attributes | |
int | nbEvt |
int | maxEvt |
int * | inds |
SweepEvent * | events |
The structure to hold the intersections events encountered during the sweep.
It's an array of SweepEvent (not allocated with "new SweepEvent[n]" but with a malloc). There's a list of indices because it's a binary heap: inds[i] tell that events[inds[i]] has position i in the heap. Each SweepEvent has a field to store its index in the heap, too.
Definition at line 24 of file sweep-event-queue.h.
SweepEventQueue::SweepEventQueue | ( | int | s | ) |
Definition at line 16 of file sweep-event.cpp.
|
virtual |
Definition at line 25 of file sweep-event.cpp.
SweepEvent * SweepEventQueue::add | ( | SweepTree * | iLeft, |
SweepTree * | iRight, | ||
Geom::Point & | iPt, | ||
double | itl, | ||
double | itr | ||
) |
Add an intersection in the binary heap.
iLeft | Pointer to left node of intersection. |
iRight | Pointer to right node of intersection. |
iPt | Point of intersection. |
itl | Time of intersection on the left edge. |
itr | Time of intersection on the right edge. |
Definition at line 31 of file sweep-event.cpp.
References Shape::dg_arete::en, events, Shape::getEdge(), SweepEvent::ind, inds, SweepEvent::MakeNew(), maxEvt, nbEvt, Shape::pData, and Shape::dg_arete::st.
Referenced by Shape::TesteIntersection().
bool SweepEventQueue::extract | ( | SweepTree *& | iLeft, |
SweepTree *& | iRight, | ||
Geom::Point & | oPt, | ||
double & | itl, | ||
double & | itr | ||
) |
Extract the top most intersection from the heap.
iLeft | Reference that function will set to the left node of top most intersection. |
iRight | Reference that function will set to the right node of top most intersection. |
oPt | Reference that function will set to the point of top most intersection. |
itl | Reference that function will set to time of top most intersection on the left edge. |
itr | Reference that function will set to time of top most intersection on the right edge. |
Definition at line 91 of file sweep-event.cpp.
References events, inds, LEFT, nbEvt, SweepEvent::posx, remove(), RIGHT, SweepEvent::sweep, SweepEvent::tl, and SweepEvent::tr.
Referenced by Shape::Booleen(), and Shape::ConvertToShape().
bool SweepEventQueue::peek | ( | SweepTree *& | iLeft, |
SweepTree *& | iRight, | ||
Geom::Point & | oPt, | ||
double & | itl, | ||
double & | itr | ||
) |
Look for the top most intersection in the heap.
iLeft | Reference that function will set to the left node of top most intersection. |
iRight | Reference that function will set to the right node of top most intersection. |
oPt | Reference that function will set to the intersection point of top most intersection. |
itl | Reference that function will set to time of top most intersection on the left edge. |
itr | Reference that function will set to time of top most intersection on the right edge. |
Definition at line 74 of file sweep-event.cpp.
References events, inds, LEFT, nbEvt, SweepEvent::posx, RIGHT, SweepEvent::sweep, SweepEvent::tl, and SweepEvent::tr.
Referenced by Shape::Booleen(), and Shape::ConvertToShape().
void SweepEventQueue::relocate | ( | SweepEvent * | e, |
int | to | ||
) |
Relocate the event e
to the location to.
This will place all data of e
in to
and also update any evt pointers held by the intersection nodes.
e | The SweepEvent to relocate. |
to | The index of the location where we want to relocate e to. |
Definition at line 216 of file sweep-event.cpp.
References events, SweepTree::evt, SweepEvent::ind, inds, LEFT, RIGHT, and SweepEvent::sweep.
Referenced by remove().
void SweepEventQueue::remove | ( | SweepEvent * | e | ) |
Remove event from the event queue.
Make sure to clear the evt pointers from the nodes involved.
e | The event to remove. |
Definition at line 110 of file sweep-event.cpp.
References events, SweepEvent::ind, inds, SweepEvent::MakeDelete(), nbEvt, SweepEvent::posx, and relocate().
Referenced by extract(), and SweepTree::RemoveEvent().
|
inline |
Number of events currently stored.
Definition at line 35 of file sweep-event-queue.h.
References nbEvt.
Referenced by Shape::Booleen(), and Shape::ConvertToShape().
|
private |
Sweep events.
Definition at line 94 of file sweep-event-queue.h.
Referenced by add(), extract(), peek(), relocate(), remove(), SweepEventQueue(), and ~SweepEventQueue().
|
private |
Indices.
Definition at line 93 of file sweep-event-queue.h.
Referenced by add(), extract(), peek(), relocate(), remove(), SweepEventQueue(), and ~SweepEventQueue().
|
private |
Allocated size of the heap.
Definition at line 92 of file sweep-event-queue.h.
Referenced by add(), and SweepEventQueue().
|
private |