void PQdelete(Halfedge * he) { Halfedge *last; if (he->vertex != (Site *) NULL) { last = &PQhash[PQbucket(he)]; while (last->PQnext != he) last = last->PQnext; last->PQnext = he->PQnext; PQcount -= 1; deref(he->vertex); he->vertex = (Site *) NULL; } }
//remove the HalfEdge from the list of vertices void VoronoiDiagramGenerator::PQdelete(struct VoronoiDiagramGenerator::Halfedge *he) { struct Halfedge *last; if(he -> vertex != (struct Site *) NULL) { last = &PQhash[PQbucket(he)]; while (last -> PQnext != he) last = last -> PQnext; last -> PQnext = he -> PQnext; PQcount -= 1; deref(he -> vertex); he -> vertex = (struct Site *) NULL; }; }
//push the HalfEdge into the ordered linked list of vertices void VoronoiDiagramGenerator::PQinsert(struct VoronoiDiagramGenerator::Halfedge *he,struct VoronoiDiagramGenerator::Site * v, float offset) { struct Halfedge *last, *next; he -> vertex = v; ref(v); he -> ystar = (float)(v -> coord.y + offset); last = &PQhash[PQbucket(he)]; while ((next = last -> PQnext) != (struct Halfedge *) 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 += 1; }
void PQinsert(Halfedge * he, Site * v, double offset) { Halfedge *last, *next; he->vertex = v; ref(v); he->ystar = v->coord.y + offset; last = &PQhash[PQbucket(he)]; while ((next = last->PQnext) != (struct Halfedge *) 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 += 1; }