diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index c33ca686bc..893f63c0bd 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -301,35 +301,35 @@ set(SLIC3R_SOURCES SLA/Clustering.hpp SLA/Clustering.cpp SLA/ReprojectPointsOnMesh.hpp - SLA/SupportIslands/EvaluateNeighbor.cpp" -"SLA/SupportIslands/EvaluateNeighbor.hpp" -"SLA/SupportIslands/ExpandNeighbor.cpp" -"SLA/SupportIslands/ExpandNeighbor.hpp" -"SLA/SupportIslands/IStackFunction.hpp" -"SLA/SupportIslands/LineUtils.cpp" -"SLA/SupportIslands/LineUtils.hpp" -"SLA/SupportIslands/NodeDataWithResult.hpp" -"SLA/SupportIslands/Parabola.hpp" -"SLA/SupportIslands/ParabolaUtils.cpp" -"SLA/SupportIslands/ParabolaUtils.hpp" -"SLA/SupportIslands/PointUtils.cpp" -"SLA/SupportIslands/PointUtils.hpp" -"SLA/SupportIslands/PolygonUtils.cpp" -"SLA/SupportIslands/PolygonUtils.hpp" -"SLA/SupportIslands/PostProcessNeighbor.cpp" -"SLA/SupportIslands/PostProcessNeighbor.hpp" -"SLA/SupportIslands/PostProcessNeighbors.cpp" -"SLA/SupportIslands/PostProcessNeighbors.hpp" -"SLA/SupportIslands/SampleConfig.hpp" -"SLA/SupportIslands/SampleConfigFactory.hpp" -"SLA/SupportIslands/SampleIslandUtils.cpp" -"SLA/SupportIslands/SampleIslandUtils.hpp" -"SLA/SupportIslands/SupportIslandPoint.cpp" -"SLA/SupportIslands/SupportIslandPoint.hpp" -"SLA/SupportIslands/VectorUtils.hpp" -"SLA/SupportIslands/VoronoiGraph.hpp" -"SLA/SupportIslands/VoronoiGraphUtils.cpp" -"SLA/SupportIslands/VoronoiGraphUtils.hpp" + SLA/SupportIslands/EvaluateNeighbor.cpp + SLA/SupportIslands/EvaluateNeighbor.hpp + SLA/SupportIslands/ExpandNeighbor.cpp + SLA/SupportIslands/ExpandNeighbor.hpp + SLA/SupportIslands/IStackFunction.hpp + SLA/SupportIslands/LineUtils.cpp + SLA/SupportIslands/LineUtils.hpp + SLA/SupportIslands/NodeDataWithResult.hpp + SLA/SupportIslands/Parabola.hpp + SLA/SupportIslands/ParabolaUtils.cpp + SLA/SupportIslands/ParabolaUtils.hpp + SLA/SupportIslands/PointUtils.cpp + SLA/SupportIslands/PointUtils.hpp + SLA/SupportIslands/PolygonUtils.cpp + SLA/SupportIslands/PolygonUtils.hpp + SLA/SupportIslands/PostProcessNeighbor.cpp + SLA/SupportIslands/PostProcessNeighbor.hpp + SLA/SupportIslands/PostProcessNeighbors.cpp + SLA/SupportIslands/PostProcessNeighbors.hpp + SLA/SupportIslands/SampleConfig.hpp + SLA/SupportIslands/SampleConfigFactory.hpp + SLA/SupportIslands/SampleIslandUtils.cpp + SLA/SupportIslands/SampleIslandUtils.hpp + SLA/SupportIslands/SupportIslandPoint.cpp + SLA/SupportIslands/SupportIslandPoint.hpp + SLA/SupportIslands/VectorUtils.hpp + SLA/SupportIslands/VoronoiGraph.hpp + SLA/SupportIslands/VoronoiGraphUtils.cpp + SLA/SupportIslands/VoronoiGraphUtils.hpp ) add_library(libslic3r STATIC ${SLIC3R_SOURCES}) diff --git a/src/libslic3r/Geometry.hpp b/src/libslic3r/Geometry.hpp index 23f0869df2..c825f82544 100644 --- a/src/libslic3r/Geometry.hpp +++ b/src/libslic3r/Geometry.hpp @@ -287,42 +287,6 @@ bool liang_barsky_line_clipping( return liang_barsky_line_clipping(x0clip, x1clip, bbox); } -// Ugly named variant, that accepts the squared line -// Don't call me with a nearly zero length vector! -// sympy: -// factor(solve([a * x + b * y + c, x**2 + y**2 - r**2], [x, y])[0]) -// factor(solve([a * x + b * y + c, x**2 + y**2 - r**2], [x, y])[1]) -template -int ray_circle_intersections_r2_lv2_c(T r2, T a, T b, T lv2, T c, std::pair, Eigen::Matrix> &out) -{ - T d2 = r2 * lv2 - c * c; - if (d2 < T(0)) - return 0; - T x0 = - a * c; - T y0 = - b * c; - T d = sqrt(d2); - out.first.x() = (x0 + b * d) / lv2; - out.first.y() = (y0 - a * d) / lv2; - out.second.x() = (x0 - b * d) / lv2; - out.second.y() = (y0 + a * d) / lv2; - return d == T(0) ? 1 : 2; -} -template -int ray_circle_intersections(T r, T a, T b, T c, std::pair, Eigen::Matrix> &out) -{ - T lv2 = a * a + b * b; - if (lv2 < T(SCALED_EPSILON * SCALED_EPSILON)) { - //FIXME what is the correct epsilon? - // What if the line touches the circle? - return false; - } - return ray_circle_intersections_r2_lv2_c(r * r, a, b, a * a + b * b, c, out); -} - -Pointf3s convex_hull(Pointf3s points); -Polygon convex_hull(Points points); -Polygon convex_hull(const Polygons &polygons); - bool directions_parallel(double angle1, double angle2, double max_diff = 0); bool directions_perpendicular(double angle1, double angle2, double max_diff = 0); template bool contains(const std::vector &vector, const Point &point); diff --git a/src/libslic3r/Geometry/Circle.hpp b/src/libslic3r/Geometry/Circle.hpp index 39973d916d..8ed311808d 100644 --- a/src/libslic3r/Geometry/Circle.hpp +++ b/src/libslic3r/Geometry/Circle.hpp @@ -179,7 +179,7 @@ int ray_circle_intersections(T r, T a, T b, T c, std::pair +#include #include #include "VectorUtils.hpp" #include "PointUtils.hpp" diff --git a/src/libslic3r/SLA/SupportIslands/ParabolaUtils.cpp b/src/libslic3r/SLA/SupportIslands/ParabolaUtils.cpp index c7e076117b..d97b07bb49 100644 --- a/src/libslic3r/SLA/SupportIslands/ParabolaUtils.cpp +++ b/src/libslic3r/SLA/SupportIslands/ParabolaUtils.cpp @@ -4,8 +4,8 @@ // sampling parabola #include -#include -#include +#include +#include using namespace Slic3r::sla; diff --git a/src/libslic3r/SLA/SupportIslands/SampleIslandUtils.cpp b/src/libslic3r/SLA/SupportIslands/SampleIslandUtils.cpp index e7964f152c..6ed7acbf3d 100644 --- a/src/libslic3r/SLA/SupportIslands/SampleIslandUtils.cpp +++ b/src/libslic3r/SLA/SupportIslands/SampleIslandUtils.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include "IStackFunction.hpp" #include "EvaluateNeighbor.hpp" #include "ParabolaUtils.hpp" @@ -11,7 +11,7 @@ #include "LineUtils.hpp" #include "PointUtils.hpp" -#include +#include #include // allign diff --git a/src/libslic3r/SLA/SupportIslands/VoronoiGraph.hpp b/src/libslic3r/SLA/SupportIslands/VoronoiGraph.hpp index 63c8629343..325a1eee32 100644 --- a/src/libslic3r/SLA/SupportIslands/VoronoiGraph.hpp +++ b/src/libslic3r/SLA/SupportIslands/VoronoiGraph.hpp @@ -3,6 +3,7 @@ #include #include +#include #include namespace Slic3r::sla { diff --git a/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp b/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp index 5994a34efd..c62b7ae505 100644 --- a/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp +++ b/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include "IStackFunction.hpp" #include "EvaluateNeighbor.hpp" #include "ParabolaUtils.hpp" @@ -10,7 +10,7 @@ #include "PointUtils.hpp" #include "PolygonUtils.hpp" -#include +#include // comment definition of NDEBUG to enable assert() //#define NDEBUG diff --git a/src/libslic3r/SLA/SupportPointGenerator.cpp b/src/libslic3r/SLA/SupportPointGenerator.cpp index 2d1e11af7c..ec6dda2342 100644 --- a/src/libslic3r/SLA/SupportPointGenerator.cpp +++ b/src/libslic3r/SLA/SupportPointGenerator.cpp @@ -18,7 +18,7 @@ #include "libnest2d/utils/rotcalipers.hpp" #include "libslic3r/EdgeGrid.hpp" -#include "libslic3r/VoronoiOffset.hpp" +#include "libslic3r/Geometry/VoronoiOffset.hpp" #include "libslic3r/SLA/SupportIslands/VoronoiGraphUtils.hpp" #include "libslic3r/SLA/SupportIslands/SampleIslandUtils.hpp" diff --git a/tests/sla_print/sla_supptgen_tests.cpp b/tests/sla_print/sla_supptgen_tests.cpp index 42ba6db1de..83553a5a9f 100644 --- a/tests/sla_print/sla_supptgen_tests.cpp +++ b/tests/sla_print/sla_supptgen_tests.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -356,10 +357,7 @@ ExPolygons createTestIslands(double size) if (useFrogLeg) { TriangleMesh mesh = load_model("frog_legs.obj"); - TriangleMeshSlicer slicer{&mesh}; - std::vector grid({0.1f}); - std::vector slices; - slicer.slice(grid, SlicingMode::Regular, 0.05f, &slices, [] {}); + std::vector slices = slice_mesh_ex(mesh.its, {0.1f}); ExPolygon frog_leg = slices.front()[1]; result.push_back(frog_leg); } @@ -487,14 +485,12 @@ SampleConfig create_sample_config(double size) { } #include -#include +#include TEST_CASE("Sampling speed test on FrogLegs", "[hide], [VoronoiSkeleton]") { TriangleMesh mesh = load_model("frog_legs.obj"); - TriangleMeshSlicer slicer{&mesh}; std::vector grid({0.1f}); - std::vector slices; - slicer.slice(grid, SlicingMode::Regular, 0.05f, &slices, [] {}); + std::vector slices = slice_mesh_ex(mesh.its, {0.1f}); ExPolygon frog_leg = slices.front()[1]; SampleConfig cfg = create_sample_config(3e7); diff --git a/tests/sla_print/sla_voronoi_graph_tests.cpp b/tests/sla_print/sla_voronoi_graph_tests.cpp index 4f0440b4e1..be875e3a8d 100644 --- a/tests/sla_print/sla_voronoi_graph_tests.cpp +++ b/tests/sla_print/sla_voronoi_graph_tests.cpp @@ -1,6 +1,6 @@ #include "sla_test_utils.hpp" #include -#include +#include using namespace Slic3r; using namespace Slic3r::sla;