diff --git a/src/libslic3r/Arachne/SkeletalTrapezoidation.cpp b/src/libslic3r/Arachne/SkeletalTrapezoidation.cpp index 82f86e7a78..c80e70e61c 100644 --- a/src/libslic3r/Arachne/SkeletalTrapezoidation.cpp +++ b/src/libslic3r/Arachne/SkeletalTrapezoidation.cpp @@ -152,8 +152,7 @@ void SkeletalTrapezoidation::transferEdge(Point from, Point to, const VD::edge_t assert(twin->prev->twin); // Back rib assert(twin->prev->twin->prev); // Prev segment along parabola - constexpr bool is_not_next_to_start_or_end = false; // Only ribs at the end of a cell should be skipped - graph.makeRib(prev_edge, start_source_point, end_source_point, is_not_next_to_start_or_end); + graph.makeRib(prev_edge, start_source_point, end_source_point); } assert(prev_edge); } @@ -203,10 +202,8 @@ void SkeletalTrapezoidation::transferEdge(Point from, Point to, const VD::edge_t p0 = p1; v0 = v1; - if (p1_idx < discretized.size() - 1) - { // Rib for last segment gets introduced outside this function! - constexpr bool is_not_next_to_start_or_end = false; // Only ribs at the end of a cell should be skipped - graph.makeRib(prev_edge, start_source_point, end_source_point, is_not_next_to_start_or_end); + if (p1_idx < discretized.size() - 1) { // Rib for last segment gets introduced outside this function! + graph.makeRib(prev_edge, start_source_point, end_source_point); } } assert(prev_edge); @@ -462,8 +459,7 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys) node_t *starting_node = vd_node_to_he_node[starting_voronoi_edge->vertex0()]; starting_node->data.distance_to_boundary = 0; - constexpr bool is_next_to_start_or_end = true; - graph.makeRib(prev_edge, start_source_point, end_source_point, is_next_to_start_or_end); + graph.makeRib(prev_edge, start_source_point, end_source_point); for (const VD::edge_type* vd_edge = starting_voronoi_edge->next(); vd_edge != ending_voronoi_edge; vd_edge = vd_edge->next()) { assert(vd_edge->is_finite()); assert(Geometry::VoronoiUtils::is_in_range(*vd_edge)); @@ -471,7 +467,7 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys) Point v1 = Geometry::VoronoiUtils::to_point(vd_edge->vertex0()).cast(); Point v2 = Geometry::VoronoiUtils::to_point(vd_edge->vertex1()).cast(); transferEdge(v1, v2, *vd_edge, prev_edge, start_source_point, end_source_point, segments); - graph.makeRib(prev_edge, start_source_point, end_source_point, vd_edge->next() == ending_voronoi_edge); + graph.makeRib(prev_edge, start_source_point, end_source_point); } transferEdge(Geometry::VoronoiUtils::to_point(ending_voronoi_edge->vertex0()).cast(), end_source_point, *ending_voronoi_edge, prev_edge, start_source_point, end_source_point, segments); diff --git a/src/libslic3r/Arachne/SkeletalTrapezoidation.hpp b/src/libslic3r/Arachne/SkeletalTrapezoidation.hpp index 20f7b59186..b4c481263b 100644 --- a/src/libslic3r/Arachne/SkeletalTrapezoidation.hpp +++ b/src/libslic3r/Arachne/SkeletalTrapezoidation.hpp @@ -572,8 +572,6 @@ protected: * Genrate small segments for local maxima where the beading would only result in a single bead */ void generateLocalMaximaSingleBeads(); - - friend bool detect_voronoi_edge_intersecting_input_segment(const VD &voronoi_diagram, const std::vector &segments); }; } // namespace Slic3r::Arachne diff --git a/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.cpp b/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.cpp index 4629396e86..0f97b23db9 100644 --- a/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.cpp +++ b/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.cpp @@ -314,7 +314,7 @@ void SkeletalTrapezoidationGraph::collapseSmallEdges(coord_t snap_dist) } } -void SkeletalTrapezoidationGraph::makeRib(edge_t*& prev_edge, Point start_source_point, Point end_source_point, bool is_next_to_start_or_end) +void SkeletalTrapezoidationGraph::makeRib(edge_t*& prev_edge, Point start_source_point, Point end_source_point) { Point p; Line(start_source_point, end_source_point).distance_to_infinite_squared(prev_edge->to->p, &p); diff --git a/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.hpp b/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.hpp index efda323837..41c681f3e7 100644 --- a/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.hpp +++ b/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.hpp @@ -88,7 +88,7 @@ public: */ void collapseSmallEdges(coord_t snap_dist = 5); - void makeRib(edge_t*& prev_edge, Point start_source_point, Point end_source_point, bool is_next_to_start_or_end); + void makeRib(edge_t*& prev_edge, Point start_source_point, Point end_source_point); /*! * Insert a node into the graph and connect it to the input polygon using ribs diff --git a/src/libslic3r/Arachne/WallToolPaths.cpp b/src/libslic3r/Arachne/WallToolPaths.cpp index 086644e7fa..ff09dc7b28 100644 --- a/src/libslic3r/Arachne/WallToolPaths.cpp +++ b/src/libslic3r/Arachne/WallToolPaths.cpp @@ -6,7 +6,6 @@ #include "WallToolPaths.hpp" #include "SkeletalTrapezoidation.hpp" -#include "../ClipperUtils.hpp" #include "utils/linearAlg2D.hpp" #include "EdgeGrid.hpp" #include "utils/SparseLineGrid.hpp" diff --git a/src/libslic3r/Arachne/utils/ExtrusionJunction.cpp b/src/libslic3r/Arachne/utils/ExtrusionJunction.cpp deleted file mode 100644 index 3cdfa0d8d2..0000000000 --- a/src/libslic3r/Arachne/utils/ExtrusionJunction.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//Copyright (c) 2020 Ultimaker B.V. -//CuraEngine is released under the terms of the AGPLv3 or higher. - -#include "ExtrusionJunction.hpp" - -namespace Slic3r::Arachne -{ - -bool ExtrusionJunction::operator ==(const ExtrusionJunction& other) const -{ - return p == other.p - && w == other.w - && perimeter_index == other.perimeter_index; -} - -ExtrusionJunction::ExtrusionJunction(const Point p, const coord_t w, const coord_t perimeter_index) : p(p), w(w), perimeter_index(perimeter_index) {} - -} diff --git a/src/libslic3r/Arachne/utils/ExtrusionJunction.hpp b/src/libslic3r/Arachne/utils/ExtrusionJunction.hpp index 146525185f..49f721b5cc 100644 --- a/src/libslic3r/Arachne/utils/ExtrusionJunction.hpp +++ b/src/libslic3r/Arachne/utils/ExtrusionJunction.hpp @@ -37,9 +37,11 @@ struct ExtrusionJunction */ size_t perimeter_index; - ExtrusionJunction(const Point p, const coord_t w, const coord_t perimeter_index); + ExtrusionJunction(const Point p, const coord_t w, const coord_t perimeter_index) : p(p), w(w), perimeter_index(perimeter_index) {} - bool operator==(const ExtrusionJunction& other) const; + bool operator==(const ExtrusionJunction &other) const { + return p == other.p && w == other.w && perimeter_index == other.perimeter_index; + } }; inline Point operator-(const ExtrusionJunction& a, const ExtrusionJunction& b) diff --git a/src/libslic3r/Arachne/utils/ExtrusionLine.cpp b/src/libslic3r/Arachne/utils/ExtrusionLine.cpp index 82f0969048..7626b2b4b3 100644 --- a/src/libslic3r/Arachne/utils/ExtrusionLine.cpp +++ b/src/libslic3r/Arachne/utils/ExtrusionLine.cpp @@ -29,15 +29,6 @@ int64_t ExtrusionLine::getLength() const return len; } -coord_t ExtrusionLine::getMinimalWidth() const -{ - return std::min_element(junctions.cbegin(), junctions.cend(), - [](const ExtrusionJunction& l, const ExtrusionJunction& r) - { - return l.w < r.w; - })->w; -} - void ExtrusionLine::simplify(const int64_t smallest_line_segment_squared, const int64_t allowed_error_distance_squared, const int64_t maximum_extrusion_area_deviation) { const size_t min_path_size = is_closed ? 3 : 2; diff --git a/src/libslic3r/Arachne/utils/ExtrusionLine.hpp b/src/libslic3r/Arachne/utils/ExtrusionLine.hpp index 0eef4cd9aa..f153768762 100644 --- a/src/libslic3r/Arachne/utils/ExtrusionLine.hpp +++ b/src/libslic3r/Arachne/utils/ExtrusionLine.hpp @@ -136,11 +136,6 @@ struct ExtrusionLine return ret; } - /*! - * Get the minimal width of this path - */ - coord_t getMinimalWidth() const; - /*! * Removes vertices of the ExtrusionLines to make sure that they are not too high * resolution. diff --git a/src/libslic3r/Arachne/utils/SparsePointGrid.hpp b/src/libslic3r/Arachne/utils/SparsePointGrid.hpp index 7bb51d7038..127380b3eb 100644 --- a/src/libslic3r/Arachne/utils/SparsePointGrid.hpp +++ b/src/libslic3r/Arachne/utils/SparsePointGrid.hpp @@ -39,16 +39,6 @@ public: */ void insert(const Elem &elem); - /*! - * Get just any element that's within a certain radius of a point. - * - * Rather than giving a vector of nearby elements, this function just gives - * a single element, any element, in no particular order. - * \param query_pt The point to query for an object nearby. - * \param radius The radius of what is considered "nearby". - */ - const ElemT *getAnyNearby(const Point &query_pt, coord_t radius); - protected: using GridPoint = typename SparseGrid::GridPoint; @@ -68,22 +58,6 @@ void SparsePointGrid::insert(const Elem &elem) SparseGrid::m_grid.emplace(grid_loc, elem); } -template -const ElemT *SparsePointGrid::getAnyNearby(const Point &query_pt, coord_t radius) -{ - const ElemT *ret = nullptr; - const std::function &process_func = [&ret, query_pt, radius, this](const ElemT &maybe_nearby) { - if (shorter_then(m_locator(maybe_nearby) - query_pt, radius)) { - ret = &maybe_nearby; - return false; - } - return true; - }; - SparseGrid::processNearby(query_pt, radius, process_func); - - return ret; -} - } // namespace Slic3r::Arachne #endif // UTILS_SPARSE_POINT_GRID_H diff --git a/src/libslic3r/Arachne/utils/SquareGrid.cpp b/src/libslic3r/Arachne/utils/SquareGrid.cpp index ae89965795..856eb5968b 100644 --- a/src/libslic3r/Arachne/utils/SquareGrid.cpp +++ b/src/libslic3r/Arachne/utils/SquareGrid.cpp @@ -2,7 +2,6 @@ //CuraEngine is released under the terms of the AGPLv3 or higher. #include "SquareGrid.hpp" -#include "../../Point.hpp" using namespace Slic3r::Arachne; diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index 004de96040..5919143126 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -482,7 +482,6 @@ set(SLIC3R_SOURCES Arachne/BeadingStrategy/WideningBeadingStrategy.hpp Arachne/BeadingStrategy/WideningBeadingStrategy.cpp Arachne/utils/ExtrusionJunction.hpp - Arachne/utils/ExtrusionJunction.cpp Arachne/utils/ExtrusionLine.hpp Arachne/utils/ExtrusionLine.cpp Arachne/utils/HalfEdge.hpp