Easy3D 2.6.1
|
A halfedge data structure for polygonal meshes of 2-manifold. More...
#include <easy3d/core/surface_mesh.h>
Classes | |
class | BaseHandle |
Base class for all topology types (internally it is basically an index). More... | |
struct | Edge |
class | EdgeContainer |
This helper class is a container for iterating through all edges using C++11 range-based for-loops. More... | |
class | EdgeIterator |
This class iterates linearly over all edges. More... | |
class | EdgeProperty |
Edge property of type T. More... | |
struct | Face |
class | FaceAroundVertexCirculator |
struct | FaceConnectivity |
This type stores the face connectivity. More... | |
class | FaceContainer |
This helper class is a container for iterating through all faces using C++11 range-based for-loops. More... | |
class | FaceIterator |
This class iterates linearly over all faces. More... | |
class | FaceProperty |
Face property of type T. More... | |
struct | Halfedge |
This type represents a halfedge (internally it is basically an index). More... | |
class | HalfedgeAroundFaceCirculator |
class | HalfedgeAroundVertexCirculator |
struct | HalfedgeConnectivity |
This type stores the halfedge connectivity. More... | |
class | HalfedgeContainer |
This helper class is a container for iterating through all halfedges using C++11 range-based for-loops. More... | |
class | HalfedgeIterator |
This class iterates linearly over all halfedges. More... | |
class | HalfedgeProperty |
Halfedge property of type T. More... | |
class | ModelProperty |
Mesh property of type T. More... | |
struct | Vertex |
This type represents a vertex (internally it is basically an index). More... | |
class | VertexAroundFaceCirculator |
class | VertexAroundVertexCirculator |
struct | VertexConnectivity |
This type stores the vertex connectivity. More... | |
class | VertexContainer |
This helper class is a container for iterating through all vertices using C++11 range-based for-loops. More... | |
class | VertexIterator |
This class iterates linearly over all vertices. More... | |
class | VertexProperty |
Vertex property of type T. More... | |
Public Member Functions | |
Construct, destruct, assignment | |
SurfaceMesh () | |
Default constructor. Initializes an empty surface mesh. | |
~SurfaceMesh () override=default | |
destructor (is virtual, since we inherit from Geometry_representation) | |
SurfaceMesh (const SurfaceMesh &rhs) | |
copy constructor: copies rhs to *this . performs a deep copy of all properties. | |
SurfaceMesh & | operator= (const SurfaceMesh &rhs) |
assign rhs to *this . performs a deep copy of all properties. | |
SurfaceMesh & | operator+= (const SurfaceMesh &other) |
Merges another surface mesh into the current one. Shifts the indices of vertices of the other mesh by number_of_vertices() + number_of_removed_vertices() and analogously for halfedges, edges, and faces. Copies entries of all property maps which have the same name in both meshes. That is, properties maps which are only in other are ignored. Also copies elements which are marked as removed, and concatenates the freelists of both meshes. | |
SurfaceMesh & | join (const SurfaceMesh &other) |
Merges another surface mesh into the current one. Shifts the indices of vertices of the other mesh by number_of_vertices() + number_of_removed_vertices() and analogously for halfedges, edges, and faces. Copies entries of all property maps which have the same name in both meshes. That is, properties maps which are only in other are ignored. Also copies elements which are marked as removed, and concatenates the freelists of both meshes. | |
SurfaceMesh & | assign (const SurfaceMesh &rhs) |
assign rhs to *this . does not copy custom properties. | |
File IO | |
bool | read (const std::string &filename) |
Read mesh from a SM file filename . Mainly for quick debug purposes. Client code should use SurfaceMeshIO. | |
bool | write (const std::string &filename) const |
Write mesh to a SM file filename . Mainly for quick debug purposes. Client code should use SurfaceMeshIO. | |
Add new elements by hand | |
Vertex | add_vertex (const vec3 &p) |
Adds a new vertex to the mesh. | |
Face | add_face (const std::vector< Vertex > &vertices) |
Adds a new face to the mesh. | |
Face | add_triangle (Vertex v1, Vertex v2, Vertex v3) |
Face | add_quad (Vertex v1, Vertex v2, Vertex v3, Vertex v4) |
Memory Management | |
unsigned int | vertices_size () const |
returns number of (deleted and valid) vertices in the mesh | |
unsigned int | halfedges_size () const |
returns number of (deleted and valid)halfedge in the mesh | |
unsigned int | edges_size () const |
returns number of (deleted and valid)edges in the mesh | |
unsigned int | faces_size () const |
returns number of (deleted and valid)faces in the mesh | |
unsigned int | n_vertices () const |
returns number of vertices in the mesh | |
unsigned int | n_halfedges () const |
returns number of halfedge in the mesh | |
unsigned int | n_edges () const |
returns number of edges in the mesh | |
unsigned int | n_faces () const |
returns number of faces in the mesh | |
void | clear () |
Clears the mesh, removing all vertices, edges, faces, and properties (and resets garbage state). | |
void | reserve (unsigned int n_vertices, unsigned int n_edges, unsigned int n_faces) |
Reserves memory for the given number of vertices, edges, and faces. | |
void | resize (unsigned int nv, unsigned int ne, unsigned int nf) |
bool | has_garbage () const |
are there deleted vertices, edges or faces? | |
void | collect_garbage () |
remove deleted vertices/edges/faces | |
bool | is_deleted (Vertex v) const |
bool | is_deleted (Halfedge h) const |
bool | is_deleted (Edge e) const |
bool | is_deleted (Face f) const |
bool | is_valid (Vertex v) const |
return whether vertex v is valid, i.e. the index is stores it within the array bounds. | |
bool | is_valid (Halfedge h) const |
return whether halfedge h is valid, i.e. the index is stores it within the array bounds. | |
bool | is_valid (Edge e) const |
return whether edge e is valid, i.e. the index is stores it within the array bounds. | |
bool | is_valid (Face f) const |
return whether face f is valid, i.e. the index is stores it within the array bounds. | |
Low-level connectivity | |
Halfedge | out_halfedge (Vertex v) const |
void | set_out_halfedge (Vertex v, Halfedge h) |
set the outgoing halfedge of vertex v to h | |
bool | is_border (Vertex v) const |
returns whether v is a boundary vertex | |
bool | is_isolated (Vertex v) const |
returns whether v is isolated, i.e., not incident to any face | |
bool | is_manifold (Vertex v) const |
returns whether v is a manifold vertex (not incident to several patches) | |
bool | is_degenerate (Face f) const |
returns whether f is degenerate | |
Vertex | target (Halfedge h) const |
returns the vertex the halfedge h points to | |
Vertex | source (Halfedge h) const |
returns the vertex the halfedge h emanates from | |
void | set_target (Halfedge h, Vertex v) |
sets the vertex the halfedge h points to to v | |
Face | face (Halfedge h) const |
returns the face incident to halfedge h | |
void | set_face (Halfedge h, Face f) |
sets the incident face to halfedge h to f | |
Halfedge | next (Halfedge h) const |
returns the next halfedge within the incident face | |
void | set_next (Halfedge h, Halfedge nh) |
sets the next halfedge of h within the face to nh | |
Halfedge | prev (Halfedge h) const |
returns the previous halfedge within the incident face | |
Halfedge | opposite (Halfedge h) const |
returns the opposite halfedge of h | |
Halfedge | prev_around_source (Halfedge h) const |
Halfedge | next_around_source (Halfedge h) const |
Halfedge | prev_around_target (Halfedge h) const |
Halfedge | next_around_target (Halfedge h) const |
Edge | edge (Halfedge h) const |
return the edge that contains halfedge h as one of its two halfedges. | |
bool | is_border (Halfedge h) const |
returns whether h is a boundary halfedge, i.e., if its face does not exist. | |
Halfedge | halfedge (Edge e, unsigned int i) const |
returns the i'th halfedge of edge e . i has to be 0 or 1. | |
Vertex | vertex (Edge e, unsigned int i) const |
returns the i'th vertex of edge e . i has to be 0 or 1. | |
Face | face (Edge e, unsigned int i) const |
returns the face incident to the i'th halfedge of edge e . i has to be 0 or 1. | |
bool | is_border (Edge e) const |
Halfedge | halfedge (Face f) const |
returns a halfedge of face f | |
void | set_halfedge (Face f, Halfedge h) |
sets the halfedge of face f to h | |
bool | is_border (Face f) const |
returns whether f is a boundary face, i.e., it one of its edges is a boundary edge. | |
Property handling | |
template<class T> | |
VertexProperty< T > | add_vertex_property (const std::string &name, const T t=T()) |
Add a vertex property of type T with name name and default value t . | |
template<class T> | |
HalfedgeProperty< T > | add_halfedge_property (const std::string &name, const T t=T()) |
Add a halfedge property of type T with name name and default value t . | |
template<class T> | |
EdgeProperty< T > | add_edge_property (const std::string &name, const T t=T()) |
Add an edge property of type T with name name and default value t . | |
template<class T> | |
FaceProperty< T > | add_face_property (const std::string &name, const T t=T()) |
Add a face property of type T with name name and default value t . | |
template<class T> | |
ModelProperty< T > | add_model_property (const std::string &name, const T t=T()) |
Adds a model property of type T with name name and default value t . | |
template<class T> | |
VertexProperty< T > | get_vertex_property (const std::string &name) const |
Get the vertex property with name name of type T . | |
template<class T> | |
HalfedgeProperty< T > | get_halfedge_property (const std::string &name) const |
Get the halfedge property with name name of type T . | |
template<class T> | |
EdgeProperty< T > | get_edge_property (const std::string &name) const |
Get the edge property with name name of type T . | |
template<class T> | |
FaceProperty< T > | get_face_property (const std::string &name) const |
Get the face property with name name of type T . | |
template<class T> | |
ModelProperty< T > | get_model_property (const std::string &name) const |
Gets the model property named name of type T . | |
template<class T> | |
VertexProperty< T > | vertex_property (const std::string &name, const T t=T()) |
If a vertex property of type T with name name exists, it is returned. Otherwise, this property is added with default value t . | |
template<class T> | |
HalfedgeProperty< T > | halfedge_property (const std::string &name, const T t=T()) |
If a halfedge property of type T with name name exists, it is returned. Otherwise, this property is added with default value t . | |
template<class T> | |
EdgeProperty< T > | edge_property (const std::string &name, const T t=T()) |
If an edge property of type T with name name exists, it is returned. Otherwise, this property is added with default value t . | |
template<class T> | |
FaceProperty< T > | face_property (const std::string &name, const T t=T()) |
If a face property of type T with name name exists, it is returned. Otherwise, this property is added with default value t . | |
template<class T> | |
ModelProperty< T > | model_property (const std::string &name, const T t=T()) |
If a model property of type T with name name exists, it is returned. Otherwise, this property is added with default value t . | |
template<class T> | |
bool | remove_vertex_property (VertexProperty< T > &p) |
Remove the vertex property p . | |
bool | remove_vertex_property (const std::string &n) |
Remove the vertex property named n . | |
template<class T> | |
bool | remove_halfedge_property (HalfedgeProperty< T > &p) |
Remove the halfedge property p . | |
bool | remove_halfedge_property (const std::string &n) |
Remove the halfedge property named n . | |
template<class T> | |
bool | remove_edge_property (EdgeProperty< T > &p) |
Remove the edge property p . | |
bool | remove_edge_property (const std::string &n) |
Remove the edge property named n . | |
template<class T> | |
bool | remove_face_property (FaceProperty< T > &p) |
Remove the face property p . | |
bool | remove_face_property (const std::string &n) |
Remove the face property named n . | |
template<class T> | |
bool | remove_model_property (ModelProperty< T > &p) |
Remove the model property p . | |
bool | remove_model_property (const std::string &n) |
Remove the model property named n . | |
bool | rename_vertex_property (const std::string &old_name, const std::string &new_name) |
Rename a vertex property given its name. | |
bool | rename_face_property (const std::string &old_name, const std::string &new_name) |
Rename a face property given its name. | |
bool | rename_edge_property (const std::string &old_name, const std::string &new_name) |
Rename an edge property given its name. | |
bool | rename_halfedge_property (const std::string &old_name, const std::string &new_name) |
Rename a halfedge property given its name. | |
bool | rename_model_property (const std::string &old_name, const std::string &new_name) |
Rename a model property given its name. | |
const std::type_info & | get_vertex_property_type (const std::string &name) const |
Get the type information of the vertex property name . | |
const std::type_info & | get_halfedge_property_type (const std::string &name) const |
Get the type information of the halfedge property name . | |
const std::type_info & | get_edge_property_type (const std::string &name) const |
Get the type information of the edge property name . | |
const std::type_info & | get_face_property_type (const std::string &name) const |
Get the type information of the face property name . | |
const std::type_info & | get_model_property_type (const std::string &name) const |
Get the type information of the model property name . | |
std::vector< std::string > | vertex_properties () const |
Get the names of all vertex properties. | |
std::vector< std::string > | halfedge_properties () const |
Get the names of all halfedge properties. | |
std::vector< std::string > | edge_properties () const |
Get the names of all edge properties. | |
std::vector< std::string > | face_properties () const |
Get the names of all face properties. | |
std::vector< std::string > | model_properties () const |
Get the names of all model properties. | |
void | property_stats (std::ostream &output) const override |
Prints the names of all properties to an output stream (e.g., std::cout). | |
Iterators & Circulators | |
VertexIterator | vertices_begin () const |
Returns an iterator to the beginning of the vertices. | |
VertexIterator | vertices_end () const |
Returns an iterator to the end of the vertices. | |
VertexContainer | vertices () const |
Returns a container for range-based iteration over vertices. | |
HalfedgeIterator | halfedges_begin () const |
Returns an iterator to the beginning of the halfedges. | |
HalfedgeIterator | halfedges_end () const |
Returns an iterator to the end of the halfedges. | |
HalfedgeContainer | halfedges () const |
Returns a container for range-based iteration over halfedges. | |
EdgeIterator | edges_begin () const |
Returns an iterator to the beginning of the edges. | |
EdgeIterator | edges_end () const |
Returns an iterator to the end of the edges. | |
EdgeContainer | edges () const |
Returns a container for range-based iteration over edges. | |
FaceIterator | faces_begin () const |
Returns an iterator to the beginning of the faces. | |
FaceIterator | faces_end () const |
Returns an iterator to the end of the faces. | |
FaceContainer | faces () const |
Returns a container for range-based iteration over faces. | |
VertexAroundVertexCirculator | vertices (Vertex v) const |
Returns circulator for the vertices around vertex v . | |
HalfedgeAroundVertexCirculator | halfedges (Vertex v) const |
Returns circulator for outgoing halfedges around vertex v . | |
FaceAroundVertexCirculator | faces (Vertex v) const |
Returns circulator for faces around vertex v . | |
VertexAroundFaceCirculator | vertices (Face f) const |
Returns circulator for vertices of face f . | |
HalfedgeAroundFaceCirculator | halfedges (Face f) const |
Returns circulator for halfedges of face f . | |
![]() | |
Model (const std::string &name="unknown") | |
Default constructor. The parameter name is optional, but it is useful for handling multiple models with the same viewer. | |
void | set_name (const std::string &n) |
Sets/Changes the name of a model. Assigning a name to a model is optional, but it is useful for handling multiple models with the same viewer. | |
const std::string & | name () const |
The name of a model. | |
const Box3 & | bounding_box (bool recompute=false) const |
The bounding box of the model. | |
void | invalidate_bounding_box () |
Invalidates the bounding box of the model. So when bounding_box() is called, the bounding box will be re-computed. This function is typically called when the geometry of a model is changed. | |
bool | empty () const |
Tests if the model is empty. | |
void | set_renderer (std::shared_ptr< Renderer > r) |
Sets the renderer of this model. | |
Renderer * | renderer () |
Gets the renderer of this model. | |
const Renderer * | renderer () const |
Gets the constant renderer of this model. | |
void | set_manipulator (std::shared_ptr< Manipulator > manip) |
Attaches a manipulator to this model. | |
Manipulator * | manipulator () |
Gets the manipulator attached to this model. | |
const Manipulator * | manipulator () const |
Gets the manipulator attached to this model. | |
Geometry-related Functions | |
class | SurfaceMeshBuilder |
const vec3 & | position (Vertex v) const |
Returns the position of a vertex. | |
vec3 & | position (Vertex v) |
Returns the position of a vertex. | |
const std::vector< vec3 > & | points () const override |
Returns a read-only vector of all vertex positions. | |
std::vector< vec3 > & | points () override |
Returns a modifiable vector of all vertex positions. | |
void | update_face_normals () |
compute face normals by calling compute_face_normal(Face) for each face. | |
vec3 | compute_face_normal (Face f) const |
Computes the normal vector of face f . This method is robust for concave and general polygonal faces. | |
void | update_vertex_normals () |
compute vertex normals by calling compute_vertex_normal(Vertex) for each vertex. | |
vec3 | compute_vertex_normal (Vertex v) const |
float | edge_length (Edge e) const |
compute the length of edge e . | |
float | edge_length (Halfedge h) const |
compute the length of an edge denoted by one of its halfedge h . | |
Higher-level Topological Operations | |
bool | is_closed () const |
returns whether the mesh closed (i.e., no boundary edges) | |
bool | is_triangle_mesh () const |
bool | is_quad_mesh () const |
void | triangulate () |
void | triangulate (Face f) |
void | reverse_orientation () |
Reverses the orientation of the entire mesh. | |
bool | is_collapse_ok (Halfedge h) const |
void | collapse (Halfedge h) |
Vertex | split (Face f, const vec3 &p) |
void | split (Face f, Vertex v) |
Halfedge | split (Edge e, const vec3 &p) |
Halfedge | split (Edge e, Vertex v) |
bool | join_edges (Vertex v) |
bool | can_join_edges (Vertex v) const |
Halfedge | insert_edge (Halfedge h0, Halfedge h1) |
bool | is_flip_ok (Edge e) const |
void | flip (Edge e) |
bool | is_stitch_ok (Halfedge h0, Halfedge h1) |
void | stitch (Halfedge h0, Halfedge h1) |
Stitch two halfedges h0 and h1. Precondition: h0 and h1 are both on the border and point in reversed directions. | |
unsigned int | valence (Vertex v) const |
unsigned int | valence (Face f) const |
returns the valence of face f (its number of vertices) | |
Halfedge | find_halfedge (Vertex start, Vertex end) const |
find the halfedge from start to end | |
Edge | find_edge (Vertex a, Vertex b) const |
find the edge (a, b) | |
void | delete_vertex (Vertex v) |
void | delete_edge (Edge e) |
void | delete_face (Face f) |
Halfedge | insert_vertex (Edge e, const vec3 &p) |
Halfedge | insert_vertex (Edge e, Vertex v) |
Halfedge | insert_vertex (Halfedge h, Vertex v) |
A halfedge data structure for polygonal meshes of 2-manifold.
A surface mesh is a consistent and orientable polygonal mesh that may have one or more boundaries. The faces are simple polygons and the edges are line segments. Each edge connects two vertices, and is shared by two faces (including the null face for boundary edges). A surface mesh can have any number of connected components and also some self-intersections.
|
inline |
Add an edge property of type T
with name name
and default value t
.
name | The name of the property. |
t | The default value of the property. |
Fails if a property named name
exists already, since the name has to be unique. In this case, it returns an invalid property.
SurfaceMesh::Face add_face | ( | const std::vector< Vertex > & | vertices | ) |
Adds a new face to the mesh.
vertices | The vertices of the new face. Each vertex was created by add_vertex(). |
|
inline |
Add a face property of type T
with name name
and default value t
.
name | The name of the property. |
t | The default value of the property. |
Fails if a property named name
exists already, since the name has to be unique. In this case, it returns an invalid property.
|
inline |
Add a halfedge property of type T
with name name
and default value t
.
name | The name of the property. |
t | The default value of the property. |
Fails if a property named name
exists already, since the name has to be unique. In this case, it returns an invalid property.
|
inline |
Adds a model property of type T
with name name
and default value t
.
name | The name of the property. |
t | The default value of the property. |
Fails if a property named name
exists already, since the name has to be unique. In this case it returns an invalid property. Example:
SurfaceMesh::Face add_quad | ( | Vertex | v1, |
Vertex | v2, | ||
Vertex | v3, | ||
Vertex | v4 ) |
add a new quad connecting vertices v1
, v2
, v3
, v4
{v1,v2,v3,v4} | The input vertices created by add_vertex(). |
SurfaceMesh::Face add_triangle | ( | Vertex | v1, |
Vertex | v2, | ||
Vertex | v3 ) |
add a new triangle connecting vertices v1
, v2
, v3
{v1,v2,v3} | The input vertices created by add_vertex(). |
Adds a new vertex to the mesh.
p | The position of the new vertex. |
|
inline |
Add a vertex property of type T
with name name
and default value t
.
name | The name of the property. |
t | The default value of the property. |
Fails if a property named name
exists already, since the name has to be unique. In this case, it returns an invalid property.
bool can_join_edges | ( | Vertex | v | ) | const |
Check whether the two incident edges of a vertex can be joined. It only allows for vertices of valence two.
void clear | ( | ) |
Clears the mesh, removing all vertices, edges, faces, and properties (and resets garbage state).
After calling this method, the mesh is the same as newly constructed. The additional properties (such as normal vectors) are also removed and must thus be re-added if needed.
void collapse | ( | Halfedge | h | ) |
Collapse the halfedge h
by moving its start vertex into its target vertex. For non-boundary halfedges this function removes one vertex, three edges, and two faces. For boundary halfedges it removes one vertex, two edges and one face.
Computes the normal vector of face f
. This method is robust for concave and general polygonal faces.
f | The Face. |
compute normal vector of vertex v
. This is the angle-weighted average of incident face normals.
void delete_edge | ( | Edge | e | ) |
deletes the edge e
from the mesh. Its incident faces will also be deleted.
void delete_face | ( | Face | f | ) |
deletes the face f
from the mesh. Its incident edges (if on boundary) will also be deleted.
void delete_vertex | ( | Vertex | v | ) |
deletes the vertex v
from the mesh. Its incident edges and faces will also be deleted.
|
inline |
Get the names of all edge properties.
|
inline |
If an edge property of type T
with name name
exists, it is returned. Otherwise, this property is added with default value t
.
name | The name of the property to get. |
t | The default value of the property. |
t
and returned.
|
inline |
Returns a container for range-based iteration over edges.
|
inline |
Returns an iterator to the beginning of the edges.
|
inline |
Returns an iterator to the end of the edges.
|
inline |
Get the names of all face properties.
|
inline |
If a face property of type T
with name name
exists, it is returned. Otherwise, this property is added with default value t
.
name | The name of the property to get. |
t | The default value of the property. |
t
and returned.
|
inline |
Returns a container for range-based iteration over faces.
|
inline |
Returns circulator for faces around vertex v
.
v | The vertex. |
|
inline |
Returns an iterator to the beginning of the faces.
|
inline |
Returns an iterator to the end of the faces.
void flip | ( | Edge | e | ) |
Flip edge e:
Remove edge e
and add an edge between the two vertices opposite to edge e
of the two incident triangles.
|
inline |
Get the edge property with name name
of type T
.
name | The name of the property to get. |
|
inline |
Get the type information of the edge property name
.
name | The name of the property. |
typeid(void)
if the property does not exist.
|
inline |
Get the face property with name name
of type T
.
name | The name of the property to get. |
|
inline |
Get the type information of the face property name
.
name | The name of the property. |
typeid(void)
if the property does not exist.
|
inline |
Get the halfedge property with name name
of type T
.
name | The name of the property to get. |
|
inline |
Get the type information of the halfedge property name
.
name | The name of the property. |
typeid(void)
if the property does not exist.
|
inline |
Gets the model property named name
of type T
.
name | The name of the property to get. |
|
inline |
Get the type information of the model property name
.
name | The name of the property. |
typeid(void)
if the property does not exist.
|
inline |
Get the vertex property with name name
of type T
.
name | The name of the property to get. |
|
inline |
Get the type information of the vertex property name
.
name | The name of the property. |
typeid(void)
if the property does not exist.
|
inline |
Get the names of all halfedge properties.
|
inline |
If a halfedge property of type T
with name name
exists, it is returned. Otherwise, this property is added with default value t
.
name | The name of the property to get. |
t | The default value of the property. |
t
and returned.
|
inline |
Returns a container for range-based iteration over halfedges.
|
inline |
Returns circulator for halfedges of face f
.
f | The face. |
|
inline |
Returns circulator for outgoing halfedges around vertex v
.
v | The vertex. |
|
inline |
Returns an iterator to the beginning of the halfedges.
|
inline |
Returns an iterator to the end of the halfedges.
SurfaceMesh::Halfedge insert_edge | ( | Halfedge | h0, |
Halfedge | h1 ) |
insert edge between the to-vertices v0 of h0 and v1 of h1. returns the new halfedge from v0 to v1.
|
inline |
returns whether e
is a boundary edge, i.e., if one of its halfedges is a boundary halfedge.
bool is_collapse_ok | ( | Halfedge | h | ) | const |
returns whether collapsing the halfedge h
is topologically legal.
|
inline |
returns whether edge e
is deleted
|
inline |
returns whether face f
is deleted
|
inline |
returns whether halfedge h
is deleted
|
inline |
returns whether vertex v
is deleted
bool is_flip_ok | ( | Edge | e | ) | const |
Check whether flipping edge e
is topologically allowed.
bool is_quad_mesh | ( | ) | const |
returns whether the mesh a quad mesh. this function simply tests each face, and therefore is not very efficient.
Check whether stitching two halfedges h0
an h1
is topologically allowed. Two halfedges can be stitched if they are both on on the border and point in reverse directions.
bool is_triangle_mesh | ( | ) | const |
returns whether the mesh a triangle mesh. this function simply tests each face, and therefore is not very efficient.
bool join_edges | ( | Vertex | v | ) |
Merges the two incident edges of a 2-degree vertex. This is the reverse operation of insert_vertex().
|
inline |
Get the names of all model properties.
|
inline |
If a model property of type T
with name name
exists, it is returned. Otherwise, this property is added with default value t
.
name | The name of the property to get. |
t | The default value of the property. |
t
and returned. returns the halfedge that is rotated clockwise around the start vertex of h
. it is the next halfedge of the opposite halfedge of h
.
returns the halfedge that is rotated clockwise around the end vertex of h
. it is the opposite halfedge of the next halfedge of h
.
returns an outgoing halfedge of vertex v
. if v
is a boundary vertex this will be a boundary halfedge.
|
inlineoverridevirtual |
Returns a read-only vector of all vertex positions.
Implements Model.
|
inlineoverridevirtual |
Returns a modifiable vector of all vertex positions.
Implements Model.
Returns the position of a vertex.
v | The vertex. |
Returns the position of a vertex.
v | The vertex. |
returns the halfedge that is rotated counter-clockwise around the start vertex of h
. it is the opposite halfedge of the previous halfedge of h
.
returns the halfedge that is rotated counter-clockwise around the end vertex of h
. it is the prev halfedge of the opposite halfedge of h
.
|
overridevirtual |
Prints the names of all properties to an output stream (e.g., std::cout).
output | The output stream. |
Reimplemented from Model.
bool read | ( | const std::string & | filename | ) |
Read mesh from a SM file filename
. Mainly for quick debug purposes. Client code should use SurfaceMeshIO.
|
inline |
Remove the edge property named n
.
n | The name of the property to remove. |
|
inline |
Remove the edge property p
.
p | The property to remove. |
|
inline |
Remove the face property named n
.
n | The name of the property to remove. |
|
inline |
Remove the face property p
.
p | The property to remove. |
|
inline |
Remove the halfedge property named n
.
n | The name of the property to remove. |
|
inline |
Remove the halfedge property p
.
p | The property to remove. |
|
inline |
Remove the model property named n
.
n | The name of the property to remove. |
|
inline |
Remove the model property p
.
p | The property to remove. |
|
inline |
Remove the vertex property named n
.
n | The name of the property to remove. |
|
inline |
Remove the vertex property p
.
p | The property to remove. |
|
inline |
Rename an edge property given its name.
old_name | The old name of the property. |
new_name | The new name of the property. |
|
inline |
Rename a face property given its name.
old_name | The old name of the property. |
new_name | The new name of the property. |
|
inline |
Rename a halfedge property given its name.
old_name | The old name of the property. |
new_name | The new name of the property. |
|
inline |
Rename a model property given its name.
old_name | The old name of the property. |
new_name | The new name of the property. |
|
inline |
Rename a vertex property given its name.
old_name | The old name of the property. |
new_name | The new name of the property. |
void reserve | ( | unsigned int | n_vertices, |
unsigned int | n_edges, | ||
unsigned int | n_faces ) |
Reserves memory for the given number of vertices, edges, and faces.
n_vertices | The number of vertices to reserve. |
n_edges | The number of edges to reserve. |
n_faces | The number of faces to reserve. |
|
inline |
resizes space for vertices, halfedges, edges, faces, and their currently associated properties. Note: ne is the number of edges. for halfedges, nh = 2 * ne. */
void reverse_orientation | ( | ) |
Reverses the orientation of the entire mesh.
This function reverses for each face the order of the vertices along the face boundary. As a consequence, the normal computed for each face using compute_face_normal() is also reversed.
Split the edge e
by first adding point p
to the mesh and then connecting it to the two vertices of the adjacent triangles that are opposite to edge e
. Returns the halfedge pointing to p
that is created by splitting the existing edge e
.
SurfaceMesh::Halfedge split | ( | Edge | e, |
Vertex | v ) |
Split the edge e
by connecting vertex v
it to the two vertices of the adjacent triangles that are opposite to edge e
. Returns the halfedge pointing to p
that is created by splitting the existing edge e
.
Split the face f
by first adding point p
to the mesh and then inserting edges between p
and the vertices of f
. For a triangle this is a standard one-to-three split.
Split the face f
by inserting edges between v
and the vertices of f
. For a triangle this is a standard one-to-three split.
Stitch two halfedges h0 and h1. Precondition: h0 and h1 are both on the border and point in reversed directions.
void triangulate | ( | ) |
triangulate the entire mesh, by calling triangulate(Face) for each face.
void triangulate | ( | Face | f | ) |
triangulate the face f
unsigned int valence | ( | Vertex | v | ) | const |
returns the valence (number of incident edges or neighboring vertices) of vertex v
.
|
inline |
Get the names of all vertex properties.
|
inline |
If a vertex property of type T
with name name
exists, it is returned. Otherwise, this property is added with default value t
.
name | The name of the property to get. |
t | The default value of the property. |
t
and returned.
|
inline |
Returns a container for range-based iteration over vertices.
|
inline |
Returns circulator for vertices of face f
.
f | The face. |
|
inline |
Returns circulator for the vertices around vertex v
.
v | The vertex. |
|
inline |
Returns an iterator to the beginning of the vertices.
|
inline |
Returns an iterator to the end of the vertices.
bool write | ( | const std::string & | filename | ) | const |
Write mesh to a SM file filename
. Mainly for quick debug purposes. Client code should use SurfaceMeshIO.
Subdivide the edge e
= (v0,v1) by splitting it into the two edge (v0,p) and (p,v1). Note that this function does not introduce any other edge or faces. It simply splits the edge. Returns halfedge that points to p
.
Subdivide the edge e
= (v0,v1) by splitting it into the two edge (v0,v) and (v,v1). Note that this function does not introduce any other edge or faces. It simply splits the edge. Returns halfedge that points to v
.
|
Subdivide the edge e
= (v0,v1) by splitting it into the two edge (v0,v) and (v,v1). Note that this function does not introduce any other edge or faces. It simply splits the edge. Returns halfedge that points to v
.