Wildmeshing Toolkit
Loading...
Searching...
No Matches
Parameters.h
1#pragma once
2
3namespace wmtk::components::triwild {
5{
6 double epsr = 2e-3; // relative error bound (wrt diagonal)
7 double eps = -1.; // absolute error bound
8 double lr = 5e-2; // target edge length (relative)
9 double l = -1.;
10 double l_min = -1;
11 double diag_l = -1.;
12 Vector2d box_min = Vector2d::Zero();
13 Vector2d box_max = Vector2d::Ones();
14 bool preserve_topology = false;
15 std::string output_path;
16
17 double splitting_l2 = -1.; // the lower bound length (squared) for edge split
18 double collapsing_l2 =
19 std::numeric_limits<double>::max(); // the upper bound length (squared) for edge collapse
20
21 double stop_energy = 10;
22
23 bool debug_output = false;
24 bool perform_sanity_checks = false;
25
26 double w_amips = 1e-4;
27 double w_envelope = 0;
28
29 void init(const Vector2d& min_, const Vector2d& max_)
30 {
31 box_min = min_;
32 box_max = max_;
33 diag_l = (box_max - box_min).norm();
34 if (l > 0) {
35 lr = l / diag_l;
36 } else {
37 l = lr * diag_l;
38 }
39 splitting_l2 = l * l * (16 / 9.);
40 collapsing_l2 = l * l * (16 / 25.);
41
42 if (eps > 0) {
43 epsr = eps / diag_l;
44 } else {
45 eps = epsr * diag_l;
46 }
47
48 l_min = eps;
49 }
50 void init(
51 const std::vector<Vector2d>& vertices,
52 const std::vector<std::array<size_t, 3>>& faces)
53 {
54 Vector2d min_, max_;
55 for (size_t i = 0; i < vertices.size(); i++) {
56 if (i == 0) {
57 min_ = vertices[i];
58 max_ = vertices[i];
59 continue;
60 }
61 for (int j = 0; j < 2; j++) {
62 if (vertices[i][j] < min_[j]) {
63 min_[j] = vertices[i][j];
64 }
65 if (vertices[i][j] > max_[j]) {
66 max_[j] = vertices[i][j];
67 }
68 }
69 }
70
71 init(min_, max_);
72 }
73};
74} // namespace wmtk::components::triwild
Definition Parameters.h:5