40#ifndef GEOGRAM_VORONOI_CVT
41#define GEOGRAM_VORONOI_CVT
57 class RestrictedVoronoiDiagram;
90 const std::string& delaunay =
"default"
111 const std::string& delaunay =
"default"
186 show_iterations_ = x;
196 use_RVC_centroids_ = x;
205 constrained_cvt_ = x;
237 RVD_->set_facets_range(facets_begin, facets_end);
278 index_t n,
double* x,
double& f,
double* g
291 index_t n,
const double* x,
double f,
const double* g,
double gnorm
299 progress_ = progress;
314 return index_t(points_.size() / dimension_);
324 return RVD_->R3_embedding(p);
335 return &(points_[0]) + dimension_ * p;
342 return RVD_->volumetric();
351 RVD_->set_volumetric(x);
363 point_is_locked_.size() == 0 || i < point_is_locked_.size()
365 return point_is_locked_.size() != 0 && point_is_locked_[i];
377 if(point_is_locked_.size() != nb_points()) {
378 point_is_locked_.resize(nb_points(),
false);
380 point_is_locked_[i] =
true;
393 point_is_locked_.size() != nb_points()
395 point_is_locked_.resize(nb_points(),
false);
397 point_is_locked_[i] =
false;
406 point_is_locked_.clear();
441 bool show_iterations_;
443 Delaunay_var delaunay_;
456 bool constrained_cvt_;
457 bool use_RVC_centroids_;
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.
CentroidalVoronoiTesselation is the main component of the remeshing algorithm.
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.
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.
virtual void Lloyd_iterations(index_t nb_iter)
Relaxes the points with 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.
geo_index_t index_t
The type for storing and manipulating indices.
geo_coord_index_t coord_index_t
The type for storing coordinate indices, and iterating on the coordinates of a point.