Fade2D Documentation pages v1.93
Delaunay Features
GEOM_FADE2D::Voronoi2 Class Reference

Voronoi diagram. More...

#include <Voronoi2.h>

Public Member Functions

bool getVCellsAtVEdge (VoroVertex2 *pVoroVtx0, VoroVertex2 *pVoroVtx1, VoroCell2 *&pCell0, VoroCell2 *&pCell1)
 Get the Voronoi cells adjacent to a Voronoi edge. More...
 
VoroCell2getVoronoiCell (Point2 *pSite)
 Get Voronoi cell. More...
 
void getVoronoiCells (std::vector< VoroCell2 * > &vVoronoiCells)
 Get all Voronoi cells. More...
 
VoroVertex2getVoronoiVertex (Triangle2 *pT)
 Get the Voronoi vertex of a triangle. More...
 
bool isValid () const
 Is valid. More...
 
VoroCell2locateVoronoiCell (const Point2 &queryPoint)
 Locate a Voronoi Cell. More...
 
void show (const char *filename, bool bVoronoi=true, bool bCellColors=true, bool bSites=true, bool bDelaunay=true, bool bCellLabels=false)
 Draw the Voronoi diagram. More...
 
void show (Visualizer2 *pVisualizer, bool bVoronoi=true, bool bCellColors=true, bool bSites=true, bool bDelaunay=true, bool bCellLabels=false)
 Draw the Voronoi diagram. More...
 

Protected Attributes

Voronoi2Impl * pImpl
 

Detailed Description

This class represents a Voronoi diagram. A Voronoi diagram is the dual graph of a Delaunay triangulation i.e.,

  • Each Voronoi cell contains the area closest to its site which is a Delaunay vertex
  • Each Voronoi edge has a dual edge in the Delaunay triangulation at an angle of 90 degrees to it.
  • Each Voronoi vertex is the circumcenter of a Delaunay triangle
See also
https://en.wikipedia.org/wiki/Voronoi_diagram

Member Function Documentation

◆ getVCellsAtVEdge()

bool GEOM_FADE2D::Voronoi2::getVCellsAtVEdge ( VoroVertex2 pVoroVtx0,
VoroVertex2 pVoroVtx1,
VoroCell2 *&  pCell0,
VoroCell2 *&  pCell1 
)
Parameters
pVoroVtx0,pVoroVtx1are the Voronoi vertices that define the Voronoi edge
pCell0,pCell1are used to return the adjacent Voronoi cells or NULL if the command fails.
Returns
true when the command succeeds or false otherwise i.e., when (pVoroVtx0,pVoroVtx1) is not an edge of the Voronoi diagram.

◆ getVoronoiCell()

VoroCell2* GEOM_FADE2D::Voronoi2::getVoronoiCell ( Point2 pSite)

Use this method to retrieve the Voronoi cell of a specific site.

Parameters
[in]pSite
Returns
the VoroCell2 of pSite.

◆ getVoronoiCells()

void GEOM_FADE2D::Voronoi2::getVoronoiCells ( std::vector< VoroCell2 * > &  vVoronoiCells)

Use this method to retrieve all finite and infinite Voronoi cells.

Parameters
[out]vVoronoiCells

◆ getVoronoiVertex()

VoroVertex2* GEOM_FADE2D::Voronoi2::getVoronoiVertex ( Triangle2 pT)

Get the Voronoi vertex of a certain dual Delaunay triangle pT

Parameters
[in]pT
Returns
the Voronoi vertex that corresponds to pT

◆ isValid()

bool GEOM_FADE2D::Voronoi2::isValid ( ) const
Returns
whether the Voronoi diagram is ready for use. This is the case as soon 3 sites exist which are not collinear.

◆ locateVoronoiCell()

VoroCell2* GEOM_FADE2D::Voronoi2::locateVoronoiCell ( const Point2 queryPoint)

This is a high performance method to locate the Voronoi cell of an arbitrary queryPoint

Parameters
[in]queryPoint
Returns
the Voronoi cell that contains queryPoint or NULL if the Voronoi diagram is invalid.

◆ show() [1/2]

void GEOM_FADE2D::Voronoi2::show ( const char *  filename,
bool  bVoronoi = true,
bool  bCellColors = true,
bool  bSites = true,
bool  bDelaunay = true,
bool  bCellLabels = false 
)
Parameters
filenameis the output *.ps filename
bVoronoidraw the edges of the Voronoi diagram (default: true)
bCellColorsuse background colors for the Voronoi cells (default: true)
bSitesdraw the sites (default: true)
bDelaunaydraw the Delaunay triangles (default: true)
bCellLabelsshow cell labels (or -1 if not assigned) (default: false)

This method does automatically crop the viewport to twice the range of the sites. Thus very large and infinite cells appear clipped.

◆ show() [2/2]

void GEOM_FADE2D::Voronoi2::show ( Visualizer2 pVisualizer,
bool  bVoronoi = true,
bool  bCellColors = true,
bool  bSites = true,
bool  bDelaunay = true,
bool  bCellLabels = false 
)
Parameters
pVisualizeris the Visualizer2 object to be used
bVoronoidraw the edges of the Voronoi diagram (default: true)
bCellColorsuse background colors for the Voronoi cells (default: true)
bSitesdraw the sites (default: true)
bDelaunaydraw the Delaunay triangles (default: true)
bCellLabelsshow cell labels (or -1 if not assigned) (default: false)
Note
This method only clips infinite cells. But finite cells can also be very large. Call Visualizer2::setLimit() to specify the range of interest.

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