From 7fbdda90803fc2653e2bddc6217ef641acb35578 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Mon, 5 Oct 2020 16:38:28 +0200 Subject: [PATCH] Renamed monotonous infill to monotonic. --- src/libslic3r/Fill/Fill.cpp | 4 +- src/libslic3r/Fill/FillAdaptive.cpp | 2 +- src/libslic3r/Fill/FillBase.cpp | 2 +- src/libslic3r/Fill/FillBase.hpp | 4 +- src/libslic3r/Fill/FillRectilinear2.cpp | 162 ++++++++++++------------ src/libslic3r/Fill/FillRectilinear2.hpp | 6 +- src/libslic3r/PrintConfig.cpp | 6 +- src/libslic3r/PrintConfig.hpp | 4 +- src/libslic3r/PrintObject.cpp | 2 +- 9 files changed, 96 insertions(+), 96 deletions(-) diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index 03aa798dc..3e24d502d 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -535,7 +535,7 @@ void Layer::make_ironing() fill_params.density = 1.; // fill_params.dont_connect = true; fill_params.dont_connect = false; - fill_params.monotonous = true; + fill_params.monotonic = true; for (size_t i = 0; i < by_extruder.size(); ++ i) { // Find span of regions equivalent to the ironing operation. @@ -579,7 +579,7 @@ void Layer::make_ironing() // Save into layer. ExtrusionEntityCollection *eec = nullptr; ironing_params.layerm->fills.entities.push_back(eec = new ExtrusionEntityCollection()); - // Don't sort the ironing infill lines as they are monotonously ordered. + // Don't sort the ironing infill lines as they are monotonicly ordered. eec->no_sort = true; extrusion_entities_append_paths( eec->entities, std::move(polylines), diff --git a/src/libslic3r/Fill/FillAdaptive.cpp b/src/libslic3r/Fill/FillAdaptive.cpp index 7813d64a3..ba13b2a97 100644 --- a/src/libslic3r/Fill/FillAdaptive.cpp +++ b/src/libslic3r/Fill/FillAdaptive.cpp @@ -221,7 +221,7 @@ static const std::array child_centers { }; // Traversal order of octree children cells for three infill directions, -// so that a single line will be discretized in a strictly monotonous order. +// so that a single line will be discretized in a strictly monotonic order. static constexpr std::array, 3> child_traversal_order { std::array{ 2, 3, 0, 1, 6, 7, 4, 5 }, std::array{ 4, 0, 6, 2, 5, 1, 7, 3 }, diff --git a/src/libslic3r/Fill/FillBase.cpp b/src/libslic3r/Fill/FillBase.cpp index fc5f548a3..07ab2d59f 100644 --- a/src/libslic3r/Fill/FillBase.cpp +++ b/src/libslic3r/Fill/FillBase.cpp @@ -28,7 +28,7 @@ Fill* Fill::new_from_type(const InfillPattern type) case ip3DHoneycomb: return new Fill3DHoneycomb(); case ipGyroid: return new FillGyroid(); case ipRectilinear: return new FillRectilinear2(); - case ipMonotonous: return new FillMonotonous(); + case ipMonotonic: return new FillMonotonic(); case ipLine: return new FillLine(); case ipGrid: return new FillGrid2(); case ipTriangles: return new FillTriangles(); diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index 0779117eb..e25480fa5 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -43,8 +43,8 @@ struct FillParams // Don't adjust spacing to fill the space evenly. bool dont_adjust { true }; - // Monotonous infill - strictly left to right for better surface quality of top infills. - bool monotonous { false }; + // Monotonic infill - strictly left to right for better surface quality of top infills. + bool monotonic { false }; // For Honeycomb. // we were requested to complete each loop; diff --git a/src/libslic3r/Fill/FillRectilinear2.cpp b/src/libslic3r/Fill/FillRectilinear2.cpp index 5b862e8cb..0c4589200 100644 --- a/src/libslic3r/Fill/FillRectilinear2.cpp +++ b/src/libslic3r/Fill/FillRectilinear2.cpp @@ -1387,7 +1387,7 @@ static void traverse_graph_generate_polylines( } } -struct MonotonousRegion +struct MonotonicRegion { struct Boundary { int vline; @@ -1412,13 +1412,13 @@ struct MonotonousRegion #if NDEBUG // Left regions are used to track whether all regions left to this one have already been printed. - boost::container::small_vector left_neighbors; + boost::container::small_vector left_neighbors; // Right regions are held to pick a next region to be extruded using the "Ant colony" heuristics. - boost::container::small_vector right_neighbors; + boost::container::small_vector right_neighbors; #else // For debugging, use the normal vector as it is better supported by debug visualizers. - std::vector left_neighbors; - std::vector right_neighbors; + std::vector left_neighbors; + std::vector right_neighbors; #endif }; @@ -1429,9 +1429,9 @@ struct AntPath float pheromone { 0 }; // <0, 1> }; -struct MonotonousRegionLink +struct MonotonicRegionLink { - MonotonousRegion *region; + MonotonicRegion *region; bool flipped; // Distance of right side of this region to left side of the next region, if the "flipped" flag of this region and the next region // is applied as defined. @@ -1447,7 +1447,7 @@ class AntPathMatrix { public: AntPathMatrix( - const std::vector ®ions, + const std::vector ®ions, const ExPolygonWithOffset &poly_with_offset, const std::vector &segs, const float initial_pheromone) : @@ -1463,7 +1463,7 @@ public: ap.pheromone = initial_pheromone; } - AntPath& operator()(const MonotonousRegion ®ion_from, bool flipped_from, const MonotonousRegion ®ion_to, bool flipped_to) + AntPath& operator()(const MonotonicRegion ®ion_from, bool flipped_from, const MonotonicRegion ®ion_to, bool flipped_to) { int row = 2 * int(®ion_from - m_regions.data()) + flipped_from; int col = 2 * int(®ion_to - m_regions.data()) + flipped_to; @@ -1490,16 +1490,16 @@ public: return path; } - AntPath& operator()(const MonotonousRegionLink ®ion_from, const MonotonousRegion ®ion_to, bool flipped_to) + AntPath& operator()(const MonotonicRegionLink ®ion_from, const MonotonicRegion ®ion_to, bool flipped_to) { return (*this)(*region_from.region, region_from.flipped, region_to, flipped_to); } - AntPath& operator()(const MonotonousRegion ®ion_from, bool flipped_from, const MonotonousRegionLink ®ion_to) + AntPath& operator()(const MonotonicRegion ®ion_from, bool flipped_from, const MonotonicRegionLink ®ion_to) { return (*this)(region_from, flipped_from, *region_to.region, region_to.flipped); } - AntPath& operator()(const MonotonousRegionLink ®ion_from, const MonotonousRegionLink ®ion_to) + AntPath& operator()(const MonotonicRegionLink ®ion_from, const MonotonicRegionLink ®ion_to) { return (*this)(*region_from.region, region_from.flipped, *region_to.region, region_to.flipped); } private: // Source regions, used for addressing and updating m_matrix. - const std::vector &m_regions; + const std::vector &m_regions; // To calculate the intersection points and contour lengths. const ExPolygonWithOffset &m_poly_with_offset; const std::vector &m_segs; @@ -1652,9 +1652,9 @@ static std::pair right_overlap(std:: return start_end.first == nullptr ? start_end : right_overlap(*start_end.first, *start_end.second, vline_this, vline_right); } -static std::vector generate_montonous_regions(std::vector &segs) +static std::vector generate_montonous_regions(std::vector &segs) { - std::vector monotonous_regions; + std::vector monotonic_regions; #ifndef NDEBUG #define SLIC3R_DEBUG_MONOTONOUS_REGIONS @@ -1685,11 +1685,11 @@ static std::vector generate_montonous_regions(std::vectorconsumed_vertical_up) { - // Draw a new monotonous region starting with this segment. + // Draw a new monotonic region starting with this segment. // while there is only a single right neighbor int i_vline = i_vline_seed; std::pair left(start, end); - MonotonousRegion region; + MonotonicRegion region; region.left.vline = i_vline; region.left.low = int(left.first - vline_seed.intersections.data()); region.left.high = int(left.second - vline_seed.intersections.data()); @@ -1722,19 +1722,19 @@ static std::vector generate_montonous_regions(std::vector &segs) +static float montonous_region_path_length(const MonotonicRegion ®ion, bool dir, const ExPolygonWithOffset &poly_with_offset, const std::vector &segs) { // From the initial point (i_vline, i_intersection), follow a path. int i_intersection = region.left_intersection_point(dir); @@ -1822,15 +1822,15 @@ static float montonous_region_path_length(const MonotonousRegion ®ion, bool d return unscale(total_length); } -static void connect_monotonous_regions(std::vector ®ions, const ExPolygonWithOffset &poly_with_offset, std::vector &segs) +static void connect_monotonic_regions(std::vector ®ions, const ExPolygonWithOffset &poly_with_offset, std::vector &segs) { - // Map from low intersection to left / right side of a monotonous region. - using MapType = std::pair; + // Map from low intersection to left / right side of a monotonic region. + using MapType = std::pair; std::vector map_intersection_to_region_start; std::vector map_intersection_to_region_end; map_intersection_to_region_start.reserve(regions.size()); map_intersection_to_region_end.reserve(regions.size()); - for (MonotonousRegion ®ion : regions) { + for (MonotonicRegion ®ion : regions) { map_intersection_to_region_start.emplace_back(&segs[region.left.vline].intersections[region.left.low], ®ion); map_intersection_to_region_end.emplace_back(&segs[region.right.vline].intersections[region.right.low], ®ion); } @@ -1840,7 +1840,7 @@ static void connect_monotonous_regions(std::vector ®ions, c std::sort(map_intersection_to_region_end.begin(), map_intersection_to_region_end.end(), intersections_lower); // Scatter links to neighboring regions. - for (MonotonousRegion ®ion : regions) { + for (MonotonicRegion ®ion : regions) { if (region.left.vline > 0) { auto &vline = segs[region.left.vline]; auto &vline_left = segs[region.left.vline - 1]; @@ -1884,17 +1884,17 @@ static void connect_monotonous_regions(std::vector ®ions, c // Sometimes a segment may indicate that it connects to a segment on the other side while the other does not. // This may be a valid case if one side contains runs of OUTER_LOW, INNER_LOW, {INNER_HIGH, INNER_LOW}*, INNER_HIGH, OUTER_HIGH, // where the part in the middle does not connect to the other side, but it will be extruded through. - for (MonotonousRegion ®ion : regions) { + for (MonotonicRegion ®ion : regions) { std::sort(region.left_neighbors.begin(), region.left_neighbors.end()); std::sort(region.right_neighbors.begin(), region.right_neighbors.end()); } - for (MonotonousRegion ®ion : regions) { - for (MonotonousRegion *neighbor : region.left_neighbors) { + for (MonotonicRegion ®ion : regions) { + for (MonotonicRegion *neighbor : region.left_neighbors) { auto it = std::lower_bound(neighbor->right_neighbors.begin(), neighbor->right_neighbors.end(), ®ion); if (it == neighbor->right_neighbors.end() || *it != ®ion) neighbor->right_neighbors.insert(it, ®ion); } - for (MonotonousRegion *neighbor : region.right_neighbors) { + for (MonotonicRegion *neighbor : region.right_neighbors) { auto it = std::lower_bound(neighbor->left_neighbors.begin(), neighbor->left_neighbors.end(), ®ion); if (it == neighbor->left_neighbors.end() || *it != ®ion) neighbor->left_neighbors.insert(it, ®ion); @@ -1903,12 +1903,12 @@ static void connect_monotonous_regions(std::vector ®ions, c #ifndef NDEBUG // Verify symmetry of the left_neighbors / right_neighbors. - for (MonotonousRegion ®ion : regions) { - for (MonotonousRegion *neighbor : region.left_neighbors) { + for (MonotonicRegion ®ion : regions) { + for (MonotonicRegion *neighbor : region.left_neighbors) { assert(std::count(region.left_neighbors.begin(), region.left_neighbors.end(), neighbor) == 1); assert(std::find(neighbor->right_neighbors.begin(), neighbor->right_neighbors.end(), ®ion) != neighbor->right_neighbors.end()); } - for (MonotonousRegion *neighbor : region.right_neighbors) { + for (MonotonicRegion *neighbor : region.right_neighbors) { assert(std::count(region.right_neighbors.begin(), region.right_neighbors.end(), neighbor) == 1); assert(std::find(neighbor->left_neighbors.begin(), neighbor->left_neighbors.end(), ®ion) != neighbor->left_neighbors.end()); } @@ -1916,7 +1916,7 @@ static void connect_monotonous_regions(std::vector ®ions, c #endif /* NDEBUG */ // Fill in sum length of connecting lines of a region. This length is used for optimizing the infill path for minimum length. - for (MonotonousRegion ®ion : regions) { + for (MonotonicRegion ®ion : regions) { region.len1 = montonous_region_path_length(region, false, poly_with_offset, segs); region.len2 = montonous_region_path_length(region, true, poly_with_offset, segs); // Subtract the smaller length from the longer one, so we will optimize just with the positive difference of the two. @@ -1934,7 +1934,7 @@ static void connect_monotonous_regions(std::vector ®ions, c // https://www.chalmers.se/en/departments/math/research/research-groups/optimization/OptimizationMasterTheses/MScThesis-RaadSalman-final.pdf // Algorithm 6.1 Lexicographic Path Preserving 3-opt // Optimize path while maintaining the ordering constraints. -void monotonous_3_opt(std::vector &path, const std::vector &segs) +void monotonic_3_opt(std::vector &path, const std::vector &segs) { // When doing the 3-opt path preserving flips, one has to fulfill two constraints: // @@ -1949,7 +1949,7 @@ void monotonous_3_opt(std::vector &path, const std::vector // then the precedence constraint verification is amortized inside the O(n^3) loop. Now which is better for our task? // // It is beneficial to also try flipping of the infill zig-zags, for which a prefix sum of both flipped and non-flipped paths over - // MonotonousRegionLinks may be utilized, however updating the prefix sum has a linear complexity, the same complexity as doing the 3-opt + // MonotonicRegionLinks may be utilized, however updating the prefix sum has a linear complexity, the same complexity as doing the 3-opt // exchange by copying the pieces. } @@ -1962,17 +1962,17 @@ inline void print_ant(const std::string& fmt, TArgs&&... args) { #endif } -// Find a run through monotonous infill blocks using an 'Ant colony" optimization method. +// Find a run through monotonic infill blocks using an 'Ant colony" optimization method. // http://www.scholarpedia.org/article/Ant_colony_optimization -static std::vector chain_monotonous_regions( - std::vector ®ions, const ExPolygonWithOffset &poly_with_offset, const std::vector &segs, std::mt19937_64 &rng) +static std::vector chain_monotonic_regions( + std::vector ®ions, const ExPolygonWithOffset &poly_with_offset, const std::vector &segs, std::mt19937_64 &rng) { // Number of left neighbors (regions that this region depends on, this region cannot be printed before the regions left of it are printed) + self. std::vector left_neighbors_unprocessed(regions.size(), 1); // Queue of regions, which have their left neighbors already printed. - std::vector queue; + std::vector queue; queue.reserve(regions.size()); - for (MonotonousRegion ®ion : regions) + for (MonotonicRegion ®ion : regions) if (region.left_neighbors.empty()) queue.emplace_back(®ion); else @@ -1981,13 +1981,13 @@ static std::vector chain_monotonous_regions( auto left_neighbors_unprocessed_initial = left_neighbors_unprocessed; auto queue_initial = queue; - std::vector path, best_path; + std::vector path, best_path; path.reserve(regions.size()); best_path.reserve(regions.size()); float best_path_length = std::numeric_limits::max(); struct NextCandidate { - MonotonousRegion *region; + MonotonicRegion *region; AntPath *link; AntPath *link_flipped; float probability; @@ -2002,22 +2002,22 @@ static std::vector chain_monotonous_regions( [®ions, &left_neighbors_unprocessed, &path, &queue]() { std::vector regions_processed(regions.size(), false); std::vector regions_in_queue(regions.size(), false); - for (const MonotonousRegion *region : queue) { + for (const MonotonicRegion *region : queue) { // This region is not processed yet, his predecessors are processed. assert(left_neighbors_unprocessed[region - regions.data()] == 1); regions_in_queue[region - regions.data()] = true; } - for (const MonotonousRegionLink &link : path) { + for (const MonotonicRegionLink &link : path) { assert(left_neighbors_unprocessed[link.region - regions.data()] == 0); regions_processed[link.region - regions.data()] = true; } for (size_t i = 0; i < regions_processed.size(); ++ i) { assert(! regions_processed[i] || ! regions_in_queue[i]); - const MonotonousRegion ®ion = regions[i]; + const MonotonicRegion ®ion = regions[i]; if (regions_processed[i] || regions_in_queue[i]) { assert(left_neighbors_unprocessed[i] == (regions_in_queue[i] ? 1 : 0)); // All left neighbors should be processed already. - for (const MonotonousRegion *left : region.left_neighbors) { + for (const MonotonicRegion *left : region.left_neighbors) { assert(regions_processed[left - regions.data()]); assert(left_neighbors_unprocessed[left - regions.data()] == 0); } @@ -2026,7 +2026,7 @@ static std::vector chain_monotonous_regions( assert(left_neighbors_unprocessed[i] > 1); size_t num_predecessors_unprocessed = 0; bool has_left_last_on_path = false; - for (const MonotonousRegion* left : region.left_neighbors) { + for (const MonotonicRegion* left : region.left_neighbors) { size_t iprev = left - regions.data(); if (regions_processed[iprev]) { assert(left_neighbors_unprocessed[iprev] == 0); @@ -2080,18 +2080,18 @@ static std::vector chain_monotonous_regions( left_neighbors_unprocessed = left_neighbors_unprocessed_initial; assert(validate_unprocessed()); // Pick the last of the queue. - MonotonousRegionLink path_end { queue.back(), false }; + MonotonicRegionLink path_end { queue.back(), false }; queue.pop_back(); -- left_neighbors_unprocessed[path_end.region - regions.data()]; float total_length = path_end.region->length(false); while (! queue.empty() || ! path_end.region->right_neighbors.empty()) { // Chain. - MonotonousRegion ®ion = *path_end.region; + MonotonicRegion ®ion = *path_end.region; bool dir = path_end.flipped; NextCandidate next_candidate; next_candidate.probability = 0; - for (MonotonousRegion *next : region.right_neighbors) { + for (MonotonicRegion *next : region.right_neighbors) { int &unprocessed = left_neighbors_unprocessed[next - regions.data()]; assert(unprocessed > 1); if (left_neighbors_unprocessed[next - regions.data()] == 2) { @@ -2106,7 +2106,7 @@ static std::vector chain_monotonous_regions( } bool from_queue = next_candidate.probability == 0; if (from_queue) { - for (MonotonousRegion *next : queue) { + for (MonotonicRegion *next : queue) { AntPath &path1 = path_matrix(region, dir, *next, false); AntPath &path2 = path_matrix(region, dir, *next, true); if (path1.visibility > next_candidate.probability) @@ -2116,7 +2116,7 @@ static std::vector chain_monotonous_regions( } } // Move the other right neighbors with satisified constraints to the queue. - for (MonotonousRegion *next : region.right_neighbors) + for (MonotonicRegion *next : region.right_neighbors) if (-- left_neighbors_unprocessed[next - regions.data()] == 1 && next_candidate.region != next) queue.emplace_back(next); if (from_queue) { @@ -2127,7 +2127,7 @@ static std::vector chain_monotonous_regions( queue.pop_back(); } // Extend the path. - MonotonousRegion *next_region = next_candidate.region; + MonotonicRegion *next_region = next_candidate.region; bool next_dir = next_candidate.dir; total_length += next_region->length(next_dir) + path_matrix(*path_end.region, path_end.flipped, *next_region, next_dir).length; path_end = { next_region, next_dir }; @@ -2140,7 +2140,7 @@ static std::vector chain_monotonous_regions( path_matrix.update_inital_pheromone(pheromone_initial_deposit); } - // Probability (unnormalized) of traversing a link between two monotonous regions. + // Probability (unnormalized) of traversing a link between two monotonic regions. auto path_probability = [pheromone_alpha, pheromone_beta](AntPath &path) { return pow(path.pheromone, pheromone_alpha) * pow(path.visibility, pheromone_beta); }; @@ -2163,10 +2163,10 @@ static std::vector chain_monotonous_regions( left_neighbors_unprocessed = left_neighbors_unprocessed_initial; assert(validate_unprocessed()); // Pick randomly the first from the queue at random orientation. - //FIXME picking the 1st monotonous region should likely be done based on accumulated pheromone level as well, - // but the inefficiency caused by the random pick of the 1st monotonous region is likely insignificant. + //FIXME picking the 1st monotonic region should likely be done based on accumulated pheromone level as well, + // but the inefficiency caused by the random pick of the 1st monotonic region is likely insignificant. int first_idx = std::uniform_int_distribution<>(0, int(queue.size()) - 1)(rng); - path.emplace_back(MonotonousRegionLink{ queue[first_idx], rng() > rng.max() / 2 }); + path.emplace_back(MonotonicRegionLink{ queue[first_idx], rng() > rng.max() / 2 }); *(queue.begin() + first_idx) = std::move(queue.back()); queue.pop_back(); -- left_neighbors_unprocessed[path.back().region - regions.data()]; @@ -2182,12 +2182,12 @@ static std::vector chain_monotonous_regions( while (! queue.empty() || ! path.back().region->right_neighbors.empty()) { // Chain. - MonotonousRegion ®ion = *path.back().region; + MonotonicRegion ®ion = *path.back().region; bool dir = path.back().flipped; // Sort by distance to pt. next_candidates.clear(); next_candidates.reserve(region.right_neighbors.size() * 2); - for (MonotonousRegion *next : region.right_neighbors) { + for (MonotonicRegion *next : region.right_neighbors) { int &unprocessed = left_neighbors_unprocessed[next - regions.data()]; assert(unprocessed > 1); if (-- unprocessed == 1) { @@ -2204,7 +2204,7 @@ static std::vector chain_monotonous_regions( //FIXME add the queue items to the candidates? These are valid moves as well. if (num_direct_neighbors == 0) { // Add the queue candidates. - for (MonotonousRegion *next : queue) { + for (MonotonicRegion *next : queue) { assert(left_neighbors_unprocessed[next - regions.data()] == 1); AntPath &path1 = path_matrix(region, dir, *next, false); AntPath &path1_flipped = path_matrix(region, ! dir, *next, true); @@ -2247,11 +2247,11 @@ static std::vector chain_monotonous_regions( queue.pop_back(); } // Extend the path. - MonotonousRegion *next_region = take_path->region; + MonotonicRegion *next_region = take_path->region; bool next_dir = take_path->dir; path.back().next = take_path->link; path.back().next_flipped = take_path->link_flipped; - path.emplace_back(MonotonousRegionLink{ next_region, next_dir }); + path.emplace_back(MonotonicRegionLink{ next_region, next_dir }); assert(left_neighbors_unprocessed[next_region - regions.data()] == 1); left_neighbors_unprocessed[next_region - regions.data()] = 0; print_ant("\tRegion (%1%:%2%,%3%) (%4%:%5%,%6%) length to prev %7%", @@ -2279,14 +2279,14 @@ static std::vector chain_monotonous_regions( } // Perform 3-opt local optimization of the path. - monotonous_3_opt(path, segs); + monotonic_3_opt(path, segs); // Measure path length. assert(! path.empty()); float path_length = std::accumulate(path.begin(), path.end() - 1, path.back().region->length(path.back().flipped), - [&path_matrix](const float l, const MonotonousRegionLink &r) { - const MonotonousRegionLink &next = *(&r + 1); + [&path_matrix](const float l, const MonotonicRegionLink &r) { + const MonotonicRegionLink &next = *(&r + 1); return l + r.region->length(r.flipped) + path_matrix(*r.region, r.flipped, *next.region, next.flipped).length; }); // Save the shortest path. @@ -2309,7 +2309,7 @@ static std::vector chain_monotonous_regions( // Reinforce the path pheromones with the best path. float total_cost = best_path_length + float(EPSILON); for (size_t i = 0; i + 1 < path.size(); ++ i) { - MonotonousRegionLink &link = path[i]; + MonotonicRegionLink &link = path[i]; link.next->pheromone = (1.f - pheromone_evaporation) * link.next->pheromone + pheromone_evaporation / total_cost; } @@ -2324,7 +2324,7 @@ end: } // Traverse path, produce polylines. -static void polylines_from_paths(const std::vector &path, const ExPolygonWithOffset &poly_with_offset, const std::vector &segs, Polylines &polylines_out) +static void polylines_from_paths(const std::vector &path, const ExPolygonWithOffset &poly_with_offset, const std::vector &segs, Polylines &polylines_out) { Polyline *polyline = nullptr; auto finish_polyline = [&polyline, &polylines_out]() { @@ -2340,8 +2340,8 @@ static void polylines_from_paths(const std::vector &path, polyline = nullptr; }; - for (const MonotonousRegionLink &path_segment : path) { - MonotonousRegion ®ion = *path_segment.region; + for (const MonotonicRegionLink &path_segment : path) { + MonotonicRegion ®ion = *path_segment.region; bool dir = path_segment.flipped; // From the initial point (i_vline, i_intersection), follow a path. @@ -2350,8 +2350,8 @@ static void polylines_from_paths(const std::vector &path, if (polyline != nullptr && &path_segment != path.data()) { // Connect previous path segment with the new one. - const MonotonousRegionLink &path_segment_prev = *(&path_segment - 1); - const MonotonousRegion ®ion_prev = *path_segment_prev.region; + const MonotonicRegionLink &path_segment_prev = *(&path_segment - 1); + const MonotonicRegion ®ion_prev = *path_segment_prev.region; bool dir_prev = path_segment_prev.flipped; int i_vline_prev = region_prev.right.vline; const SegmentedIntersectionLine &vline_prev = segs[i_vline_prev]; @@ -2456,7 +2456,7 @@ static void polylines_from_paths(const std::vector &path, if (polyline != nullptr) { // Finish the current vertical line, - const MonotonousRegion ®ion = *path.back().region; + const MonotonicRegion ®ion = *path.back().region; const SegmentedIntersectionLine &vline = segs[region.right.vline]; const SegmentIntersection *ip = &vline.intersections[region.right_intersection_point(path.back().flipped)]; assert(ip->is_inner()); @@ -2558,14 +2558,14 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP svg.Close(); #endif /* SLIC3R_DEBUG */ - //FIXME this is a hack to get the monotonous infill rolling. We likely want a smarter switch, likely based on user decison. - bool monotonous_infill = params.monotonous; // || params.density > 0.99; - if (monotonous_infill) { - std::vector regions = generate_montonous_regions(segs); - connect_monotonous_regions(regions, poly_with_offset, segs); + //FIXME this is a hack to get the monotonic infill rolling. We likely want a smarter switch, likely based on user decison. + bool monotonic_infill = params.monotonic; // || params.density > 0.99; + if (monotonic_infill) { + std::vector regions = generate_montonous_regions(segs); + connect_monotonic_regions(regions, poly_with_offset, segs); if (! regions.empty()) { std::mt19937_64 rng; - std::vector path = chain_monotonous_regions(regions, poly_with_offset, segs, rng); + std::vector path = chain_monotonic_regions(regions, poly_with_offset, segs, rng); polylines_from_paths(path, poly_with_offset, segs, polylines_out); } } else @@ -2616,13 +2616,13 @@ Polylines FillRectilinear2::fill_surface(const Surface *surface, const FillParam return polylines_out; } -Polylines FillMonotonous::fill_surface(const Surface *surface, const FillParams ¶ms) +Polylines FillMonotonic::fill_surface(const Surface *surface, const FillParams ¶ms) { FillParams params2 = params; - params2.monotonous = true; + params2.monotonic = true; Polylines polylines_out; if (! fill_surface_by_lines(surface, params2, 0.f, 0.f, polylines_out)) { - printf("FillMonotonous::fill_surface() failed to fill a region.\n"); + printf("FillMonotonic::fill_surface() failed to fill a region.\n"); } return polylines_out; } diff --git a/src/libslic3r/Fill/FillRectilinear2.hpp b/src/libslic3r/Fill/FillRectilinear2.hpp index 3fe95f19c..fd28f155d 100644 --- a/src/libslic3r/Fill/FillRectilinear2.hpp +++ b/src/libslic3r/Fill/FillRectilinear2.hpp @@ -20,11 +20,11 @@ protected: bool fill_surface_by_lines(const Surface *surface, const FillParams ¶ms, float angleBase, float pattern_shift, Polylines &polylines_out); }; -class FillMonotonous : public FillRectilinear2 +class FillMonotonic : public FillRectilinear2 { public: - virtual Fill* clone() const { return new FillMonotonous(*this); }; - virtual ~FillMonotonous() = default; + virtual Fill* clone() const { return new FillMonotonic(*this); }; + virtual ~FillMonotonic() = default; virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms); virtual bool no_sort() const { return true; } }; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index f4b0de707..94f1e90f9 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -457,20 +457,20 @@ void PrintConfigDef::init_fff_params() def->cli = "top-fill-pattern|external-fill-pattern|solid-fill-pattern"; def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); def->enum_values.push_back("rectilinear"); - def->enum_values.push_back("monotonous"); + def->enum_values.push_back("monotonic"); def->enum_values.push_back("concentric"); def->enum_values.push_back("hilbertcurve"); def->enum_values.push_back("archimedeanchords"); def->enum_values.push_back("octagramspiral"); def->enum_labels.push_back(L("Rectilinear")); - def->enum_labels.push_back(L("Monotonous")); + def->enum_labels.push_back(L("Monotonic")); def->enum_labels.push_back(L("Concentric")); def->enum_labels.push_back(L("Hilbert Curve")); def->enum_labels.push_back(L("Archimedean Chords")); def->enum_labels.push_back(L("Octagram Spiral")); // solid_fill_pattern is an obsolete equivalent to top_fill_pattern/bottom_fill_pattern. def->aliases = { "solid_fill_pattern", "external_fill_pattern" }; - def->set_default_value(new ConfigOptionEnum(ipMonotonous)); + def->set_default_value(new ConfigOptionEnum(ipMonotonic)); def = this->add("bottom_fill_pattern", coEnum); def->label = L("Bottom fill pattern"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 9151fd809..05e907200 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -45,7 +45,7 @@ enum AuthorizationType { }; enum InfillPattern : int { - ipRectilinear, ipMonotonous, ipGrid, ipTriangles, ipStars, ipCubic, ipLine, ipConcentric, ipHoneycomb, ip3DHoneycomb, + ipRectilinear, ipMonotonic, ipGrid, ipTriangles, ipStars, ipCubic, ipLine, ipConcentric, ipHoneycomb, ip3DHoneycomb, ipGyroid, ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral, ipAdaptiveCubic, ipSupportCubic, ipCount, }; @@ -143,7 +143,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum::g static t_config_enum_values keys_map; if (keys_map.empty()) { keys_map["rectilinear"] = ipRectilinear; - keys_map["monotonous"] = ipMonotonous; + keys_map["monotonic"] = ipMonotonic; keys_map["grid"] = ipGrid; keys_map["triangles"] = ipTriangles; keys_map["stars"] = ipStars; diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 6f26d8b9d..6f0372ef4 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -2706,7 +2706,7 @@ void PrintObject::combine_infill() // Because fill areas for rectilinear and honeycomb are grown // later to overlap perimeters, we need to counteract that too. ((region->config().fill_pattern == ipRectilinear || - region->config().fill_pattern == ipMonotonous || + region->config().fill_pattern == ipMonotonic || region->config().fill_pattern == ipGrid || region->config().fill_pattern == ipLine || region->config().fill_pattern == ipHoneycomb) ? 1.5f : 0.5f) *