Wildmeshing Toolkit
EdgeOperationData.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <array>
3 #include <vector>
4 #include <wmtk/Tuple.hpp>
6 
9 {
10 public:
11  EdgeOperationData() = default;
14  // C
15  // / \ .
16  // F1 / \ F2
17  // / \ .
18  // / \ .
19  // A----------B
20  // \ /
21  // \ /
22  // F1' \ / F2'
23  // \ /
24  // C'
25  // the neighbors are stored in the order of A, B, C, D if they exist
26  // vid, ear fid (-1 if it doesn't exit), ear eid
27 
33  struct EarData
34  {
35  int64_t fid = -1; // global fid of the ear, -1 if it doesn't exist
36  int64_t eid = -1; // global eid of the ear, -1 if it doesn't exist
37  };
38 
43  {
44  // vid of the vertex opposite of the input edge with respect to the input face
45  int64_t opposite_vid = -1;
46  // the face id from before the operation
47  int64_t fid = -1;
48  // the fids of the split edge - first one has vertex A, second one has vertex B
49  std::array<int64_t, 2> split_f = std::array<int64_t, 2>{{-1, -1}};
50 
51  // the copy of edge m_operating_tuple in face(fid)
53 
54  // the ear data (i.e FID and EID of the edge/face across the edge.
55  // first face/edge include A, second includes B
56  std::array<EarData, 2> ears;
57 
58  // the new edge created by split/collapse
59  // for collapse: merging two ears into this edge
60  // for split: new rib edge
61  int64_t new_edge_id = -1;
62 
63  int64_t merged_edge_fid = -1;
64  };
65 
66  const std::vector<IncidentFaceData>& incident_face_datas() const
67  {
68  return m_incident_face_datas;
69  }
70 
71  const std::array<int64_t, 2>& incident_vids() const { return m_spine_vids; }
72 
73  int64_t operating_edge_id() const { return m_operating_edge_id; }
74 
75  // only returns valid tuples for the state before an operation occurred
76  std::vector<std::array<Tuple, 2>> ear_edges(const TriMesh& m) const;
77  std::array<Tuple, 2> input_endpoints(const TriMesh& m) const;
78  std::vector<Tuple> collapse_merged_ear_edges(const TriMesh& m) const;
79 
80  std::vector<Tuple> split_new_rib_edges(const TriMesh&) const;
81  std::vector<Tuple> input_faces(const TriMesh&) const;
82  std::array<Tuple, 2> split_output_edges(const TriMesh&) const;
83  std::vector<std::array<Tuple, 2>> split_output_faces(const TriMesh&) const;
84 
85  std::vector<simplex::Simplex> new_vertices(const Mesh&) const;
86 
87  std::array<std::vector<int64_t>, 3> simplex_ids_to_delete;
88  std::vector<int64_t> cell_ids_to_update_hash;
89 
90 
91  // common simplicies
92  int64_t spine_eid = -1;
93  int64_t m_operating_edge_id = -1;
94 
95  // simplices required per-face
96  std::vector<IncidentFaceData> m_incident_face_datas;
97 
98  std::array<int64_t, 2> split_spine_eids = std::array<int64_t, 2>{{-1, -1}};
99  // in a free mesh this encodes the new vertex added to one of the faces
100  int64_t split_new_vid = -1;
101 
102  std::array<int64_t, 2> m_free_split_v;
103  std::array<int64_t, 2> m_free_split_e;
104 
105  bool is_collapse = false;
106 };
107 } // namespace wmtk::operations::tri_mesh
std::array< int64_t, 2 > m_spine_vids
std::vector< Tuple > input_faces(const TriMesh &) const
std::vector< Tuple > collapse_merged_ear_edges(const TriMesh &m) const
std::vector< std::array< Tuple, 2 > > split_output_faces(const TriMesh &) const
std::vector< simplex::Simplex > new_vertices(const Mesh &) const
EdgeOperationData & operator=(EdgeOperationData &&)=default
const std::array< int64_t, 2 > & incident_vids() const
std::vector< IncidentFaceData > m_incident_face_datas
std::vector< std::array< Tuple, 2 > > ear_edges(const TriMesh &m) const
std::vector< Tuple > split_new_rib_edges(const TriMesh &) const
EdgeOperationData(EdgeOperationData &&)=default
const std::vector< IncidentFaceData > & incident_face_datas() const
std::array< Tuple, 2 > input_endpoints(const TriMesh &m) const
std::array< std::vector< int64_t >, 3 > simplex_ids_to_delete
std::array< Tuple, 2 > split_output_edges(const TriMesh &) const
An ear is a face that is adjacent to a face that is incident to the edge on which the operation is pe...
Data on the incident face relevant for performing operations.