Geogram
Version 1.9.1
A programming library of geometric algorithms
|
The facets of a mesh. More...
#include <geogram/mesh/mesh.h>
Public Member Functions | |
MeshFacets (Mesh &mesh) | |
MeshFacets constructor. More... | |
index_t | nb_vertices (index_t f) const |
Gets the number of vertices of a facet. More... | |
index_t | vertex (index_t f, index_t lv) const |
Gets a vertex by facet and local vertex index. More... | |
void | set_vertex (index_t f, index_t lv, index_t v) |
Sets a vertex by facet and local vertex index. More... | |
index_t | find_vertex (index_t f, index_t v) const |
Gets the local index of a vertex in a facet. More... | |
index_t | find_common_vertex (index_t f1, index_t f2) const |
finds a common vertex shared by two facets More... | |
index_t | adjacent (index_t f, index_t le) const |
Gets an adjacent facet by facet and local edge index. More... | |
index_t | find_adjacent (index_t f, index_t f2) const |
Gets the local index of a facet adjacent to another one. More... | |
void | set_adjacent (index_t f, index_t le, index_t f2) |
Sets an adjacent facet by facet and local edge index. More... | |
index_t | next_corner_around_facet (index_t f, index_t c) const |
Gets the successor of a corner around a facet. More... | |
index_t | prev_corner_around_facet (index_t f, index_t c) const |
Gets the predecessor of a corner around a facet. More... | |
index_t | find_edge (index_t f, index_t v1, index_t v2) |
Finds an edge by vertex indices. More... | |
void | delete_elements (vector< index_t > &to_delete, bool remove_isolated_vertices=true) override |
Deletes a set of elements. More... | |
void | permute_elements (vector< index_t > &permutation) override |
Applies a permutation to the elements and their attributes. More... | |
void | clear (bool keep_attributes=true, bool keep_memory=false) override |
Removes all the elements and attributes. More... | |
index_t | create_facets (index_t nb_facets, index_t nb_vertices_per_polygon) |
Creates a contiguous chunk of facets. More... | |
void | reserve (index_t nb_to_reserve) |
Reserves space for new facets. More... | |
index_t | create_triangles (index_t nb_triangles) |
Creates a contiguous chunk of triangles. More... | |
index_t | create_quads (index_t nb_quads) |
Creates a contiguous chunk of quads. More... | |
index_t | create_triangle (index_t v1, index_t v2, index_t v3) |
Creates a triangle. More... | |
index_t | create_quad (index_t v1, index_t v2, index_t v3, index_t v4) |
Creates a quad. More... | |
index_t | create_polygon (index_t nb_vertices) |
Creates a polygonal facet. More... | |
index_t | create_polygon (index_t nb_vertices, const index_t *vertices) |
Creates a polygonal facet. More... | |
index_t | create_polygon (const vector< index_t > &vertices) |
Creates a polygonal facet. More... | |
void | connect () |
Connects the facets. More... | |
void | connect (index_t facets_begin, index_t facets_end) |
Connects a contiguous sequence of facets. More... | |
void | triangulate () |
Triangulates the facets. More... | |
void | flip (index_t f) |
Flips a facet. More... | |
void | compute_borders () |
Replaces the edges of this mesh with the borders of the surfacic part. | |
void | assign_triangle_mesh (coord_index_t dim, vector< double > &vertices, vector< index_t > &triangles, bool steal_args) |
Copies a triangle mesh into this Mesh. More... | |
void | assign_triangle_mesh (vector< index_t > &triangles, bool steal_args) |
void | pop () override |
Removes the last element. | |
index_range | corners (index_t f) const |
Gets the corners of a facet. More... | |
Public Member Functions inherited from GEO::MeshFacetsStore | |
MeshFacetsStore (Mesh &mesh) | |
index_t | corners_begin (index_t f) const |
Gets the first element for iterating over the corners of a facet. More... | |
index_t | corners_end (index_t f) const |
Gets the upper limit for iterating over the corners of a facet. More... | |
index_t | nb_corners (index_t f) const |
Gets the number of corners in a facet. More... | |
index_t | corner (index_t f, index_t lv) const |
Gets a corner by facet and local vertex index. More... | |
bool | are_simplices () const |
Tests whether all the facets are triangles. More... | |
const index_t * | corners_begin_ptr (index_t f) const |
Gets a pointer to the first element for iterating over the corners of a facet. More... | |
Public Member Functions inherited from GEO::MeshSubElementsStore | |
MeshSubElementsStore (Mesh &mesh) | |
Constructs a new MeshSubElementStore. More... | |
virtual | ~MeshSubElementsStore () |
MeshElementStore destructor. | |
index_t | nb () const |
Gets the number of (sub-)elements. More... | |
AttributesManager & | attributes () const |
Gets the attributes manager. More... | |
index_as_iterator | begin () const |
Used by range-based for. More... | |
index_as_iterator | end () const |
Used by range-based for. More... | |
Protected Member Functions | |
void | is_simplicial () |
Indicates that the stored elements are only triangles. | |
void | is_not_simplicial () |
Indicates that the stored elements are no longer only triangles. More... | |
Protected Member Functions inherited from GEO::MeshFacetsStore | |
void | clear_store (bool keep_attributes, bool keep_memory=false) override |
Removes all the elements and attributes. More... | |
void | resize_store (index_t new_size) override |
Resizes this MeshSubElementsStore. More... | |
index_t | create_sub_element () |
index_t | create_sub_elements (index_t nb) |
void | copy (const MeshFacetsStore &rhs, bool copy_attributes=true) |
Protected Member Functions inherited from GEO::MeshSubElementsStore | |
void | reserve_store (index_t nb_to_reserve) |
Reserves space for new elements. More... | |
index_t | create_sub_elements (index_t nb) |
Creates a contiguous chunk of attributes for sub-elements. More... | |
index_t | create_sub_element () |
Creates attributes for a sub-element. More... | |
void | adjust_store () |
Makes the size of the store tightly match the number of the elements. More... | |
void | copy (const MeshSubElementsStore &rhs, bool copy_attributes=true) |
Copies a MeshSubElementsStore into this one. More... | |
Protected Attributes | |
MeshVertices & | vertices_ |
MeshFacetCornersStore & | facet_corners_ |
Protected Attributes inherited from GEO::MeshFacetsStore | |
bool | is_simplicial_ |
vector< index_t > | facet_ptr_ |
Protected Attributes inherited from GEO::MeshSubElementsStore | |
Mesh & | mesh_ |
AttributesManager | attributes_ |
index_t | nb_ |
Friends | |
class | Mesh |
class | GeogramIOHandler |
void | tessellate_facets (Mesh &M, index_t max_nb_vertices) |
Subdivides the facets with more than nb_vertices. More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from GEO::MeshElements | |
static bool | has_non_zero (const GEO::vector< index_t > &I) |
Tests whether a vector contains a non-zero value. More... | |
GEO::MeshFacets::MeshFacets | ( | Mesh & | mesh | ) |
MeshFacets constructor.
[in] | mesh | a reference to the mesh this MeshFacets is attached to |
void GEO::MeshFacets::assign_triangle_mesh | ( | coord_index_t | dim, |
vector< double > & | vertices, | ||
vector< index_t > & | triangles, | ||
bool | steal_args | ||
) |
Copies a triangle mesh into this Mesh.
Facet adjacence are not computed. Facet and corner attributes are zeroed.
[in] | dim | dimension of the vertices |
[in] | vertices | coordinates of the vertices |
[in] | triangles | facet to vertex links |
[in] | steal_args | if set, vertices and triangles are 'stolen' from the arguments (using vector::swap). |
|
overridevirtual |
Removes all the elements and attributes.
[in] | keep_attributes | if true, then all the existing attribute names / bindings are kept (but they are cleared). If false, they are destroyed. |
[in] | keep_memory | if true, then memory is kept and can be reused by subsequent mesh element creations. |
Implements GEO::MeshElements.
void GEO::MeshFacets::connect | ( | ) |
Connects the facets.
Finds the adjacent_facet() links based on vertex indices
Connects a contiguous sequence of facets.
Finds the adjacent_facet() links based on vertex indices
[in] | facets_begin | first facet to connect |
[in] | facets_end | one position past the last facet to connect |
|
inline |
|
overridevirtual |
Deletes a set of elements.
[in] | to_delete | a vector of size nb(). If to_delete[e] is different from 0, then element e will be destroyed, else it will be kept. On exit, to_delete is modified (it is used for internal bookkeeping). |
[in] | remove_isolated_vertices | if true, then the vertices that are no longer incident to any element are deleted. |
Implements GEO::MeshElements.
void GEO::MeshFacets::flip | ( | index_t | f | ) |
Flips a facet.
The order of the corners is reversed
[in] | f | the facet to be flipped |
|
inlineprotected |
Applies a permutation to the elements and their attributes.
On exit, permutation is modified (used for internal bookkeeping). Applying a permutation permutation
is equivalent to:
Implements GEO::MeshElements.
|
inline |
void GEO::MeshFacets::triangulate | ( | ) |
Triangulates the facets.
Subdivides the facets with more than nb_vertices.
[in] | M | a reference to a surface mesh. |
[in] | max_nb_vertices | maximum number of vertices in a facet. |