Parallel Plane Sweep  0.1
Shared memory multithreaded version of the plane sweep algorithm
Public Member Functions | Public Attributes | List of all members
activeListVec Class Reference

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...
 

Detailed Description

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.

Member Function Documentation

bool activeListVec::alHsegEQ ( const halfsegment h1,
const halfsegment h2 
)
inline

Test if two halfsegments are equal

usues the overloaded == operator from the halfsegment class

Definition at line 224 of file vectorAlEq.h.

bool activeListVec::alHsegLT ( const halfsegment h1,
const halfsegment h2 
)
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

Parameters
h1[in] the halfsegment being inserted into the list or being searched for
h2[in] a halfsegment in the active list.
Returns
True if the segment is inserted. False if an equal segment or colinear segment exists in the active list.

Definition at line 152 of file vectorAlEq.h.

void activeListVec::erase ( const halfsegment h1,
const int  index 
)
inline

Definition at line 423 of file vectorAlEq.h.

void activeListVec::erase ( const halfsegment h1)
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.

bool activeListVec::exists ( const halfsegment h1,
halfsegment theCopy,
int &  index 
)
inline

Chech if a halfsegment exists in the active list

Parameters
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.

int activeListVec::find ( const halfsegment h1)
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.

bool activeListVec::getAbove ( const halfsegment h1,
halfsegment theAbove,
const int  index 
)
inline

Find the halfsegment direclty above (the neighbor above) h1

Parameters
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.

bool activeListVec::getAbove ( const halfsegment h1,
halfsegment theAbove 
)
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

Parameters
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.

bool activeListVec::getBelow ( const halfsegment h1,
halfsegment theBelow,
const int  index 
)
inline

Find the halfsegment direclty below (the neighbor below) h1

Parameters
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.

bool activeListVec::getBelow ( const halfsegment h1,
halfsegment theBelow 
)
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

Parameters
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.

void activeListVec::insert ( const halfsegment h1,
bool &  duplicate,
halfsegment theDup,
int &  segIndex 
)
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.

Parameters
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.

void activeListVec::print ( )
inline

Print function for debugging

Definition at line 460 of file vectorAlEq.h.

void activeListVec::replace ( const halfsegment h1,
const halfsegment newH1 
)
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.

void activeListVec::replace ( const halfsegment h1,
const halfsegment newH1,
const int  index 
)
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.

Member Data Documentation

double activeListVec::xVal

The current position of the sweep line.

Definition at line 137 of file vectorAlEq.h.


The documentation for this class was generated from the following file: