Wildmeshing Toolkit
Loading...
Searching...
No Matches
EmbedCurves.hpp
1#pragma once
2
3#include <wmtk/Types.hpp>
4
5#include <string>
6#include <vector>
7
8namespace wmtk::components::simwild {
9
34{
35public:
42 const std::vector<std::string>& input_paths,
43 const std::vector<Matrix3d>& input_transform = {},
44 const double tol_rel = -1,
45 const double tol_abs = -1);
46
54 void
55 simplify_curves(const double eps, const bool use_exact_envelope, const int num_threads = 0);
56
65 bool embed_curves(const bool tag_from_winding_number = true);
66
70 void consolidate();
71
72 const MatrixXd& V_emb() const { return m_V_emb; }
73 const MatrixXr& V_emb_r() const { return m_V_emb_r; }
74 const MatrixXi& F_emb() const { return m_F_emb; }
75 const MatrixSi& F_tags() const { return m_F_tags; }
77 const MatrixXd& V_curves() const { return m_V_curves; }
78 const MatrixXi& E_curves() const { return m_E_curves; }
80 const MatrixXi& E_constrained() const { return m_E_constrained; }
81
82 std::pair<Vector2d, Vector2d> bbox_curves_minmax() const;
83
84 void write_curves_obj(const std::string& filename) const;
85
86 int m_num_threads = 0;
87
88private:
97
113 void tag_from_provenance();
114
115private:
117 std::vector<MatrixXd> m_Vs;
118 std::vector<MatrixXi> m_Es;
119
121 MatrixXd m_V_curves;
122 MatrixXi m_E_curves;
125 std::vector<size_t> m_E_input;
127 std::vector<std::vector<size_t>> m_E_constrained_inputs;
128
129 MatrixXd m_V_emb;
130 MatrixXr m_V_emb_r;
131 MatrixXi m_F_emb;
132 MatrixXi m_E_constrained;
133 MatrixSi m_F_tags;
134};
135
136} // namespace wmtk::components::simwild
Turn a set of 2D curve networks into one tagged triangle mesh.
Definition EmbedCurves.hpp:34
MatrixXd m_V_curves
The union, which is what gets simplified and arranged.
Definition EmbedCurves.hpp:121
void consolidate()
Remove vertices not referenced by any output face.
Definition EmbedCurves.cpp:380
bool embed_curves(const bool tag_from_winding_number=true)
Compute the exact arrangement of the (simplified) curve union.
Definition EmbedCurves.cpp:136
std::vector< size_t > m_E_input
Definition EmbedCurves.hpp:125
std::vector< MatrixXd > m_Vs
Per input, as read: kept separate because the winding number is per input.
Definition EmbedCurves.hpp:117
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:97
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:337
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:127
const MatrixXi & E_constrained() const
The constrained edges of the arrangement, i.e. the output edges tiling the input.
Definition EmbedCurves.hpp:80
void tag_from_provenance()
Decide the face tags from the arrangement's segment provenance.
Definition EmbedCurves.cpp:202
const MatrixXd & V_curves() const
The simplified input curves – what the envelope is built from.
Definition EmbedCurves.hpp:77