Wildmeshing Toolkit
Loading...
Searching...
No Matches
Replay.hpp
1#pragma once
2
3#include "History.hpp"
4
5#include <array>
6#include <cstdint>
7#include <set>
8#include <vector>
9
10namespace wmtk::history {
11
21template <int N>
23{
24public:
25 using Face = typename History<N>::Face;
26 using Feature = typename History<N>::Feature;
27
28 explicit BasicReplay(const History<N>& h);
29
30 void apply(const Edit& e);
32 void apply_all(const History<N>& h);
33
34 const std::vector<Eigen::Vector3d>& vertices() const { return m_vertices; }
35 const std::vector<uint8_t>& vertex_alive() const { return m_vertex_alive; }
36 const std::vector<Face>& faces() const { return m_faces; }
37 const std::vector<uint8_t>& face_alive() const { return m_face_alive; }
39 const std::vector<uint64_t>& faces_of(uint64_t v) const { return m_vertex_faces[v]; }
41 std::set<Feature> features() const;
42 bool is_feature(Feature f) const;
43
44private:
45 void split_edge(const Edit& e);
46 void split_face(const Edit& e);
47 void collapse_edge(const Edit& e);
48 void swap_edge(const Edit& e);
49 void replace_faces(const Edit& e);
50 void relabel(const Edit& e);
51 void embed(const Edit& e);
52 void consolidate();
53
54 void grow_vertices(uint64_t vid);
55 void grow_faces(uint64_t fid);
56 void link(uint64_t v, uint64_t f);
57 void unlink(uint64_t v, uint64_t f);
58 void rename_in_face(uint64_t f, uint64_t from, uint64_t to);
61 void retire_bare(const std::vector<uint64_t>& vs);
62
63 std::vector<Eigen::Vector3d> m_vertices;
64 std::vector<uint8_t> m_vertex_alive;
65 std::vector<Face> m_faces;
66 std::vector<uint8_t> m_face_alive;
68 std::vector<std::vector<uint64_t>> m_vertex_faces;
71 std::vector<std::vector<uint64_t>> m_feature_nbrs;
72 void add_feature(const Feature& f);
73 bool remove_feature(const Feature& f);
75 void rename_features(uint64_t from, uint64_t to);
77 void drop_features(uint64_t v);
78};
79
80} // namespace wmtk::history
A complex driven by the edits of a History: a surface (N = 3) or a curve network (N = 2).
Definition Replay.hpp:23
std::set< Feature > features() const
The features (see History::features), each with its vertices sorted.
Definition Replay.cpp:100
const std::vector< uint64_t > & faces_of(uint64_t v) const
The live faces at vertex v, sorted.
Definition Replay.hpp:39
std::vector< std::vector< uint64_t > > m_vertex_faces
Live faces at each vertex, sorted.
Definition Replay.hpp:68
void apply_all(const History< N > &h)
Applies every edit of h, which must be the history this was built from.
Definition Replay.cpp:116
void rename_features(uint64_t from, uint64_t to)
Every feature at from now at to instead; an edge left with one vertex goes.
Definition Replay.cpp:59
void drop_features(uint64_t v)
Removes every feature at v.
Definition Replay.cpp:76
void retire_bare(const std::vector< uint64_t > &vs)
Definition Replay.cpp:186
std::vector< std::vector< uint64_t > > m_feature_nbrs
Definition Replay.hpp:71
The history types by name, for headers that only hold them (History.hpp defines them).
Definition BinaryIO.hpp:16
One committed operation.
Definition History.hpp:79
A complex and the edits it went through, in commit order.
Definition History.hpp:101
std::array< uint64_t, N > Face
A face's corners: a triangle's three, a segment's two.
Definition History.hpp:104
std::array< uint64_t, N - 1 > Feature
Definition History.hpp:107