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"
188 show_iterations_ = x;
198 use_RVC_centroids_ = x;
207 constrained_cvt_ = x;
239 RVD_->set_facets_range(facets_begin, facets_end);
280 index_t n,
double* x,
double& f,
double* g
293 index_t n,
const double* x,
double f,
const double* g,
double gnorm
301 progress_ = progress;
316 return index_t(points_.size() / dimension_);
326 return RVD_->R3_embedding(p);
337 return &(points_[0]) + dimension_ * p;
344 return RVD_->volumetric();
353 RVD_->set_volumetric(x);
365 point_is_locked_.size() == 0 || i < point_is_locked_.size()
367 return point_is_locked_.size() != 0 && point_is_locked_[i];
379 if(point_is_locked_.size() != nb_points()) {
380 point_is_locked_.resize(nb_points(),
false);
382 point_is_locked_[i] =
true;
395 point_is_locked_.size() != nb_points()
397 point_is_locked_.resize(nb_points(),
false);
399 point_is_locked_[i] =
false;
408 point_is_locked_.clear();
443 bool show_iterations_;
445 Delaunay_var delaunay_;
458 bool constrained_cvt_;
459 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.
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).
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.
double * embedding(index_t p)
Returns the representation of a point in embedding space.
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.
RestrictedVoronoiDiagram * RVD()
const vec3 & R3_embedding(index_t p) const
Gets the representation of a point in R3.
Abstract interface for Delaunay triangulation in Nd.
Tracks the progress of a task.
Computes a Restricted Voronoi Diagram (RVD).
Specialization of vector for elements of type bool.
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.