diff --git a/src/admesh/stl.h b/src/admesh/stl.h index 43999d365..fa0edec2b 100644 --- a/src/admesh/stl.h +++ b/src/admesh/stl.h @@ -90,7 +90,7 @@ struct stl_neighbors { struct stl_stats { stl_stats() { memset(&header, 0, 81); } - char header[81] = ""; + char header[81]; stl_type type = (stl_type)0; uint32_t number_of_facets = 0; stl_vertex max = stl_vertex::Zero(); diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index 78302e291..5232be2b6 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -100,7 +100,7 @@ add_library(libslic3r STATIC Geometry.cpp Geometry.hpp Int128.hpp - KdTreeIndirect.hpp + KDTreeIndirect.hpp Layer.cpp Layer.hpp LayerRegion.cpp diff --git a/src/libslic3r/KDTreeIndirect.hpp b/src/libslic3r/KDTreeIndirect.hpp index e7526210d..3cccfdafa 100644 --- a/src/libslic3r/KDTreeIndirect.hpp +++ b/src/libslic3r/KDTreeIndirect.hpp @@ -19,7 +19,10 @@ public: static constexpr size_t NumDimensions = ANumDimensions; using CoordinateFn = ACoordinateFn; using CoordType = ACoordType; - static constexpr size_t npos = size_t(-1); + // Following could be static constexpr size_t, but that would not link in C++11 + enum : size_t { + npos = size_t(-1) + }; KDTreeIndirect(CoordinateFn coordinate) : coordinate(coordinate) {} KDTreeIndirect(CoordinateFn coordinate, std::vector indices) : coordinate(coordinate) { this->build(std::move(indices)); } @@ -71,7 +74,7 @@ public: template void visit(Visitor &visitor) const { - return m_nodes.empty() ? npos : visit_recursive(0, 0, visitor); + visit_recursive(0, 0, visitor); } CoordinateFn coordinate; diff --git a/src/libslic3r/ShortestPath.cpp b/src/libslic3r/ShortestPath.cpp index 0fc16e74a..3e6cf166a 100644 --- a/src/libslic3r/ShortestPath.cpp +++ b/src/libslic3r/ShortestPath.cpp @@ -4,6 +4,7 @@ #undef assert #endif +#include "clipper.hpp" #include "ShortestPath.hpp" #include "KDTreeIndirect.hpp" #include "MutablePriorityQueue.hpp" @@ -72,7 +73,7 @@ std::vector> chain_segments_greedy_constrained_reversals { // Just sort the end points so that the first point visited is closest to start_near. out.emplace_back(0, start_near != nullptr && - (end_point_func(0, true) - *start_near).cast().squaredNorm() < (end_point_func(0, false) - *start_near).cast().squaredNorm()); + (end_point_func(0, true) - *start_near).template cast().squaredNorm() < (end_point_func(0, false) - *start_near).template cast().squaredNorm()); } else { @@ -93,8 +94,8 @@ std::vector> chain_segments_greedy_constrained_reversals std::vector end_points; end_points.reserve(num_segments * 2); for (size_t i = 0; i < num_segments; ++ i) { - end_points.emplace_back(end_point_func(i, true ).cast()); - end_points.emplace_back(end_point_func(i, false).cast()); + end_points.emplace_back(end_point_func(i, true ).template cast()); + end_points.emplace_back(end_point_func(i, false).template cast()); } // Construct the closest point KD tree over end points of segments. @@ -163,7 +164,7 @@ std::vector> chain_segments_greedy_constrained_reversals EndPoint *first_point = nullptr; size_t first_point_idx = std::numeric_limits::max(); if (start_near != nullptr) { - size_t idx = find_closest_point(kdtree, start_near->cast()); + size_t idx = find_closest_point(kdtree, start_near->template cast()); assert(idx < end_points.size()); first_point = &end_points[idx]; first_point->distance_out = 0.; @@ -405,7 +406,7 @@ std::vector> chain_extrusion_entities(std::vector &entities, std::vector> &chain) +void reorder_extrusion_entities(std::vector &entities, const std::vector> &chain) { assert(entities.size() == chain.size()); std::vector out; @@ -459,7 +460,7 @@ std::vector chain_points(const Points &points, Point *start_near) return out; } -Polylines chain_polylines(Polylines &polylines, const Point *start_near) +Polylines chain_polylines(Polylines &&polylines, const Point *start_near) { auto segment_end_point = [&polylines](size_t idx, bool first_point) -> const Point& { return first_point ? polylines[idx].first_point() : polylines[idx].last_point(); }; std::vector> ordered = chain_segments_greedy(segment_end_point, polylines.size(), start_near); diff --git a/src/libslic3r/ShortestPath.hpp b/src/libslic3r/ShortestPath.hpp index 81e2c20e1..1b91b59cb 100644 --- a/src/libslic3r/ShortestPath.hpp +++ b/src/libslic3r/ShortestPath.hpp @@ -15,14 +15,14 @@ namespace Slic3r { std::vector chain_points(const Points &points, Point *start_near = nullptr); std::vector> chain_extrusion_entities(std::vector &entities, const Point *start_near = nullptr); -void reorder_extrusion_entities(std::vector &entities, std::vector> &chain); +void reorder_extrusion_entities(std::vector &entities, const std::vector> &chain); void chain_and_reorder_extrusion_entities(std::vector &entities, const Point *start_near = nullptr); std::vector> chain_extrusion_paths(std::vector &extrusion_paths, const Point *start_near = nullptr); void reorder_extrusion_paths(std::vector &extrusion_paths, std::vector> &chain); void chain_and_reorder_extrusion_paths(std::vector &extrusion_paths, const Point *start_near = nullptr); -Polylines chain_polylines(Polylines &src, const Point *start_near = nullptr); +Polylines chain_polylines(Polylines &&src, const Point *start_near = nullptr); std::vector chain_clipper_polynodes(const Points &points, const std::vector &items);