Wildmeshing Toolkit
Loading...
Searching...
No Matches
EmbedCurves.hpp
1#pragma once
2
3#include <wmtk/io/ComponentIO.hpp>
4
5#include <wmtk/Types.hpp>
6
7#include <string>
8#include <vector>
9
10namespace wmtk::components::simwild {
11
36{
37public:
44 const std::vector<std::string>& input_paths,
45 const std::vector<Matrix3d>& input_transform = {},
46 const double tol_rel = -1,
47 const double tol_abs = -1,
48 const io::ComponentIO* component_io = nullptr);
49
57 void
58 simplify_curves(const double eps, const bool use_exact_envelope, const int num_threads = 0);
59
68 bool embed_curves(const bool tag_from_winding_number = true);
69
73 void consolidate();
74
75 const MatrixXd& V_emb() const { return m_V_emb; }
76 const MatrixXr& V_emb_r() const { return m_V_emb_r; }
77 const MatrixXi& F_emb() const { return m_F_emb; }
78 const MatrixSi& F_tags() const { return m_F_tags; }
80 const MatrixXd& V_curves() const { return m_V_curves; }
81 const MatrixXi& E_curves() const { return m_E_curves; }
83 const MatrixXi& E_constrained() const { return m_E_constrained; }
84
85 std::pair<Vector2d, Vector2d> bbox_curves_minmax() const;
86
87 void write_curves_obj(const std::string& filename) const;
88
89 int m_num_threads = 0;
90
91private:
100
116 void tag_from_provenance();
117
118private:
120 std::vector<MatrixXd> m_Vs;
121 std::vector<MatrixXi> m_Es;
122
124 MatrixXd m_V_curves;
125 MatrixXi m_E_curves;
128 std::vector<size_t> m_E_input;
130 std::vector<std::vector<size_t>> m_E_constrained_inputs;
131
132 MatrixXd m_V_emb;
133 MatrixXr m_V_emb_r;
134 MatrixXi m_F_emb;
135 MatrixXi m_E_constrained;
136 MatrixSi m_F_tags;
137};
138
139} // namespace wmtk::components::simwild
Turn a set of 2D curve networks into one tagged triangle mesh.
Definition EmbedCurves.hpp:36
MatrixXd m_V_curves
The union, which is what gets simplified and arranged.
Definition EmbedCurves.hpp:124
void consolidate()
Remove vertices not referenced by any output face.
Definition EmbedCurves.cpp:383
bool embed_curves(const bool tag_from_winding_number=true)
Compute the exact arrangement of the (simplified) curve union.
Definition EmbedCurves.cpp:144
std::vector< size_t > m_E_input
Definition EmbedCurves.hpp:128
std::vector< MatrixXd > m_Vs
Per input, as read: kept separate because the winding number is per input.
Definition EmbedCurves.hpp:120
void simplify_curves(const double eps, const bool use_exact_envelope, const int num_threads=0)
Simplify the input curves while staying within the eps envelope.
Definition EmbedCurves.cpp:105
void tag_from_winding_number()
One binary tag column per input, set where that input's winding number at a face barycenter exceeds 0...
Definition EmbedCurves.cpp:345
std::vector< std::vector< size_t > > m_E_constrained_inputs
Per row of m_E_constrained: which inputs tile it. Only filled for tag_from_provenance.
Definition EmbedCurves.hpp:130
const MatrixXi & E_constrained() const
The constrained edges of the arrangement, i.e. the output edges tiling the input.
Definition EmbedCurves.hpp:83
void tag_from_provenance()
Decide the face tags from the arrangement's segment provenance.
Definition EmbedCurves.cpp:210
const MatrixXd & V_curves() const
The simplified input curves – what the envelope is built from.
Definition EmbedCurves.hpp:80
Definition ComponentIO.hpp:15