NetDEM v1.0
Loading...
Searching...
No Matches
netdem::Voronoi Class Reference

A class for computing Voronoi diagrams. More...

#include <voronoi.hpp>

Static Public Member Functions

static std::tuple< VecXT< Vec3d >, VecXT< VecXT< Vec3i > > > Solve (VecXT< Vec3d > const &vt_seeds, STLModel const &stl_model, bool use_cork=true)
 Compute a Voronoi diagram from a set of seed points and an STL model.
 
static std::tuple< VecXT< Vec3d >, VecXT< VecXT< Vec3i > >, VecXT< Vec3d > > Solve (STLModel const &stl_model, int num_seeds, int max_iter=1000, double tol=1.0e-3, bool use_cork=true)
 Compute a centroidal Voronoi diagram from an STL model.
 
static void SaveAsVTK (std::string const &file, VecXT< Vec3d > const &vt_nodes, VecXT< VecXT< Vec3i > > const &vt_cells, VecXT< Vec3d > const &vt_seeds)
 Save a Voronoi diagram in VTK format.
 

Detailed Description

A class for computing Voronoi diagrams.

This class provides methods for computing Voronoi diagrams using a variety of algorithms and input data types.

Member Function Documentation

◆ SaveAsVTK()

void Voronoi::SaveAsVTK ( std::string const & file,
VecXT< Vec3d > const & vt_nodes,
VecXT< VecXT< Vec3i > > const & vt_cells,
VecXT< Vec3d > const & vt_seeds )
static

Save a Voronoi diagram in VTK format.

This static method saves a given Voronoi diagram (represented by its nodes, cells, and seed points) to a file in VTK format.

Parameters
fileThe name of the file to save.
vt_nodesThe Voronoi nodes to save.
vt_cellsThe Voronoi cells to save.
vt_seedsThe seed points used to compute the Voronoi diagram.

◆ Solve() [1/2]

tuple< VecXT< Vec3d >, VecXT< VecXT< Vec3i > >, VecXT< Vec3d > > Voronoi::Solve ( STLModel const & stl_model,
int num_seeds,
int max_iter = 1000,
double tol = 1.0e-3,
bool use_cork = true )
static

Compute a centroidal Voronoi diagram from an STL model.

This static method computes a centroidal Voronoi diagram from a given STL model using Lloyd's algorithm. It returns the resulting Voronoi nodes, cells, and seed points as tuples.

Parameters
stl_modelThe STL model that defines the boundary of the Voronoi diagram.
num_seedsThe number of seed points to use.
max_iterThe maximum number of iterations to perform (default: 1000).
tolThe convergence tolerance (default: 1.0e-3).
use_corkA boolean value indicating whether to use the Cork library for computation (default: true).
Returns
A tuple containing the Voronoi nodes, cells, and seed points as vectors.

◆ Solve() [2/2]

tuple< VecXT< Vec3d >, VecXT< VecXT< Vec3i > > > Voronoi::Solve ( VecXT< Vec3d > const & vt_seeds,
STLModel const & stl_model,
bool use_cork = true )
static

Compute a Voronoi diagram from a set of seed points and an STL model.

This static method computes a Voronoi diagram from a given set of seed points and an STL model. It returns the resulting Voronoi nodes and cells as tuples.

Parameters
vt_seedsThe seed points for the Voronoi diagram.
stl_modelThe STL model that defines the boundary of the Voronoi diagram.
use_corkA boolean value indicating whether to use the Cork library for computation (default: true).
Returns
A tuple containing the Voronoi nodes and cells as vectors.

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