Graphite
Version 3
An experimental 3D geometry processing program
|
Represents a mesh. More...
#include <geogram/mesh/mesh.h>
Public Member Functions | |
Mesh (index_t dimension=3, bool single_precision=false) | |
Mesh constructor. More... | |
virtual | ~Mesh () |
Mesh destructor. | |
void | clear (bool keep_attributes=true, bool keep_memory=false) |
Removes all the elements and attributes of this mesh. More... | |
void | show_stats (const std::string &tag="Mesh") const |
Displays number of vertices, facets and borders. | |
void | assert_is_valid () |
Does some validity checks. More... | |
void | copy (const Mesh &rhs, bool copy_attributes=true, MeshElementsFlags what=MESH_ALL_ELEMENTS) |
Copies a mesh onto this one. More... | |
std::string | get_attributes () const |
Gets the list of all attributes. More... | |
std::string | get_scalar_attributes () const |
Gets the list of all scalar attributes. More... | |
std::string | get_vector_attributes (index_t max_dim=0) const |
Gets the list of all vector attributes. More... | |
index_t | nb_subelements_types () const |
Gets the number of subelements types. More... | |
MeshSubElementsStore & | get_subelements_by_index (index_t i) |
Gets a MeshSubElementsStore by index. More... | |
const MeshSubElementsStore & | get_subelements_by_index (index_t i) const |
Gets a MeshSubElementsStore by index. More... | |
MeshSubElementsStore & | get_subelements_by_type (MeshElementsFlags what) |
Gets a MeshSubElementsStore by subelements type. More... | |
const MeshSubElementsStore & | get_subelements_by_type (MeshElementsFlags what) const |
Gets a MeshSubElementsStore by subelements type. More... | |
Static Public Member Functions | |
static std::string | subelements_type_to_name (MeshElementsFlags what) |
Gets a subelement name by subelement type. More... | |
static MeshElementsFlags | name_to_subelements_type (const std::string &name) |
Gets a subelement type by subelement name. More... | |
static bool | parse_attribute_name (const std::string &full_attribute_name, MeshElementsFlags &where, std::string &attribute_name, index_t &component) |
Extracts localisation, name and optional component from an attribute name. More... | |
Public Attributes | |
MeshVertices | vertices |
MeshEdges | edges |
MeshFacets | facets |
MeshFacetCornersStore | facet_corners |
MeshCells | cells |
MeshCellCornersStore | cell_corners |
MeshCellFacetsStore | cell_facets |
Protected Member Functions | |
void | display_attributes (const std::string &tag, const std::string &subelement_name, const MeshSubElementsStore &subelements) const |
Displays the list of attributes to the Logger. More... | |
Related Functions | |
(Note that these are not member functions.) | |
enum | MeshElementsFlags |
Indicates the mesh elements (vertices, facets or cells) present in a mesh. More... | |
Represents a mesh.
A mesh can have vertices, optionally facets and optionally volumetric cells. Attributes can be attached to all elements and sub-elements.
GEO::Mesh::Mesh | ( | index_t | dimension = 3 , |
bool | single_precision = false |
||
) |
Mesh constructor.
[in] | dimension | dimension of the vertices |
[in] | single_precision | if true, vertices are stored in single precision (float), else they are stored as double precision (double). |
void GEO::Mesh::assert_is_valid | ( | ) |
Does some validity checks.
Used for debugging. If the validity checks are not satisfied, then it crashes with an assertion failure.
void GEO::Mesh::clear | ( | bool | keep_attributes = true , |
bool | keep_memory = false |
||
) |
Removes all the elements and attributes of this mesh.
[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. |
void GEO::Mesh::copy | ( | const Mesh & | rhs, |
bool | copy_attributes = true , |
||
MeshElementsFlags | what = MESH_ALL_ELEMENTS |
||
) |
Copies a mesh onto this one.
[in] | rhs | a const reference to the mesh to be copied |
[in] | copy_attributes | if true, all the attributes are copied. |
[in] | what | a combination of MESH_VERTICES, MESH_EDGES, MESH_FACETS, MESH_CELLS flags. Set to MESH_ALL_ELEMENTS to copy everything (default). If MESH_VERTICES is not set, then the mesh is cleared. |
|
protected |
Displays the list of attributes to the Logger.
[in] | tag | the tag to be sent to the Logger |
[in] | subelement_name | the name of the subelement (vertices, facets, facet_corners ...) |
[in] | subelements | a const reference to the MeshSubElementsStore |
std::string GEO::Mesh::get_attributes | ( | ) | const |
Gets the list of all attributes.
std::string GEO::Mesh::get_scalar_attributes | ( | ) | const |
Gets the list of all scalar attributes.
Whenever there is a vector attribute v of dim d, it appends v[0];v[1];...v[d-1] to the list.
MeshSubElementsStore& GEO::Mesh::get_subelements_by_index | ( | index_t | i | ) |
Gets a MeshSubElementsStore by index.
[in] | i | index of the subelements |
const MeshSubElementsStore& GEO::Mesh::get_subelements_by_index | ( | index_t | i | ) | const |
Gets a MeshSubElementsStore by index.
[in] | i | index of the subelements |
MeshSubElementsStore& GEO::Mesh::get_subelements_by_type | ( | MeshElementsFlags | what | ) |
Gets a MeshSubElementsStore by subelements type.
[in] | what | one of MESH_VERTICES, MESH_EDGES, MESH_FACETS, MESH_FACET_CORNERS, MESH_CELLS, MESH_CELL_CORNERS, MESH_CELL_FACETS |
const MeshSubElementsStore& GEO::Mesh::get_subelements_by_type | ( | MeshElementsFlags | what | ) | const |
Gets a MeshSubElementsStore by subelements type.
[in] | what | one of MESH_VERTICES, MESH_EDGES, MESH_FACETS, MESH_FACET_CORNERS, MESH_CELLS, MESH_CELL_CORNERS, MESH_CELL_FACETS |
std::string GEO::Mesh::get_vector_attributes | ( | index_t | max_dim = 0 | ) | const |
Gets the list of all vector attributes.
[in] | max_dim | if non-zero, only vector attributes of dimension lower than max_dim are returned. |
|
static |
Gets a subelement type by subelement name.
[in] | name | the name of the subelement as a string |
index_t GEO::Mesh::nb_subelements_types | ( | ) | const |
Gets the number of subelements types.
|
static |
Extracts localisation, name and optional component from an attribute name.
[in] | full_attribute_name | for instance, facets.density, or vertices.normal[0] |
[out] | where | one of MESH_VERTICES, MESH_EDGES, MESH_FACETS, MESH_FACET_CORNERS, MESH_CELLS, MESH_CELL_FACETS, MESH_CELL_CORNERS |
[out] | attribute_name | the name of the attribute, without the localisation and without the component |
[out] | component | the component (between square brackets in full_attribute_name ) or 0 if no component was specified |
true | if the attribute name could be parsed |
false | if the attribute name has invalid syntax |
|
static |
Gets a subelement name by subelement type.
[in] | what | one of MESH_VERTICES, MESH_EDGES, MESH_FACETS, MESH_FACET_CORNERS, MESH_CELLS, MESH_CELL_CORNERS, MESH_CELL_FACETS |
|
related |