GVoronoi Class Reference

[libgfc Index] [libgfc Hierarchy] [Headers]


A voronoi diagram generation class. More...

#include <src/gvoronoi.h>

Public Members


Detailed Description

Given a set of 2D points, this class can generate the triangulation and voronoi diagrams out of it.


void sitesInit(double coords[], int n) [public]

initialize all the sites. initialize all the sites by supplying the coordinates of them as a (x,y) array. This method must be called before the compute method. Internally each site will be assigned a number beginning w/ zero.

Parameters:
coords is the x y coordinates of all the sites. n is the number of sites.

void compute() [public]

computes the voronoi diagram for the set of sites. Once it is finished you can get the list of diagram edges and vertices using the methods getEdges() and getVertices(). Note that the vertices are those generated by bisecting edges and *does* not include the original sites.

int numEdges() const [public]

return number of edges in the Voronoi diagram

int numVertices() const [public]

return number of vertices on the voronoi diagram. (Note: they are not the original sites!)

DataPipe& getEdgesPipe() [public]

return the pipe containing the coordinates of all the edges. The following code segment steps through all the edges:

double x1, y1, x2, y2;
DataPipe& p = myvoronoi.getEdges(); 
p.seek(0);  //reset pipe pointer to the begining!
while(!p.eop()) {
p>>x1>>y1>>x2>>y2;
drawLine(x1,y1, x2, y2);
}; 

VEdge* getEdges() [public]

return the first voronoi diagram edge. Use the public filed 'next' to retrieve all the other voronoi edges.

DataPipe& getVertices() [public]

get the vertices pipe. The following code segment steps through all the vertices of the voronoi diagram:

double x, y;
DataPipe& p = myvoronoi.getVertices(); 
p.seek(0);  //reset pipe pointer to the begining!
while(!p.eop()) {
p>>x>>y;
drawPoint(x,y);
};


Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999
Kdoc