Parallel Plane Sweep
0.1
Shared memory multithreaded version of the plane sweep algorithm
|
A vector-based implementation of a plane sweep active list. More...
#include <vectorAlEq.h>
Public Member Functions | |
bool | alHsegLT (const halfsegment &h1, const halfsegment &h2) |
bool | alHsegEQ (const halfsegment &h1, const halfsegment &h2) |
void | insert (const halfsegment &h1, bool &duplicate, halfsegment &theDup, int &segIndex) |
bool | exists (const halfsegment &h1, halfsegment &theCopy, int &index) |
int | find (const halfsegment &h1) |
void | replace (const halfsegment &h1, const halfsegment &newH1) |
void | replace (const halfsegment &h1, const halfsegment &newH1, const int index) |
bool | getAbove (const halfsegment &h1, halfsegment &theAbove, const int index) |
bool | getAbove (const halfsegment &h1, halfsegment &theAbove) |
bool | getBelow (const halfsegment &h1, halfsegment &theBelow, const int index) |
bool | getBelow (const halfsegment &h1, halfsegment &theBelow) |
void | erase (const halfsegment &h1, const int index) |
void | erase (const halfsegment &h1) |
void | print () |
Public Attributes | |
double | xVal |
The current position of the sweep line. More... | |
A vector-based implementation of a plane sweep active list.
The vector implementation of an activce list.
The active list is always sorted with respect to the current position of the sweep line. In other words, the segments are sorted vertically with respect to their y intercept at the current position of the sweep line.
Like the event queue, this implementation was for cache behavior comparison with the AVL version
Definition at line 130 of file vectorAlEq.h.
|
inline |
Test if two halfsegments are equal
usues the overloaded == operator from the halfsegment class
Definition at line 224 of file vectorAlEq.h.
|
inline |
Active list halfsegment less than.
Comparison function for halfsegments based on the current sweep line position.
Always assumes the h1 is being added to the list or is the halfsegment being searched for, and h2 is currently in the active lis
h1 | [in] the halfsegment being inserted into the list or being searched for |
h2 | [in] a halfsegment in the active list. |
Definition at line 152 of file vectorAlEq.h.
|
inline |
Definition at line 423 of file vectorAlEq.h.
|
inline |
Find the halfsegment that is equal to h1 (in structure only, equality is not based on labels) and remove it from the active list.
Definition at line 445 of file vectorAlEq.h.
|
inline |
Chech if a halfsegment exists in the active list
h1 | [in] the halfsegment to check |
theCopy | [out] a copy of the halfsegment identical to h1 (in structure only, equality ignores label values) that is in the active list |
index | [out] the index of the theCopy, if it is found. -1 if h1 is not in the active list. |
Definition at line 280 of file vectorAlEq.h.
|
inline |
Find the index of a halfsegment in the active list.
linear time search. returns -1 if the halfsegment is not in the active list.
Definition at line 294 of file vectorAlEq.h.
|
inline |
Find the halfsegment direclty above (the neighbor above) h1
h1 | [in] the halfsegment whose neighbor we are finding |
theAbove | [out] a copy of the neighbor above h1 |
index | [in] the index of h1 in the active list |
Definition at line 350 of file vectorAlEq.h.
|
inline |
Find the halfsegment direclty above (the neighbor above) h1
The same as the other getAbove, but doesn't know the index of h1, so the find function is used to locate h1 in the active list
h1 | [in] the halfsegment whose neighbor we are finding |
theAbove | [out] a copy of the neighbor above h1 |
Definition at line 371 of file vectorAlEq.h.
|
inline |
Find the halfsegment direclty below (the neighbor below) h1
h1 | [in] the halfsegment whose neighbor we are finding |
theBelow | [out] a copy of the neighbor below h1 |
index | [in] the index of h1 in the active list |
Definition at line 391 of file vectorAlEq.h.
|
inline |
Find the halfsegment direclty below (the neighbor below) h1
The same as the other getBelow, but doesn't know the index of h1, so the find function is used to locate h1 in the active list
h1 | [in] the halfsegment whose neighbor we are finding |
theBelow | [out] a copy of the neighbor below h1 |
Definition at line 410 of file vectorAlEq.h.
|
inline |
Insert a segment into the active list.
Segments in the active list are ALWAYS left halfsegments, and are sorted according to thier y-intercept with the sweep line.
Do NOT try to insert a right halfsegment. If you do, undertermined behavior will occur!
If there is a duplicate halfsegment (based only on end points, not labels) in the active list, the duplicate parameter is assigned the duplicate halfsegment.
h1 | [in] the halfsegment to insert into the active list |
duplicate | [out] assigned True if a duplicate of h1 is in the active list. False otherwise. |
theDup | [out] a copy of the duplicate halfsegment already un the active list |
segIndex | [out] the index of duplicate of the h1, if one is found, or the index of h1 after the insert if no duplicate is found. |
Definition at line 244 of file vectorAlEq.h.
|
inline |
Print function for debugging
Definition at line 460 of file vectorAlEq.h.
|
inline |
replace a halfsegment in the active list with newH1.
Used to update labels.
Uses the find function to find h1 in the active list
Definition at line 309 of file vectorAlEq.h.
|
inline |
replace a halfsegment in the active list with newH1.
Used to update labels.
Does not search for the halfsegment in the active list. Rather, it looks for the halfsegment at the specified index.
If the halfsegment at the specified index does not match h1, the program crashes!
Definition at line 328 of file vectorAlEq.h.
double activeListVec::xVal |
The current position of the sweep line.
Definition at line 137 of file vectorAlEq.h.