|
Wildmeshing Toolkit
|
Classes | |
| class | SmartTuple |
| class | TriangleConnectivity |
| class | Tuple |
| class | VertexConnectivity |
| class | VertexMutex |
Public Types | |
| template<typename T > | |
| using | vector = tbb::concurrent_vector< T > |
Public Member Functions | |
| void | init (size_t n_vertices, const std::vector< std::array< size_t, 3 > > &tris) |
| void | init (const MatrixXi &F) |
| Generate the connectivity of the mesh from an IGL-style F matrix. | |
| std::vector< Tuple > | get_vertices () const |
| std::vector< Tuple > | get_edges () const |
| std::vector< Tuple > | get_faces () const |
| Tuple | tuple_from_edge (size_t vid1, size_t vid2, size_t fid) const |
| Tuple | tuple_from_vids (size_t vid0, size_t vid1, size_t vid2) const |
| simplex::Vertex | simplex_from_vertex (const Tuple &t) const |
| simplex::Edge | simplex_from_edge (const Tuple &t) const |
| simplex::Face | simplex_from_face (const Tuple &t) const |
| simplex::Face | simplex_from_face (const size_t fid) const |
| Tuple | tuple_from_simplex (const simplex::Face &s) const |
| simplex::RawSimplexCollection | simplex_incident_triangles (const simplex::Vertex &v) const |
| simplex::RawSimplexCollection | simplex_incident_triangles (const simplex::Edge &e) const |
| simplex::RawSimplexCollection | simplex_link_vertices (const simplex::Vertex &v) const |
| simplex::RawSimplexCollection | simplex_link_vertices (const simplex::Edge &e) const |
| simplex::RawSimplexCollection | simplex_link_edges (const simplex::Vertex &v) const |
| virtual bool | invariants (const std::vector< Tuple > &) |
| User specified invariants that can't be violated. | |
| virtual bool | split_edge_before (const Tuple &t) |
| User specified preparations and desideratas for an edge split. | |
| virtual bool | split_edge_after (const Tuple &t) |
| User specified modifications and desideratas after an edge split. | |
| virtual bool | collapse_edge_before (const Tuple &t) |
| User specified preparations and desideratas for an edge collapse including the link check as collapse prerequisite. | |
| virtual bool | collapse_edge_after (const Tuple &t) |
| User specified modifications and desideratas after an edge collapse. | |
| virtual bool | swap_edge_after (const Tuple &t) |
| User specified modifications and desideras after an edge swap. | |
| virtual bool | swap_edge_before (const Tuple &t) |
| User specified preparations and desideratas for an edge swap including 1.can't swap on boundary edge. 2. when swap edge between v1, v2, there can't exist edges between the two opposite vertices v3, v4. | |
| virtual bool | smooth_before (const Tuple &t) |
| User specified preparations and desideratas for an edge smooth. | |
| virtual bool | smooth_after (const Tuple &t) |
| User specified modifications and desideras after an edge smooth. | |
| virtual bool | split_face_before (const Tuple &t) |
| User specified preparations and desideratas for a face split. | |
| virtual bool | split_face_after (const Tuple &t) |
| User specified modifications and desideratas after a face split. | |
| size_t | tri_capacity () const |
| get the current largest global fid | |
| size_t | vert_capacity () const |
| get the current largest global vid | |
| void | consolidate_mesh () |
| removing the elements that are removed | |
| Tuple | switch_vertex (const Tuple &t) const |
| a duplicate of Tuple::switch_vertex funciton | |
| Tuple | switch_edge (const Tuple &t) const |
| a duplicate of Tuple::switch_edge funciton | |
| std::optional< Tuple > | switch_face (const Tuple &t) const |
| a duplicate of Tuple::switch_face funciton | |
| bool | check_link_condition (const Tuple &t) const |
| prerequisite for collapse | |
| bool | check_mesh_connectivity_validity () const |
| verify the connectivity validity of the mesh | |
| bool | check_edge_manifold () const |
| verify the edge manifoldness of the mesh | |
| bool | is_boundary_edge (const TriMesh::Tuple &t) const |
| check if edge that's represented by a Tuple is at the boundary of the mesh | |
| bool | is_boundary_vertex (const TriMesh::Tuple &t) const |
| check if the vertex that's represented by a Tuple is at the boundary of the mesh | |
| bool | split_edge (const Tuple &t, std::vector< Tuple > &new_t) |
| virtual bool | collapse_edge (const Tuple &t, std::vector< Tuple > &new_t) |
| void | collapse_edge_conn (const Tuple &loc0, std::vector< Tuple > &new_tris, Tuple &return_t, size_t &new_vid, std::vector< std::pair< size_t, TriangleConnectivity > > &old_tris, std::vector< std::pair< size_t, VertexConnectivity > > &old_vertices, std::vector< std::pair< size_t, size_t > > &same_edge_vid_fid, std::vector< size_t > &n12_intersect_fids) |
| void | collapse_edge_rollback (size_t &new_vid, std::vector< std::pair< size_t, TriangleConnectivity > > &old_tris, std::vector< std::pair< size_t, VertexConnectivity > > &old_vertices, std::vector< std::pair< size_t, size_t > > &same_edge_vid_fid, std::vector< size_t > &n12_intersect_fids) |
| bool | swap_edge (const Tuple &t, std::vector< Tuple > &new_t) |
| bool | smooth_vertex (const Tuple &t) |
| bool | split_face (const Tuple &t, std::vector< Tuple > &new_t) |
| Split a face in 3 faces. | |
| size_t | get_valence_for_vertex (const Tuple &t) const |
| Count the number of the one ring tris for a vertex. | |
| std::vector< Tuple > | get_one_ring_tris_for_vertex (const Tuple &t) const |
| Get the one ring tris for a vertex. | |
| const std::vector< size_t > & | get_one_ring_fids_for_vertex (const Tuple &t) const |
| const std::vector< size_t > & | get_one_ring_fids_for_vertex (const size_t vid) const |
| std::vector< size_t > | get_one_ring_vids_for_vertex_duplicate (const size_t &t) const |
| Get the vids of the incident one ring tris for a vertex. | |
| std::vector< size_t > | get_incident_fids_for_edge (const Tuple &t) const |
| std::vector< size_t > | get_incident_fids_for_edge (const size_t vid0, const size_t vid1) const |
| std::vector< Tuple > | get_one_ring_edges_for_vertex (const Tuple &t) const |
Get all edges that are incident to the vertex of Tuple t. | |
| std::vector< Tuple > | get_one_ring_edges_for_vertex (const size_t vid) const |
| std::array< Tuple, 3 > | oriented_tri_vertices (const Tuple &t) const |
| Get the incident vertices for a triangle. | |
| std::array< size_t, 3 > | oriented_tri_vids (const Tuple &t) const |
| Get the incident vertices for a triangle. | |
| std::array< size_t, 3 > | oriented_tri_vids (const size_t i) const |
| std::array< Tuple, 2 > | get_edge_vertices (const Tuple &t) const |
| std::array< size_t, 2 > | get_edge_vids (const Tuple &t) const |
| Tuple | tuple_from_tri (size_t fid) const |
| Tuple | tuple_from_vertex (size_t vid) const |
| Tuple | tuple_from_edge (size_t fid, size_t local_eid) const |
| std::tuple< Tuple, size_t > | tuple_from_edge (const std::array< size_t, 2 > &vids) const |
| void | start_protect_attributes () |
| Start the phase where the attributes that will be modified can be recorded. | |
| void | release_protect_attributes () |
| End the modification phase. | |
| void | rollback_protected_attributes () |
| rollback the attributes that are modified if any condition failed | |
| int | release_vertex_mutex_in_stack () |
| bool | try_set_vertex_mutex_two_ring (const Tuple &v, int threadid) |
| try lock the two-ring neighboring triangles' incident vertices | |
| bool | try_set_edge_mutex_two_ring (const Tuple &e, int threadid) |
| try lock the two-ring neighboring triangles' incident vertices for the two ends of an edge | |
| bool | try_set_vertex_mutex_one_ring (const Tuple &v, int threadid) |
| get the lock for one ring neighboring triangles' incident vertices | |
| bool | try_set_face_mutex_one_ring (const Tuple &f, int threadid) |
| try lock the one-ring neighboring triangles' incident vertices. | |
| void | for_each_face (const std::function< void(const Tuple &)> &) |
| perform the given function for each face | |
| void | for_each_edge (const std::function< void(const Tuple &)> &) |
| perform the given function for each edge | |
| void | for_each_vertex (const std::function< void(const Tuple &)> &) |
| perform the given function for each vertex | |
Public Attributes | |
| AbstractAttributeContainer * | p_vertex_attrs = nullptr |
| AbstractAttributeContainer * | p_edge_attrs = nullptr |
| AbstractAttributeContainer * | p_face_attrs = nullptr |
| tbb::enumerable_thread_specific< std::vector< size_t > > | mutex_release_stack |
| int | NUM_THREADS = 0 |
Protected Member Functions | |
| void | resize_mutex (size_t v) |
Private Member Functions | |
| size_t | get_next_empty_slot_t () |
| Get the next avaiblie global index for the triangle. | |
| size_t | get_next_empty_slot_v () |
| Get the next avaiblie global index for the vertex. | |
| bool | try_set_vertex_mutex (const Tuple &v, int threadid) |
| bool | try_set_vertex_mutex (size_t vid, int threadid) |
| void | unlock_vertex_mutex (const Tuple &v) |
| void | unlock_vertex_mutex (size_t vid) |
Private Attributes | |
| vector< VertexConnectivity > | m_vertex_connectivity |
| vector< TriangleConnectivity > | m_tri_connectivity |
| std::atomic_long | current_vert_size |
| std::atomic_long | current_tri_size |
| tbb::spin_mutex | vertex_connectivity_lock |
| tbb::spin_mutex | tri_connectivity_lock |
| bool | vertex_connectivity_synchronizing_flag = false |
| bool | tri_connectivity_synchronizing_flag = false |
| int | MAX_THREADS = 128 |
| tbb::concurrent_vector< VertexMutex > | m_vertex_mutex |
| bool wmtk::TriMesh::check_link_condition | ( | const Tuple & | t | ) | const |
prerequisite for collapse
| t | Tuple referes to the edge to be collapsed |
| bool wmtk::TriMesh::check_mesh_connectivity_validity | ( | ) | const |
verify the connectivity validity of the mesh
Collapse an edge
| t | Input Tuple for the edge to be collapsed. | |
| [out] | new_edges | a vector of Tuples refering to the triangles incident to the new vertex introduced |
|
inlinevirtual |
User specified modifications and desideratas after an edge collapse.
| the | edge Tuple to be collapsed |
|
inlinevirtual |
User specified preparations and desideratas for an edge collapse including the link check as collapse prerequisite.
| the | edge Tuple to be split |
| void TriMesh::collapse_edge_conn | ( | const Tuple & | loc0, |
| std::vector< Tuple > & | new_tris, | ||
| Tuple & | return_t, | ||
| size_t & | new_vid, | ||
| std::vector< std::pair< size_t, TriangleConnectivity > > & | old_tris, | ||
| std::vector< std::pair< size_t, VertexConnectivity > > & | old_vertices, | ||
| std::vector< std::pair< size_t, size_t > > & | same_edge_vid_fid, | ||
| std::vector< size_t > & | n12_intersect_fids | ||
| ) |
Collpase an edge connectivity part
| void TriMesh::collapse_edge_rollback | ( | size_t & | new_vid, |
| std::vector< std::pair< size_t, TriangleConnectivity > > & | old_tris, | ||
| std::vector< std::pair< size_t, VertexConnectivity > > & | old_vertices, | ||
| std::vector< std::pair< size_t, size_t > > & | same_edge_vid_fid, | ||
| std::vector< size_t > & | n12_intersect_fids | ||
| ) |
collapse edge rollback
| void TriMesh::consolidate_mesh | ( | ) |
removing the elements that are removed
| bnd_output | when turn on will write the boundary vertices to "bdn_table.dmat" |
| std::vector< TriMesh::Tuple > TriMesh::get_edges | ( | ) | const |
Generate a vector of Tuples for each edge
| std::vector< TriMesh::Tuple > TriMesh::get_faces | ( | ) | const |
Generate a vector of Tuples from global face index
|
private |
Get the next avaiblie global index for the triangle.
|
private |
Get the next avaiblie global index for the vertex.
| std::vector< wmtk::TriMesh::Tuple > TriMesh::get_one_ring_edges_for_vertex | ( | const Tuple & | t | ) | const |
Get all edges that are incident to the vertex of Tuple t.
The return tuples contain the edge and the adjacent vertex: return_tuple.switch_vertex().vid == t.vid()
| t | tuple pointing to a vertex |
The code below is a faster implementation but it did not give the exact same result for QSLIM. Leaving it commented out for now.
| std::vector< TriMesh::Tuple > TriMesh::get_one_ring_tris_for_vertex | ( | const Tuple & | t | ) | const |
Get the one ring tris for a vertex.
| t | tuple pointing to a vertex |
| std::vector< size_t > TriMesh::get_one_ring_vids_for_vertex_duplicate | ( | const size_t & | t | ) | const |
Get the vids of the incident one ring tris for a vertex.
| t | tuple pointing to a vertex |
|
inline |
Count the number of the one ring tris for a vertex.
| t | tuple pointing to a vertex |
| std::vector< TriMesh::Tuple > TriMesh::get_vertices | ( | ) | const |
Generate a vector of Tuples from global vertex index and local edge index
| void wmtk::TriMesh::init | ( | const MatrixXi & | F | ) |
Generate the connectivity of the mesh from an IGL-style F matrix.
| F | by 3 list of vertex indices. |
| void TriMesh::init | ( | size_t | n_vertices, |
| const std::vector< std::array< size_t, 3 > > & | tris | ||
| ) |
Generate the connectivity of the mesh
| n_vertices | Input number of vertices |
| tris | triangle connectivity |
|
inlinevirtual |
User specified invariants that can't be violated.
| std::vector<Tuple> | a vector of Tuples that are concerned in a given operation |
|
inline |
|
inline |
| std::array< wmtk::TriMesh::Tuple, 3 > TriMesh::oriented_tri_vertices | ( | const Tuple & | t | ) | const |
Get the incident vertices for a triangle.
| t | tuple pointing to an face |
| std::array< size_t, 3 > TriMesh::oriented_tri_vids | ( | const Tuple & | t | ) | const |
Get the incident vertices for a triangle.
| t | tuple pointing to an face |
|
inlinevirtual |
User specified modifications and desideras after an edge smooth.
| the | edge Tuple to be smoothed |
|
inlinevirtual |
User specified preparations and desideratas for an edge smooth.
| the | edge Tuple to be smoothed |
| bool TriMesh::smooth_vertex | ( | const Tuple & | t | ) |
Smooth a vertex
| t | Input Tuple for the vertex |
Split an edge
| t | Input Tuple for the edge to split. | |
| [out] | new_edges | a vector of Tuples refering to the triangles incident to the new vertex introduced |
|
inlinevirtual |
User specified modifications and desideratas after an edge split.
| the | edge Tuple to be split |
|
inlinevirtual |
User specified preparations and desideratas for an edge split.
| the | edge Tuple to be split |
Split a face in 3 faces.
| t | Input tuple for the face to split. | |
| [out] | new_t | A vector of Tuples refering to the triangles incident to the new vertex. introduced |
v2 /|\ / | \ / | \ /f1 ^ f0\
/ / \ \ // f2 \ v0 --------— v1
|
inlinevirtual |
User specified modifications and desideratas after a face split.
| the | face Tuple to be split |
|
inlinevirtual |
User specified preparations and desideratas for a face split.
| the | face Tuple to be split |
Swap an edge
| t | Input Tuple for the edge to be swaped. | |
| [out] | new_edges | a vector of Tuples refering to the triangles incident to the new edge introduced |
|
inlinevirtual |
User specified modifications and desideras after an edge swap.
| the | edge Tuple to be swaped |
|
virtual |
User specified preparations and desideratas for an edge swap including 1.can't swap on boundary edge. 2. when swap edge between v1, v2, there can't exist edges between the two opposite vertices v3, v4.
| the | edge Tuple to be swaped |
a duplicate of Tuple::switch_face funciton
|
inline |
get the current largest global fid
| bool TriMesh::try_set_edge_mutex_two_ring | ( | const Tuple & | e, |
| int | threadid | ||
| ) |
try lock the two-ring neighboring triangles' incident vertices for the two ends of an edge
| e | Tuple refers to the edge |
| threadid |
| bool TriMesh::try_set_face_mutex_one_ring | ( | const Tuple & | f, |
| int | threadid | ||
| ) |
try lock the one-ring neighboring triangles' incident vertices.
| f | Tuple refers to the face |
| threadid |
| bool wmtk::TriMesh::try_set_vertex_mutex_one_ring | ( | const Tuple & | v, |
| int | threadid | ||
| ) |
get the lock for one ring neighboring triangles' incident vertices
| v | |
| threadid |
| bool TriMesh::try_set_vertex_mutex_two_ring | ( | const Tuple & | v, |
| int | threadid | ||
| ) |
try lock the two-ring neighboring triangles' incident vertices
| v | Tuple refers to the vertex |
| threadid |
|
inline |
Generate a edge Tuple using global fid and local eid
| fid | globale fid for the triangle |
| local_eid | local eid |
| TriMesh::Tuple TriMesh::tuple_from_edge | ( | size_t | vid1, |
| size_t | vid2, | ||
| size_t | fid | ||
| ) | const |
Generate a tuple using local vid and global fid
| vid1,vid2 | are local vids TODO: these are global vids |
| fid | globale fid for the triangle |
|
inline |
|
inline |
Generate avertex Tuple using local vid and global fid
| vid | globale vid for the triangle |
|
inline |
get the current largest global vid