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