@@ -303,7 +303,7 @@ class Tetrahedralizer
303303 logger ().info (" correct_tracked_surface_orientation done" );
304304 }
305305
306- void save (const std::string &path, bool smooth_open_boundary, bool manifold_surface, bool correct_surface_orientation, int boolean_op = -1 )
306+ void save (const std::string &path, bool smooth_open_boundary, bool manifold_surface, bool correct_surface_orientation, bool binary, int boolean_op = -1 )
307307 {
308308 igl::Timer timer;
309309
@@ -329,22 +329,22 @@ class Tetrahedralizer
329329 output_mesh_name = params.output_path + " _" + params.postfix + " .msh" ;
330330
331331 if (has_json_csg)
332- floatTetWild::boolean_operation (mesh , tree_with_ids);
332+ floatTetWild::boolean_operation (mesh_copy , tree_with_ids);
333333 else if (boolean_op >= 0 )
334- floatTetWild::boolean_operation (mesh , boolean_op);
334+ floatTetWild::boolean_operation (mesh_copy , boolean_op);
335335 else
336336 {
337337 if (params.smooth_open_boundary )
338338 {
339- floatTetWild::smooth_open_boundary (mesh , *tree);
340- for (auto &t : mesh .tets )
339+ floatTetWild::smooth_open_boundary (mesh_copy , *tree);
340+ for (auto &t : mesh_copy .tets )
341341 {
342342 if (t.is_outside )
343343 t.is_removed = true ;
344344 }
345345 }
346346 else
347- filter_outside (mesh );
347+ filter_outside (mesh_copy );
348348 }
349349 if (params.manifold_surface )
350350 {
@@ -360,11 +360,11 @@ class Tetrahedralizer
360360 logger ().info (" " );
361361
362362 if (params.output_path .size () > 3 && params.output_path .substr (params.output_path .size () - 3 , params.output_path .size ()) == " msh" )
363- MeshIO::write_mesh (params.output_path , mesh_copy, false );
363+ MeshIO::write_mesh (params.output_path , mesh_copy, false , std::vector< double >(), binary );
364364 else if (params.output_path .size () > 4 && params.output_path .substr (params.output_path .size () - 4 , params.output_path .size ()) == " mesh" )
365- MeshIO::write_mesh (params.output_path , mesh_copy, false );
365+ MeshIO::write_mesh (params.output_path , mesh_copy, false , std::vector< double >(), binary );
366366 else
367- MeshIO::write_mesh (params.output_path + " _" + params.postfix + " .msh" , mesh_copy, false );
367+ MeshIO::write_mesh (params.output_path + " _" + params.postfix + " .msh" , mesh_copy, false , std::vector< double >(), binary );
368368 }
369369
370370 void get_tet_mesh (bool smooth_open_boundary, bool manifold_surface, bool correct_surface_orientation, bool all_mesh, Eigen::MatrixXd &V, Eigen::MatrixXi &T, int boolean_op = -1 )
@@ -494,18 +494,18 @@ void tetrahedralize(py::module &m)
494494
495495 .def (" tetrahedralize" , [](Tetrahedralizer &t) { t.tetrahedralize (); }, " tetrahedralized the mesh" )
496496
497- .def (" save" , [](Tetrahedralizer &t, const std::string &path, bool smooth_open_boundary, bool manifold_surface, bool correct_surface_orientation) {
498- t.save (path, smooth_open_boundary, manifold_surface, correct_surface_orientation);
497+ .def (" save" , [](Tetrahedralizer &t, const std::string &path, bool smooth_open_boundary, bool manifold_surface, bool correct_surface_orientation, bool binary ) {
498+ t.save (path, smooth_open_boundary, manifold_surface, correct_surface_orientation, binary );
499499 },
500- " saves the output" , py::arg (" path" ), py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false )
500+ " saves the output" , py::arg (" path" ), py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false , py::arg ( " binary " ) = true )
501501 .def (" get_tet_mesh" , [](Tetrahedralizer &t, bool smooth_open_boundary, bool manifold_surface, bool correct_surface_orientation, bool all_mesh) {
502502 Eigen::MatrixXd V;
503503 Eigen::MatrixXi T;
504504 t.get_tet_mesh (smooth_open_boundary, manifold_surface, correct_surface_orientation, all_mesh, V, T);
505505
506506 return py::make_tuple (V, T);
507507 },
508- " saves the output" , py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false , py::arg (" all_mesh" ) = false )
508+ " gets the output" , py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false , py::arg (" all_mesh" ) = false )
509509 .def (" get_tet_mesh_from_csg" , [](Tetrahedralizer &t, const py::object &csg_tree, bool smooth_open_boundary, bool manifold_surface, bool correct_surface_orientation) {
510510 Eigen::MatrixXd V;
511511 Eigen::MatrixXi T;
@@ -519,12 +519,12 @@ void tetrahedralize(py::module &m)
519519
520520 return py::make_tuple (V, T);
521521 },
522- " saves the output" , py::arg (" csg_tree" ), py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false )
522+ " gets the output from a csg tree " , py::arg (" csg_tree" ), py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false )
523523 .def (" get_stats" , [](const Tetrahedralizer &t) { return t.get_stats (); }, " returns the stats" );
524524
525525 tetra.doc () = " Wildmeshing tetrahedralizer" ;
526526
527- m.def (" 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 manifold_surface, bool correct_surface_orientation) {
527+ m.def (" 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 manifold_surface, bool correct_surface_orientation, bool binary ) {
528528 wildmeshing_binding::init_globals ();
529529
530530 static bool initialized = false ;
@@ -539,7 +539,7 @@ void tetrahedralize(py::module &m)
539539 return false ;
540540
541541 tetra.tetrahedralize ();
542- tetra.save (output, smooth_open_boundary, manifold_surface, correct_surface_orientation);
542+ tetra.save (output, smooth_open_boundary, manifold_surface, correct_surface_orientation, binary );
543543
544544 return true ;
545545 },
@@ -555,9 +555,9 @@ void tetrahedralize(py::module &m)
555555 py::arg (" edge_length_r" ) = 1 . / 20 ., // "Relative target edge length l_r. Absolute l = l_r * diagonal_of_bbox"
556556 py::arg (" mute_log" ) = false , // "Mute prints");
557557 py::arg (" skip_simplify" ) = false , //
558- py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false );
558+ py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false , py::arg ( " binary " ) = true );
559559
560- m.def (" 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 smooth_open_boundary, bool manifold_surface, bool correct_surface_orientation) {
560+ m.def (" 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 smooth_open_boundary, bool manifold_surface, bool correct_surface_orientation, bool binary ) {
561561 wildmeshing_binding::init_globals ();
562562
563563 static bool initialized = false ;
@@ -575,7 +575,7 @@ void tetrahedralize(py::module &m)
575575 return false ;
576576
577577 tetra.tetrahedralize ();
578- tetra.save (output, smooth_open_boundary, manifold_surface, correct_surface_orientation);
578+ tetra.save (output, smooth_open_boundary, manifold_surface, correct_surface_orientation, binary );
579579
580580 return true ;
581581 },
@@ -591,6 +591,6 @@ void tetrahedralize(py::module &m)
591591 py::arg (" edge_length_r" ) = 1 . / 20 ., // "Relative target edge length l_r. Absolute l = l_r * diagonal_of_bbox"
592592 py::arg (" mute_log" ) = false , // "Mute prints");
593593 py::arg (" skip_simplify" ) = false , //
594- py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false );
594+ py::arg (" smooth_open_boundary" ) = false , py::arg (" manifold_surface" ) = false , py::arg (" correct_surface_orientation" ) = false , py::arg ( " binary " ) = true );
595595}
596596} // namespace wildmeshing_binding
0 commit comments