40 #ifndef GEOGRAM_MESH_MESH_HALFEDGES
41 #define GEOGRAM_MESH_MESH_HALFEDGES
101 return (facet == NO_FACET) && (corner == NO_CORNER);
111 return facet == rhs.facet && corner == rhs.corner;
121 return !(rhs == *
this);
160 if(!facet_region_.is_bound()) {
161 facet_region_.bind(mesh_.facets.attributes(),
"region");
164 if(facet_region_.is_bound()) {
165 facet_region_.unbind();
176 if(facet_region_.is_bound()) {
177 facet_region_.unbind();
179 facet_region_.bind(mesh_.facets.attributes(),attribute_name);
190 set_use_facet_region(std::string(attribute_name));
205 H.facet != Halfedge::NO_FACET &&
206 H.corner != Halfedge::NO_CORNER &&
207 H.facet < mesh_.facets.nb() &&
208 H.corner < mesh_.facet_corners.nb()
222 if(facet_region_.is_bound()) {
225 mesh_.facet_corners.adjacent_facet(H.corner);
228 facet_region_[f] != facet_region_[adj_f]
231 return mesh_.facet_corners.adjacent_facet(H.corner) == NO_FACET;
240 H.corner = mesh_.facets.next_corner_around_facet(H.facet, H.corner);
249 H.corner = mesh_.facets.prev_corner_around_facet(H.facet, H.corner);
305 inline std::ostream& operator<< (
308 return out <<
'(' << H.facet <<
',' << H.corner <<
')';
#define geo_debug_assert(x)
Verifies that a condition is met.
index_t next_corner_around_facet(index_t f, index_t c) const
Gets the successor of a corner around a facet.
Exposes a half-edge like API for traversing a Mesh.
bool halfedge_is_border(const Halfedge &H) const
Tests whether a Halfedge is on the boder.
void set_use_facet_region(const std::string &attribute_name)
Sets a facet attribute name that determines borders.
void set_use_facet_region(bool x)
Sets whether facet regions determine borders.
bool move_to_next_around_vertex(Halfedge &H) const
Replaces a Halfedge with the next one around the vertex.
void move_to_prev_around_border(Halfedge &H) const
Replaces a Halfedge with the previous one around the border.
Mesh & mesh()
Gets the mesh.
const Mesh & mesh() const
Gets the mesh.
bool move_to_prev_around_vertex(Halfedge &H) const
Replaces a Halfedge with the previous one around the vertex.
MeshHalfedges(Mesh &mesh)
Creates a new MeshHalfedges.
void move_to_next_around_border(Halfedge &H) const
Replaces a Halfedge with the next one around the border.
void move_to_next_around_facet(Halfedge &H) const
Replaces a Halfedge with the next one around the facet.
bool halfedge_is_valid(const Halfedge &H) const
Tests whether a Halfedge is valid.
void move_to_opposite(Halfedge &H) const
Replaces a Halfedge with the opposite one in the adjacent facet.
void set_use_facet_region(const char *attribute_name)
Sets a facet attribute name that determines borders.
void move_to_prev_around_facet(Halfedge &H) const
Replaces a Halfedge with the previous one around the facet.
Common include file, providing basic definitions. Should be included before anything else by all head...
The class that represents a mesh.
Functions for accessing the geometry in a mesh.
const vec3 & halfedge_vertex_to(const Mesh &M, const MeshHalfedges::Halfedge &H)
Gets the arrow extremity point of a Halfedge.
const vec3 & halfedge_vertex_from(const Mesh &M, const MeshHalfedges::Halfedge &H)
Gets the origin point of a Halfedge.
double edge_length(const Mesh &M, const MeshHalfedges::Halfedge &H)
Gets the length of a Halfedge.
vec3 halfedge_vector(const Mesh &M, const MeshHalfedges::Halfedge &H)
Gets a 3d vector that connects the origin with the arrow extremity of a Halfedge.
const vec3 & mesh_vertex(const Mesh &M, index_t v)
Gets a mesh vertex by its index.
bool operator!=(const aligned_allocator< T1, A1 > &, const aligned_allocator< T2, A2 > &)
Tests whether two aligned_allocators are different.
bool operator==(const aligned_allocator< T1, A1 > &, const aligned_allocator< T2, A2 > &)
Tests whether two aligned_allocators are equal.
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.
Stores a reference to a mesh corner and facet, and provides a halfedge-like API.
void clear()
Clears this Halfedge.
Halfedge(index_t f, index_t c)
Constructs a new Halfedge from a facet and corner index.
Halfedge()
Constructs a new uninitialized Halfedge.
bool is_nil() const
Tests whether this Halfedge is initialized.