Skip to content

Commit 610024e

Browse files
committed
added coarsen option
1 parent acfad90 commit 610024e

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

Diff for: src/tetrahedralize.cpp

+12-10
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace wildmeshing_binding
5555
Tetrahedralizer(
5656
double stop_quality, int max_its, int stage, int stop_p,
5757
double epsilon, double edge_length_r,
58-
bool skip_simplify) : skip_simplify(skip_simplify)
58+
bool skip_simplify, bool coarsen) : skip_simplify(skip_simplify)
5959
{
6060
wildmeshing_binding::init_globals();
6161

@@ -69,6 +69,8 @@ namespace wildmeshing_binding
6969
params.stage = stage;
7070
params.stop_p = stop_p;
7171

72+
params.coarsen = coarsen;
73+
7274
params.eps_rel = epsilon;
7375
params.ideal_edge_length_rel = edge_length_r;
7476

@@ -601,15 +603,15 @@ namespace wildmeshing_binding
601603
.def(py::init<
602604
double, int, int, int,
603605
double, double,
604-
bool>(),
606+
bool, bool>(),
605607
py::arg("stop_quality") = 10, // "Specify max AMIPS energy for stopping mesh optimization"
606608
py::arg("max_its") = 80, // "Max number of mesh optimization iterations"
607609
py::arg("stage") = 2, // "Specify envelope stage"
608610
py::arg("stop_p") = -1, //
609611
py::arg("epsilon") = 1e-3, // "relative envelope epsilon_r. Absolute epsilonn = epsilon_r * diagonal_of_bbox"
610612
py::arg("edge_length_r") = 1. / 20., // "Relative target edge length l_r. Absolute l = l_r * diagonal_of_bbox"
611-
py::arg("skip_simplify") = false //
612-
)
613+
py::arg("skip_simplify") = false, //
614+
py::arg("coarsen") = true)
613615

614616
.def(
615617
"set_log_level", [](Tetrahedralizer &t, int level) { t.set_log_level(level); }, "sets log level, valid value between 0 (all logs) and 6 (no logs)", py::arg("level"))
@@ -667,7 +669,7 @@ namespace wildmeshing_binding
667669
tetra.doc() = "Wildmeshing tetrahedralizer";
668670

669671
m.def(
670-
"tetrahedralize", [](const std::string &input, const std::string &output, double stop_quality, int max_its, int stage, int stop_p, double epsilon, double edge_length_r, bool mute_log, bool skip_simplify, bool smooth_open_boundary, bool floodfill, bool use_input_for_wn, bool manifold_surface, bool correct_surface_orientation, bool all_mesh, bool binary) {
672+
"tetrahedralize", [](const std::string &input, const std::string &output, double stop_quality, int max_its, int stage, int stop_p, double epsilon, double edge_length_r, bool mute_log, bool skip_simplify, bool coarsen, bool smooth_open_boundary, bool floodfill, bool use_input_for_wn, bool manifold_surface, bool correct_surface_orientation, bool all_mesh, bool binary) {
671673
wildmeshing_binding::init_globals();
672674

673675
static bool initialized = false;
@@ -677,7 +679,7 @@ namespace wildmeshing_binding
677679
initialized = true;
678680
}
679681

680-
Tetrahedralizer tetra(stop_quality, max_its, stage, stop_p, epsilon, edge_length_r, skip_simplify);
682+
Tetrahedralizer tetra(stop_quality, max_its, stage, stop_p, epsilon, edge_length_r, skip_simplify, coarsen);
681683
if (!tetra.load_mesh(input))
682684
return false;
683685

@@ -698,10 +700,10 @@ namespace wildmeshing_binding
698700
py::arg("edge_length_r") = 1. / 20., // "Relative target edge length l_r. Absolute l = l_r * diagonal_of_bbox"
699701
py::arg("mute_log") = false, // "Mute prints");
700702
py::arg("skip_simplify") = false, //
701-
py::arg("smooth_open_boundary") = false, py::arg("floodfill") = false, py::arg("manifold_surface") = false, py::arg("use_input_for_wn") = false, py::arg("correct_surface_orientation") = false, py::arg("all_mesh") = false, py::arg("binary") = true);
703+
py::arg("coarsen") = true, py::arg("smooth_open_boundary") = false, py::arg("floodfill") = false, py::arg("manifold_surface") = false, py::arg("use_input_for_wn") = false, py::arg("correct_surface_orientation") = false, py::arg("all_mesh") = false, py::arg("binary") = true);
702704

703705
m.def(
704-
"boolean_operation", [](const py::object &json, const std::string &output, double stop_quality, int max_its, int stage, int stop_p, double epsilon, double edge_length_r, bool mute_log, bool skip_simplify, bool manifold_surface, bool use_input_for_wn, bool correct_surface_orientation, bool all_mesh, bool binary) {
706+
"boolean_operation", [](const py::object &json, const std::string &output, double stop_quality, int max_its, int stage, int stop_p, double epsilon, double edge_length_r, bool mute_log, bool skip_simplify, bool coarsen, bool manifold_surface, bool use_input_for_wn, bool correct_surface_orientation, bool all_mesh, bool binary) {
705707
wildmeshing_binding::init_globals();
706708

707709
static bool initialized = false;
@@ -711,7 +713,7 @@ namespace wildmeshing_binding
711713
initialized = true;
712714
}
713715

714-
Tetrahedralizer tetra(stop_quality, max_its, stage, stop_p, epsilon, edge_length_r, skip_simplify);
716+
Tetrahedralizer tetra(stop_quality, max_its, stage, stop_p, epsilon, edge_length_r, skip_simplify, coarsen);
715717

716718
const std::string tmp = py::str(json);
717719

@@ -735,6 +737,6 @@ namespace wildmeshing_binding
735737
py::arg("edge_length_r") = 1. / 20., // "Relative target edge length l_r. Absolute l = l_r * diagonal_of_bbox"
736738
py::arg("mute_log") = false, // "Mute prints");
737739
py::arg("skip_simplify") = false, //
738-
py::arg("manifold_surface") = false, py::arg("use_input_for_wn") = false, py::arg("correct_surface_orientation") = false, py::arg("all_mesh") = false, py::arg("binary") = true);
740+
py::arg("coarsen") = true, py::arg("manifold_surface") = false, py::arg("use_input_for_wn") = false, py::arg("correct_surface_orientation") = false, py::arg("all_mesh") = false, py::arg("binary") = true);
739741
}
740742
} // namespace wildmeshing_binding

Diff for: wildmeshing/runners.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ def tetrahedralize():
9393
default=False, help="Smooth the open boundary.")
9494
parser.add_argument("--manifold-surface", type=bool,
9595
default=False, help="Force the output to be manifold.")
96-
# parser.add_argument("--coarsen", type=bool, default=True, "Coarsen the output as much as possible.")
96+
parser.add_argument("--coarsen", type=bool, default=True,
97+
help="Coarsen the output as much as possible.")
9798
parser.add_argument("--csg", type=str, default="",
9899
help="json file containg a csg tree")
99100

@@ -114,7 +115,8 @@ def tetrahedralize():
114115
tetra = wm.Tetrahedralizer(stop_quality=args.stop_energy,
115116
epsilon=args.epsr,
116117
edge_length_r=args.lr,
117-
skip_simplify=args.skip_simplify)
118+
skip_simplify=args.skip_simplify,
119+
coarsen=args.coarsen)
118120
tetra.set_log_level(args.level)
119121

120122
if(len(args.bg_mesh) > 0):

0 commit comments

Comments
 (0)