MeshBoolean.cpp 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. input.repair();
  20. Benchmark bench;
  21. bench.start();
  22. bool fckd = MeshBoolean::cgal::does_self_intersect(input);
  23. bench.stop();
  24. std::cout << "Self intersect test: " << fckd << " duration: " << bench.getElapsedSec() << std::endl;
  25. bench.start();
  26. MeshBoolean::self_union(input);
  27. bench.stop();
  28. std::cout << "Self union duration: " << bench.getElapsedSec() << std::endl;
  29. return 0;
  30. }