40 #ifndef GEOGRAM_VORONOI_RVD
41 #define GEOGRAM_VORONOI_RVD
68 class IntegrationSimplex;
70 class RVDPolyhedronCallback;
71 class RVDPolygonCallback;
105 const double* R3_embedding,
index_t R3_embedding_stride
125 (mesh->vertices.
nb() > 0) ? mesh->vertices.
point_ptr(0) :
nullptr,
146 return create(delaunay, mesh, R3_embedding[0].data(), 3);
194 double* p,
index_t nb_points,
bool verbose =
false
198 result = compute_initial_sampling_in_volume(
199 p, nb_points, verbose
202 result = compute_initial_sampling_on_surface(
203 p, nb_points, verbose
221 double* p,
index_t nb_points,
bool verbose
236 double* p,
index_t nb_points,
bool verbose
286 compute_centroids_in_volume(mg, m);
288 compute_centroids_on_surface(mg, m);
337 compute_CVT_func_grad_in_volume(f, g);
339 compute_CVT_func_grad_on_surface(f, g);
373 index_t nb_points,
double* points,
374 vec3* nearest,
bool do_project =
false
391 index_t nb_points,
double* points,
394 nearest.resize(nb_points);
395 project_points_on_surface(
396 nb_points, points, &nearest[0], do_project
414 index_t nb_points,
double* points,
417 nearest.resize(nb_points * 3);
418 project_points_on_surface(
419 nb_points, points, (
vec3*) (&nearest[0]), do_project
467 RDT_SELECT_NEAREST=8,
476 RDT_PROJECT_ON_SURFACE=16,
552 bool cell_borders_only =
false,
553 bool integration_simplices =
false
582 bool copy_symbolic_info=
false
601 bool symbolic =
true,
602 bool connected_comp_priority =
true,
621 bool symbolic =
true,
622 bool connected_comp_priority =
true,
685 return *(
const vec3*) (R3_embedding_base_ + v * R3_embedding_stride_);
710 const double* R3_embedding,
index_t R3_embedding_stride
722 const double* R3_embedding_base_;
#define geo_debug_assert(x)
Verifies that a condition is met.
Generic mechanism for attributes.
An allocator for points that are created from intersections in GenericVoronoiDiagram.
Base class for Axis Aligned Bounding Box trees.
Base class for reference-counted objects.
Abstract interface for Delaunay triangulation in Nd.
Computes an objective function and its gradient over a restricted Voronoi diagram.
Axis Aligned Bounding Box tree of mesh facets in 3D.
index_t nb() const
Gets the number of (sub-)elements.
const double * point_ptr(index_t v) const
Gets a point.
index_t dimension() const
Gets the dimension of the vertices.
Baseclass for user functions called for each polygon of a surfacic restricted Voronoi diagram.
Baseclass for user functions called for each polyhedron of a volumetric restricted Voronoi diagram.
Computes a Restricted Voronoi Diagram (RVD).
RDTMode
Determines the operating mode of compute_RDT().
virtual void compute_CVT_func_grad_in_volume(double &f, double *g)=0
Computes the value and gradient of Lloyd's function (quantization noise power) in the volume.
virtual void for_each_polygon(RVDPolygonCallback &callback, bool symbolic=true, bool connected_comp_priority=true, bool parallel=false)=0
Invokes a user callback for each intersection polygon of the restricted Voronoi diagram (surfacic mod...
virtual void set_volumetric(bool x)=0
Sets volumetric mode.
virtual void set_check_SR(bool x)=0
Specifies whether the "radius of security" criterion should be enforced.
virtual void compute_centroids_in_volume(double *mg, double *m)=0
Computes the centroids and masses of the Voronoi cells restricted to the volume.
coord_index_t dimension() const
Gets the dimension used by this RestrictedVoronoiDiagram.
virtual void compute_RVD(Mesh &M, coord_index_t dim=0, bool cell_borders_only=false, bool integration_simplices=false)=0
Computes the restricted Voronoi diagram and stores it in a mesh.
virtual bool exact_predicates() const =0
Tests whether exact predicates are used.
virtual bool compute_initial_sampling_on_surface(double *p, index_t nb_points, bool verbose)=0
Computes a random initial sampling of the surface in nD.
virtual void set_exact_predicates(bool x)=0
Specifies whether exact predicates should be used.
virtual void set_delaunay(Delaunay *delaunay)
Sets the Delaunay triangulation.
virtual void create_threads()=0
Partitions the mesh and creates local storage for multithreaded implementation.
virtual void compute_RVC(index_t i, Mesh &M, Mesh &result, bool copy_symbolic_info=false)=0
Computes a restricted Voronoi cell.
virtual void for_each_polyhedron(RVDPolyhedronCallback &callback, bool symbolic=true, bool connected_comp_priority=true, bool parallel=false)=0
Invokes a user callback for each intersection polyhedron of the restricted Voronoi diagram (volumetri...
virtual void compute_integration_simplex_func_grad(double &f, double *g, IntegrationSimplex *F)=0
Computes the value and gradient of an objective function over Voronoi cells decomposed into simplices...
virtual bool compute_initial_sampling_in_volume(double *p, index_t nb_points, bool verbose)=0
Computes a random initial sampling of the volume in nD.
Delaunay * delaunay()
Gets the Delaunay triangulation.
static RestrictedVoronoiDiagram * create(Delaunay *delaunay, Mesh *mesh, const double *R3_embedding, index_t R3_embedding_stride)
Creates a RestrictedVoronoiDiagram.
virtual void compute_centroids_on_surface(double *mg, double *m)=0
Computes the centroids and masses of the Voronoi cells restricted to the surface.
virtual void delete_threads()=0
Deletes all the local storage associated with the threads.
const vec3 & R3_embedding(index_t v) const
Gets the mapping in R3 of a point.
void compute_RDT(Mesh &RDT, RDTMode mode=RDTMode(RDT_RVC_CENTROIDS|RDT_PREFER_SEEDS), const vector< bool > &seed_is_locked=vector< bool >(), MeshFacetsAABB *AABB=nullptr)
Computes the restricted Delaunay triangulation.
Mesh * mesh()
Gets the input mesh.
static RestrictedVoronoiDiagram * create(Delaunay *delaunay, Mesh *mesh, const vector< vec3 > &R3_embedding)
Creates a RestrictedVoronoiDiagram.
void compute_centroids(double *mg, double *m)
Computes the centroids and masses of the restricted Voronoi cells.
bool compute_initial_sampling(double *p, index_t nb_points, bool verbose=false)
Computes a random initial sampling in nD.
virtual void set_facets_range(index_t facets_begin, index_t facets_end)=0
Restricts surfacic computations to a part of the input mesh.
virtual void set_tetrahedra_range(index_t tets_begin, index_t tets_end)=0
Restricts volumetric computations to a part of the input mesh.
void compute_CVT_func_grad(double &f, double *g)
Computes the value and gradient of Lloyd's function (quantization noise power).
bool volumetric() const
Tests whether volumetric mode is used.
RestrictedVoronoiDiagram(Delaunay *delaunay, Mesh *mesh, const double *R3_embedding, index_t R3_embedding_stride)
This constructor is never called directly.
virtual void compute_CVT_func_grad_on_surface(double &f, double *g)=0
Computes the value and gradient of Lloyd's function (quantization noise power) on the surface.
void project_points_on_surface(index_t nb_points, double *points, vector< vec3 > &nearest, bool do_project=false)
Computes the projection of points onto the surface in nD space.
void project_points_on_surface(index_t nb_points, double *points, vector< double > &nearest, bool do_project=false)
Computes the projection of points onto the surface in nD space.
virtual void compute_RDT(vector< index_t > &simplices, vector< double > &embedding, RDTMode mode=RDTMode(RDT_RVC_CENTROIDS|RDT_PREFER_SEEDS), const vector< bool > &seed_is_locked=vector< bool >(), MeshFacetsAABB *AABB=nullptr)=0
Computes the restricted Delaunay triangulation.
static RestrictedVoronoiDiagram * create(Delaunay *delaunay, Mesh *mesh)
Creates a RestrictedVoronoiDiagram.
~RestrictedVoronoiDiagram() override
RestrictedVoronoiDiagram destructor.
virtual void project_points_on_surface(index_t nb_points, double *points, vec3 *nearest, bool do_project=false)=0
Computes the projection of points onto the surface in nD space.
virtual GEOGen::PointAllocator * point_allocator()=0
Gets the PointAllocator.
Specialization of vector for elements of type bool.
Base class of reference-counted objects, to be used with smart pointers.
Common include file, providing basic definitions. Should be included before anything else by all head...
Geometric functions in 2d and 3d.
Classes for managing tuples of indices.
The class that represents a mesh.
Global Vorpaline namespace.
void parallel(std::function< void()> f1, std::function< void()> f2)
Calls functions in parallel.
geo_signed_index_t signed_index_t
The type for storing and manipulating indices differences.
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.
Pointers with automatic reference counting.