#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 |
Maintains a hash table in order to find halfedges in n*log(n) time.
Definition at line 96 of file VastDefs.h.
| HeapPQ::HeapPQ | ( | ) |
| Vector2D HeapPQ::PQ_min | ( | ) |
Definition at line 138 of file VastDefs.cc.
Referenced by Vast::buildVoronoi().
00139 { 00140 Vector2D answer; 00141 00142 while(PQhash[PQmin].PQnext == NULL) PQmin++; 00143 00144 answer.x = PQhash[PQmin].PQnext->vertex->coord.x; 00145 answer.y = PQhash[PQmin].PQnext->ystar; 00146 return answer; 00147 }
| int HeapPQ::PQbucket | ( | Halfedge * | he | ) |
Definition at line 122 of file VastDefs.cc.
Referenced by PQdelete(), and PQinsert().
00123 { 00124 int bucket; 00125 00126 bucket = (int)((he->ystar - ymin)/deltay) * PQhashsize; 00127 if(bucket < 0) bucket = 0; 00128 if(bucket >= PQhashsize) bucket = PQhashsize-1; 00129 if(bucket < PQmin) PQmin = bucket; 00130 return bucket; 00131 }
| void HeapPQ::PQdelete | ( | Halfedge * | he | ) |
Definition at line 108 of file VastDefs.cc.
Referenced by Vast::buildVoronoi().
00109 { 00110 Halfedge *last; 00111 00112 if(he->vertex != NULL) { 00113 last = &PQhash[PQbucket(he)]; 00114 while(last->PQnext != he) last = last->PQnext; 00115 00116 last->PQnext = he->PQnext; 00117 PQcount--; 00118 he->vertex = NULL; 00119 } 00120 }
| int HeapPQ::PQempty | ( | ) |
Definition at line 133 of file VastDefs.cc.
Referenced by Vast::buildVoronoi().
00134 { 00135 return PQcount==0; 00136 }
| 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().
00079 { 00080 PQcount = 0; 00081 PQmin = 0; 00082 PQhashsize = 4 * sqrt_nsites; 00083 PQhash = new Halfedge[PQhashsize]; 00084 this->ymin = ymin; 00085 this->deltay = deltay; 00086 }
Definition at line 93 of file VastDefs.cc.
Referenced by Vast::buildVoronoi().
00094 { 00095 Halfedge *last, *next; 00096 00097 he->vertex = v; 00098 he->ystar = v->coord.y + offset; 00099 last = &PQhash[PQbucket(he)]; 00100 while((next = last->PQnext) != NULL && (he->ystar > next->ystar || (he->ystar == next->ystar && v->coord.x > next->vertex->coord.x))) { 00101 last = next; 00102 } 00103 he->PQnext = last->PQnext; 00104 last->PQnext = he; 00105 PQcount++; 00106 }
| void HeapPQ::PQreset | ( | ) |
Definition at line 88 of file VastDefs.cc.
Referenced by Vast::buildVoronoi().
00089 { 00090 delete[] PQhash; 00091 }
double HeapPQ::deltay [protected] |
int HeapPQ::PQcount [protected] |
Definition at line 110 of file VastDefs.h.
Referenced by PQdelete(), PQempty(), PQextractmin(), PQinitialize(), and PQinsert().
Halfedge* HeapPQ::PQhash [protected] |
Definition at line 112 of file VastDefs.h.
Referenced by HeapPQ(), PQ_min(), PQdelete(), PQextractmin(), PQinitialize(), PQinsert(), and PQreset().
int HeapPQ::PQhashsize [protected] |
int HeapPQ::PQmin [protected] |
Definition at line 110 of file VastDefs.h.
Referenced by PQ_min(), PQbucket(), PQextractmin(), and PQinitialize().
double HeapPQ::ymin [protected] |
1.5.8