MeshBoolean.cpp 999 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <iostream>
  2. #include <vector>
  3. #include <libslic3r/TriangleMesh.hpp>
  4. #include <libslic3r/Model.hpp>
  5. #include <libslic3r/SLAPrint.hpp>
  6. #include <libslic3r/SLAPrintSteps.hpp>
  7. #include <libslic3r/MeshBoolean.hpp>
  8. #include <libnest2d/tools/benchmark.h>
  9. #include <boost/log/trivial.hpp>
  10. int main(const int argc, const char * argv[])
  11. {
  12. using namespace Slic3r;
  13. if (argc <= 1) {
  14. std::cout << "Usage: meshboolean <input_file.3mf>" << std::endl;
  15. return EXIT_FAILURE;
  16. }
  17. TriangleMesh input;
  18. input.ReadSTLFile(argv[1]);
  19. Benchmark bench;
  20. bench.start();
  21. bool fckd = MeshBoolean::cgal::does_self_intersect(input);
  22. bench.stop();
  23. std::cout << "Self intersect test: " << fckd << " duration: " << bench.getElapsedSec() << std::endl;
  24. bench.start();
  25. MeshBoolean::self_union(input);
  26. bench.stop();
  27. std::cout << "Self union duration: " << bench.getElapsedSec() << std::endl;
  28. return 0;
  29. }