40#ifndef GEOGRAM_VORONOI_CVT
41#define GEOGRAM_VORONOI_CVT
90 const std::string&
delaunay =
"default"
111 const std::string&
delaunay =
"default"
193 show_iterations_ = x;
203 use_RVC_centroids_ = x;
212 constrained_cvt_ = x;
244 RVD_->set_facets_range(facets_begin, facets_end);
285 index_t n,
double* x,
double& f,
double* g
298 index_t n,
const double* x,
double f,
const double* g,
double gnorm
306 progress_ = progress;
321 return index_t(points_.size() / dimension_);
331 return RVD_->R3_embedding(p);
342 return &(points_[0]) + dimension_ * p;
349 return RVD_->volumetric();
358 RVD_->set_volumetric(x);
370 point_is_locked_.size() == 0 || i < point_is_locked_.size()
372 return point_is_locked_.size() != 0 && point_is_locked_[i];
384 if(point_is_locked_.size() !=
nb_points()) {
385 point_is_locked_.resize(
nb_points(),
false);
387 point_is_locked_[i] =
true;
402 point_is_locked_.resize(
nb_points(),
false);
404 point_is_locked_[i] =
false;
413 point_is_locked_.clear();
448 bool show_iterations_;
450 Delaunay_var delaunay_;
463 bool constrained_cvt_;
464 bool use_RVC_centroids_;
474 thisclass& operator= (
const thisclass& rhs);
Class and functions to compute restricted Voronoi diagrams and extract information from them.
#define geo_assert(x)
Verifies that a condition is met.
#define geo_debug_assert(x)
Verifies that a condition is met.
virtual ~CentroidalVoronoiTesselation()
Destructor.
void done_current()
Resets the current CentroidalVoronoiTesselation to nullptr.
virtual void funcgrad(index_t n, double *x, double &f, double *g)
Computes the objective function and its gradient.
void set_volumetric(bool x)
Sets volumetric mode.
double * embedding(index_t p)
Returns the representation of a point in embedding space.
void resize_points(index_t nb_points)
Changes the number of points.
void unlock_point(index_t i)
Unlocks a point.
CentroidalVoronoiTesselation(Mesh *mesh, const vector< vec3 > &R3_embedding, coord_index_t dimension=0, const std::string &delaunay="default")
Constructs a new CentroidalVoronoiTesselation.
void constrain_points(double *g) const
Constrains the locked points.
bool compute_initial_sampling(index_t nb_samples, bool verbose=false)
Computes a random initial sampling of the surface in nD.
void set_use_RVC_centroids(bool x)
Specifies whether centroids of Voronoi cells should be used.
void compute_volume(Mesh *mesh)
Computes the volumetric mesh (using the current points).
const vec3 & R3_embedding(index_t p) const
Gets the representation of a point in R3.
CentroidalVoronoiTesselation(Mesh *mesh, coord_index_t dimension=0, const std::string &delaunay="default")
Constructs a new CentroidalVoronoiTesselation.
void make_current()
Makes this CentroidalVoronoiTesselation the current one.
void compute_R3_embedding()
Computes the 3d representation of the Nd points.
virtual void newiteration()
Callback for the numerical solver.
virtual void Lloyd_iterations(index_t nb_iter, bool safe_mode=false)
Relaxes the points with Lloyd's algorithm.
static void funcgrad_CB(index_t n, double *x, double &f, double *g)
Callback for the numerical solver.
coord_index_t dimension() const
Gets the dimension of the points.
virtual void Newton_iterations(index_t nb_iter, index_t m=7)
Relaxes the points with Newton-Lloyd's algorithm.
bool point_is_locked(index_t i) const
Tests whether a point is locked.
IntegrationSimplex_var simplex_func_
Integration simplex used by custom codes, e.g. LpCVT.
void set_points(index_t nb_points, const double *points)
Initializes the points with a user-specified vector.
index_t nb_points() const
Gets the number of points to be optimized.
void compute_surface(Mesh *mesh, bool multinerve=true)
Computes the surfacic mesh (using the current points).
void lock_point(index_t i)
Locks a point.
static void newiteration_CB(index_t n, const double *x, double f, const double *g, double gnorm)
Callback for the numerical solver.
void unlock_all_points()
Unlocks all the points.
void set_constrained_cvt(bool x)
Specifies whether constrained mode should be used.
bool volumetric() const
Tests whether volumetric mode is used.
void set_show_iterations(bool x)
Specifies whether a progress bar should be used.
RestrictedVoronoiDiagram * RVD()
void set_progress_logger(ProgressTask *progress)
Sets a client for the progress bars.
void set_facets_range(index_t facets_begin, index_t facets_end)
Restricts computation to a part of the input mesh.
Abstract interface for Delaunay triangulation in Nd.
Tracks the progress of a task.
Computes a Restricted Voronoi Diagram (RVD).
Vector with aligned memory allocation.
Abstract interface for Delaunay.
Common include file, providing basic definitions. Should be included before anything else by all head...
base classes for computing integrals over the cells of a restricted Voronoi diagram
The class that represents a mesh.
Global Vorpaline namespace.
vecng< 3, Numeric::float64 > vec3
Represents points and vectors in 3d.
geo_index_t index_t
The type for storing and manipulating indices.
SmartPointer< RestrictedVoronoiDiagram > RestrictedVoronoiDiagram_var
Smart pointer to a RestrictedVoronoiDiagram object.
geo_coord_index_t coord_index_t
The type for storing coordinate indices, and iterating on the coordinates of a point.