40#ifndef GEOGRAM_MESH_MESH_GEOMETRY
41#define GEOGRAM_MESH_MESH_GEOMETRY
203 vec3 result(0.0, 0.0, 0.0);
210 return (1.0 / count) * result;
220 vec3 result(0.0, 0.0, 0.0);
225 return (1.0 /
double(M.cells.
nb_vertices(c))) * result;
244 return 0.25 * (v1 + v2 + v3 + v4);
339 void GEOGRAM_API
get_bbox(
const Mesh& M,
double* xyzmin,
double* xyzmax);
374 Mesh& M,
double gradation = 1.0,
index_t nb_lfs_samples = 0
#define geo_debug_assert(x)
Verifies that a condition is met.
Common include file, providing basic definitions. Should be included before anything else by all head...
index_t nb_vertices(index_t c) const
Gets the number of vertices of a cell.
index_t vertex(index_t c, index_t lv) const
Gets a vertex of a cell by local vertex index.
index_t corners_end(index_t f) const
Gets the upper limit for iterating over the corners of a facet.
bool are_simplices() const
Tests whether all the facets are triangles.
index_t corners_begin(index_t f) const
Gets the first element for iterating over the corners of a facet.
index_t next_corner_around_facet(index_t f, index_t c) const
Gets the successor of a corner around a facet.
const double * point_ptr(index_t v) const
Gets a point.
index_t dimension() const
Gets the dimension of the vertices.
Geometric functions in 2d and 3d.
Geometric functions in arbitrary dimension.
The class that represents a mesh.
vec3 mesh_corner_vector(const Mesh &M, index_t c1)
Gets a vector by a mesh corner.
double mesh_unsigned_normal_angle(const Mesh &M, index_t f1, index_t f2)
Computes the angle between the normal vectors of two mesh facets sharing an edge.
double mesh_normal_angle(const Mesh &M, index_t c)
Computes the angle between the normal vectors of two mesh facets sharing an edge.
const vec3 & mesh_vertex_ref(const Mesh &M, index_t v)
Gets a mesh vertex by its index.
const vec3 & mesh_corner_vertex(const Mesh &M, index_t c)
Gets a mesh vertex by an incident corner index.
double mesh_area(const Mesh &M, index_t dim)
Computes the total surface area of a mesh in arbitrary dimension.
vec3 mesh_cell_center(const Mesh &M, index_t c)
Gets the centroid of the vertices of a cell in a mesh.
double triangle_area(const vec3 &p1, const vec3 &p2, const vec3 &p3)
Computes the area of a 3d triangle.
vec3 & mesh_corner_vertex_ref(Mesh &M, index_t c)
Gets a mesh vertex by an incident corner index.
vec3 mesh_facet_center(const Mesh &M, index_t f)
Gets the centroid of the vertices of a facet in a mesh.
const vec3 & mesh_vertex(const Mesh &M, index_t v)
Gets a mesh vertex by its index.
vec3 mesh_tet_center(const Mesh &M, index_t t)
Gets the centroid of a tetrahedron in a mesh.
const vec3 & mesh_vertex_normal(const Mesh &M, index_t v)
Gets a mesh vertex normal by vertex index.
double mesh_enclosed_volume(const Mesh &M)
Computes the volume enclosed by a surfacic mesh.
double mesh_facet_area(const Mesh &M, index_t f, index_t dim=0)
Computes the area of a facet.
vec3 & mesh_vertex_normal_ref(Mesh &M, index_t v)
Gets a mesh vertex normal by vertex index.
vec3 mesh_facet_normal(const Mesh &M, index_t f)
Computes the normal to a mesh facet.
Global Vorpaline namespace.
void simple_Laplacian_smooth(Mesh &M, index_t nb_iter, bool normals_only)
Smoothes a mesh.
double surface_average_edge_length(const Mesh &M)
Computes the average edge length in a surface.
void get_bbox(const Mesh &M, double *xyzmin, double *xyzmax)
Gets the bounding box of a mesh.
void compute_sizing_field(Mesh &M, double gradation=1.0, index_t nb_lfs_samples=0)
Computes a sizing field using an estimate of lfs (local feature size).
double bbox_diagonal(const Mesh &M)
Computes the length of the bounding box diagonal of a mesh.
vecng< 3, Numeric::float64 > vec3
Represents points and vectors in 3d.
void compute_normals(Mesh &M)
Computes the normals to the vertices, and stores them as additional coordinates.
double mesh_cells_volume(const Mesh &M)
Computes the volume of the cells of a mesh.
double mesh_cell_volume(const Mesh &M, index_t c)
Computes the volume of a cell in a mesh.
void normalize_embedding_area(Mesh &M)
Computes vertices weights in such a way that triangle areas are normalized.
geo_index_t index_t
The type for storing and manipulating indices.
void set_anisotropy(Mesh &M, double s)
Normalizes and scales the stored vertex normals by a factor.
void unset_anisotropy(Mesh &M)
Normalizes the stored vertex normals.
geo_coord_index_t coord_index_t
The type for storing coordinate indices, and iterating on the coordinates of a point.
vec3 mesh_cell_facet_normal(const Mesh &M, index_t c, index_t lf)
Computes the normal of a cell facet.