#include <VastDefs.h>
Public Member Functions | |
| HeapPQ () | |
| void | PQinitialize (int sqrt_nsites, double ymin, double deltay) |
| void | PQreset () |
| void | PQinsert (Halfedge *he, Site *v, double offset) |
| void | PQdelete (Halfedge *he) |
| int | PQbucket (Halfedge *he) |
| int | PQempty () |
| Vector2D | PQ_min () |
| Halfedge * | PQextractmin () |
Protected Attributes | |
| int | PQcount |
| int | PQmin |
| int | PQhashsize |
| double | ymin |
| double | deltay |
| Halfedge * | PQhash |
HeapPQ class.
Maintains a hash table in order to find halfedges in n*log(n) time.
Definition at line 100 of file VastDefs.h.
| HeapPQ::HeapPQ | ( | ) |
Definition at line 73 of file VastDefs.cc.
{
PQhash = NULL;
}
| Vector2D HeapPQ::PQ_min | ( | ) |
| int HeapPQ::PQbucket | ( | Halfedge * | he | ) |
Definition at line 122 of file VastDefs.cc.
Referenced by PQdelete(), and PQinsert().
{
int bucket;
bucket = (int)((he->ystar - ymin)/deltay) * PQhashsize;
if(bucket < 0) bucket = 0;
if(bucket >= PQhashsize) bucket = PQhashsize-1;
if(bucket < PQmin) PQmin = bucket;
return bucket;
}
| void HeapPQ::PQdelete | ( | Halfedge * | he | ) |
| int HeapPQ::PQempty | ( | ) |
Definition at line 133 of file VastDefs.cc.
Referenced by Vast::buildVoronoi().
{
return PQcount==0;
}
| Halfedge * HeapPQ::PQextractmin | ( | ) |
| void HeapPQ::PQinitialize | ( | int | sqrt_nsites, | |
| double | ymin, | |||
| double | deltay | |||
| ) |
Definition at line 78 of file VastDefs.cc.
Referenced by Vast::buildVoronoi().
{
PQcount = 0;
PQmin = 0;
PQhashsize = 4 * sqrt_nsites;
PQhash = new Halfedge[PQhashsize];
this->ymin = ymin;
this->deltay = deltay;
}
Definition at line 93 of file VastDefs.cc.
Referenced by Vast::buildVoronoi().
{
Halfedge *last, *next;
he->vertex = v;
he->ystar = v->coord.y + offset;
last = &PQhash[PQbucket(he)];
while((next = last->PQnext) != NULL && (he->ystar > next->ystar || (he->ystar == next->ystar && v->coord.x > next->vertex->coord.x))) {
last = next;
}
he->PQnext = last->PQnext;
last->PQnext = he;
PQcount++;
}
| void HeapPQ::PQreset | ( | ) |
double HeapPQ::deltay [protected] |
Definition at line 115 of file VastDefs.h.
Referenced by PQbucket().
int HeapPQ::PQcount [protected] |
Definition at line 114 of file VastDefs.h.
Referenced by PQdelete(), PQempty(), PQextractmin(), PQinitialize(), and PQinsert().
Halfedge* HeapPQ::PQhash [protected] |
Definition at line 116 of file VastDefs.h.
Referenced by HeapPQ(), PQ_min(), PQdelete(), PQextractmin(), PQinitialize(), PQinsert(), and PQreset().
int HeapPQ::PQhashsize [protected] |
Definition at line 114 of file VastDefs.h.
Referenced by PQbucket(), and PQinitialize().
int HeapPQ::PQmin [protected] |
Definition at line 114 of file VastDefs.h.
Referenced by PQ_min(), PQbucket(), PQextractmin(), and PQinitialize().
double HeapPQ::ymin [protected] |
Definition at line 115 of file VastDefs.h.
Referenced by PQbucket().
1.7.1