diff --git a/src/libseqarrange/include/libseqarrange/seq_interface.hpp b/src/libseqarrange/include/libseqarrange/seq_interface.hpp index cea7d80d07..aa09fa4210 100644 --- a/src/libseqarrange/include/libseqarrange/seq_interface.hpp +++ b/src/libseqarrange/include/libseqarrange/seq_interface.hpp @@ -78,6 +78,7 @@ struct SolverConfiguration int max_refines; int object_group_size; + int fixed_object_grouping_limit; int temporal_spread; DecimationPrecision decimation_precision; diff --git a/src/libseqarrange/src/seq_interface.cpp b/src/libseqarrange/src/seq_interface.cpp index 0379fb060c..e3780fa358 100644 --- a/src/libseqarrange/src/seq_interface.cpp +++ b/src/libseqarrange/src/seq_interface.cpp @@ -27,6 +27,7 @@ namespace Sequential /*----------------------------------------------------------------*/ const int SEQ_OBJECT_GROUP_SIZE = 4; +const int SEQ_FIXED_OBJECT_GROUPING_LIMIT = 64; const int SEQ_SCHEDULING_TEMPORAL_SPREAD = 16; const int SEQ_BOUNDING_BOX_SIZE_OPTIMIZATION_STEP = 4; @@ -96,6 +97,7 @@ SolverConfiguration::SolverConfiguration() , y_plate_bounding_box_size(SEQ_PRUSA_MK3S_Y_SIZE) , max_refines(SEQ_MAX_REFINES) , object_group_size(SEQ_OBJECT_GROUP_SIZE) + , fixed_object_grouping_limit(SEQ_FIXED_OBJECT_GROUPING_LIMIT) , temporal_spread(SEQ_SCHEDULING_TEMPORAL_SPREAD) , decimation_precision(SEQ_DECIMATION_PRECISION_LOW) , optimization_timeout(SEQ_Z3_SOLVER_TIMEOUT) @@ -109,6 +111,7 @@ SolverConfiguration::SolverConfiguration(const PrinterGeometry &printer_geometry , minimum_bounding_box_size(SEQ_MINIMUM_BOUNDING_BOX_SIZE) , max_refines(SEQ_MAX_REFINES) , object_group_size(SEQ_OBJECT_GROUP_SIZE) + , fixed_object_grouping_limit(SEQ_FIXED_OBJECT_GROUPING_LIMIT) , temporal_spread(SEQ_SCHEDULING_TEMPORAL_SPREAD) , decimation_precision(SEQ_DECIMATION_PRECISION_LOW) , optimization_timeout(SEQ_Z3_SOLVER_TIMEOUT) @@ -573,7 +576,7 @@ int schedule_ObjectsForSequentialPrint(const SolverConfiguration &solver_ decimated_polygon = objects_to_print[i].pgns_at_height[j].second; decimated_polygon.make_counter_clockwise(); } - if (!check_PolygonSize(solver_configuration, SEQ_SLICER_SCALE_FACTOR, decimated_polygon)) + if (!check_PolygonSizeFitToPlate(solver_configuration, SEQ_SLICER_SCALE_FACTOR, decimated_polygon)) { #ifdef DEBUG { @@ -998,7 +1001,7 @@ int schedule_ObjectsForSequentialPrint(const SolverConfiguration decimated_polygon.make_counter_clockwise(); } - if (!check_PolygonSize(solver_configuration, SEQ_SLICER_SCALE_FACTOR, decimated_polygon)) + if (!check_PolygonSizeFitToPlate(solver_configuration, SEQ_SLICER_SCALE_FACTOR, decimated_polygon)) { #ifdef DEBUG { diff --git a/src/libseqarrange/src/seq_preprocess.cpp b/src/libseqarrange/src/seq_preprocess.cpp index 60e4449c9f..1587646d6b 100644 --- a/src/libseqarrange/src/seq_preprocess.cpp +++ b/src/libseqarrange/src/seq_preprocess.cpp @@ -714,7 +714,7 @@ void prepare_ExtruderPolygons(const SolverConfiguration &solver decimated_polygon.make_counter_clockwise(); } - if (!check_PolygonSize(solver_configuration, SEQ_SLICER_SCALE_FACTOR, decimated_polygon)) + if (!check_PolygonSizeFitToPlate(solver_configuration, SEQ_SLICER_SCALE_FACTOR, decimated_polygon)) { #ifdef DEBUG { @@ -779,32 +779,40 @@ void prepare_UnreachableZonePolygons(const SolverConfiguration const std::vector > &extruder_box_level_polygons, std::vector &unreachable_polygons) { - std::vector scaled_unreachable_polygons; + std::vector > scaled_unreachable_polygons; for (unsigned int i = 0; i < extruder_convex_level_polygons.size(); ++i) { + std::vector scaled_level_unreachable_polygons; extend_PolygonConvexUnreachableZone(solver_configuration, polygon, extruder_convex_level_polygons[i], - scaled_unreachable_polygons); + scaled_level_unreachable_polygons); + scaled_unreachable_polygons.push_back(scaled_level_unreachable_polygons); } for (unsigned int i = 0; i < extruder_box_level_polygons.size(); ++i) { + std::vector scaled_level_unreachable_polygons; extend_PolygonBoxUnreachableZone(solver_configuration, polygon, extruder_box_level_polygons[i], - scaled_unreachable_polygons); + scaled_level_unreachable_polygons); + scaled_unreachable_polygons.push_back(scaled_level_unreachable_polygons); } + scaled_unreachable_polygons = simplify_UnreachableZonePolygons(scaled_unreachable_polygons); for (unsigned int i = 0; i < scaled_unreachable_polygons.size(); ++i) { - Polygon scale_down_polygon; + for (unsigned int j = 0; j < scaled_unreachable_polygons[i].size(); ++j) + { + Polygon scale_down_polygon; - scaleDown_PolygonForSequentialSolver(scaled_unreachable_polygons[i], - scale_down_polygon); - scale_down_polygon.make_counter_clockwise(); - unreachable_polygons.push_back(scale_down_polygon); + scaleDown_PolygonForSequentialSolver(scaled_unreachable_polygons[i][j], + scale_down_polygon); + scale_down_polygon.make_counter_clockwise(); + unreachable_polygons.push_back(scale_down_polygon); + } } } @@ -816,40 +824,48 @@ void prepare_UnreachableZonePolygons(const SolverConfiguration const std::vector > &extruder_box_level_polygons, std::vector &unreachable_polygons) { - std::vector scaled_unreachable_polygons; + std::vector > scaled_unreachable_polygons; assert(extruder_convex_level_polygons.size() == convex_level_polygons.size()); for (unsigned int i = 0; i < extruder_convex_level_polygons.size(); ++i) { - extend_PolygonConvexUnreachableZone(solver_configuration, - convex_level_polygons[i], - extruder_convex_level_polygons[i], - scaled_unreachable_polygons); + std::vector scaled_level_unreachable_polygons; + extend_PolygonConvexUnreachableZone(solver_configuration, + convex_level_polygons[i], + extruder_convex_level_polygons[i], + scaled_level_unreachable_polygons); + scaled_unreachable_polygons.push_back(scaled_level_unreachable_polygons); } assert(extruder_box_level_polygons.size() == box_level_polygons.size()); for (unsigned int i = 0; i < extruder_box_level_polygons.size(); ++i) { + std::vector scaled_level_unreachable_polygons; extend_PolygonBoxUnreachableZone(solver_configuration, - box_level_polygons[i], - extruder_box_level_polygons[i], - scaled_unreachable_polygons); + box_level_polygons[i], + extruder_box_level_polygons[i], + scaled_level_unreachable_polygons); + scaled_unreachable_polygons.push_back(scaled_level_unreachable_polygons); } + scaled_unreachable_polygons = simplify_UnreachableZonePolygons(scaled_unreachable_polygons); for (unsigned int i = 0; i < scaled_unreachable_polygons.size(); ++i) { - Polygon scale_down_polygon; - - scaleDown_PolygonForSequentialSolver(scaled_unreachable_polygons[i], - scale_down_polygon); - scale_down_polygon.make_counter_clockwise(); - unreachable_polygons.push_back(scale_down_polygon); + for (unsigned int j = 0; j < scaled_unreachable_polygons[i].size(); ++j) + { + Polygon scale_down_polygon; + + scaleDown_PolygonForSequentialSolver(scaled_unreachable_polygons[i][j], + scale_down_polygon); + scale_down_polygon.make_counter_clockwise(); + unreachable_polygons.push_back(scale_down_polygon); + } } } -bool check_PolygonSize(const SolverConfiguration &solver_configuration, const Slic3r::Polygon &polygon) +bool check_PolygonSizeFitToPlate(const SolverConfiguration &solver_configuration, const Slic3r::Polygon &polygon) { BoundingBox polygon_box = get_extents(polygon); @@ -869,7 +885,7 @@ bool check_PolygonSize(const SolverConfiguration &solver_configuration, const Sl } -bool check_PolygonSize(const SolverConfiguration &solver_configuration, coord_t scale_factor, const Slic3r::Polygon &polygon) +bool check_PolygonSizeFitToPlate(const SolverConfiguration &solver_configuration, coord_t scale_factor, const Slic3r::Polygon &polygon) { BoundingBox polygon_box = get_extents(polygon); @@ -889,6 +905,73 @@ bool check_PolygonSize(const SolverConfiguration &solver_configuration, coord_t } +/*----------------------------------------------------------------*/ + +bool check_PolygonConsumation(const std::vector &polygons, const std::vector &consumer_polygons) +{ + std::vector polygons_to_clip; + std::vector next_polygons_to_clip; + + polygons_to_clip = polygons; + + for (unsigned int poly_cons = 0; poly_cons < consumer_polygons.size(); ++poly_cons) + { + for (unsigned int clip_poly = 0; clip_poly < polygons_to_clip.size(); ++clip_poly) + { + Slic3r::Polygons clip_result; + clip_result = diff(polygons_to_clip[clip_poly], consumer_polygons[poly_cons]); + + for (const auto& clipped_polygon: clip_result) + { + next_polygons_to_clip.push_back(clipped_polygon); + } + } + polygons_to_clip = next_polygons_to_clip; + } + + if (polygons_to_clip.empty()) + { + return true; + } + return false; +} + + +std::vector > simplify_UnreachableZonePolygons(const std::vector > &unreachable_polygons) +{ + std::vector > simplified_unreachable_polygons; + + for (unsigned int i = 0; i < unreachable_polygons.size(); ++i) + { + bool consumed = false; + + for (unsigned int j = 0; j < unreachable_polygons.size(); ++j) + { + if (i != j) + { + double area_i = calc_PolygonUnreachableZoneArea(unreachable_polygons[i]); + double area_j = calc_PolygonUnreachableZoneArea(unreachable_polygons[j]); + + if (area_j > area_i) + { + if (check_PolygonConsumation(unreachable_polygons[i], unreachable_polygons[j])) + { + consumed = true; + break; + } + } + } + } + if (!consumed) + { + simplified_unreachable_polygons.push_back(unreachable_polygons[i]); + } + } + + return simplified_unreachable_polygons; +} + + void glue_LowObjects(std::vector &solvable_objects) { int low = 0; @@ -900,18 +983,15 @@ void glue_LowObjects(std::vector &solvable_objects) if (2 * polygon_area > unreachable_area) { - printf("Low: %d\n", solvable_objects[i].id); if (++low >= 2) { assert(i > 0); - printf("---> gluing: %d -> %d\n", solvable_objects[i-1].id, solvable_objects[i].id); solvable_objects[i-1].lepox_to_next = true; low = 1; } } else { - printf("noLow: %d\n", solvable_objects[i].id); low = 0; } } @@ -937,6 +1017,27 @@ double calc_PolygonArea(const Slic3r::Polygon &polygon) } + +double calc_PolygonUnreachableZoneArea(const std::vector &unreachable_polygons) +{ + Polygons overlapping_polygons; + + for (const auto& unreachable_polygon: unreachable_polygons) + { + overlapping_polygons.push_back(unreachable_polygon); + } + ExPolygons union_polygons = union_ex(overlapping_polygons); + + double area = 0; + for (const auto& union_polygon: union_polygons) + { + area += union_polygon.area(); + } + + return area; +} + + double calc_PolygonUnreachableZoneArea(const Slic3r::Polygon &polygon, const std::vector &unreachable_polygons) { diff --git a/src/libseqarrange/src/seq_sequential.cpp b/src/libseqarrange/src/seq_sequential.cpp index 815f520d18..908ed62411 100644 --- a/src/libseqarrange/src/seq_sequential.cpp +++ b/src/libseqarrange/src/seq_sequential.cpp @@ -9,6 +9,8 @@ */ /*================================================================*/ +#include + #include "seq_defs.hpp" #include "seq_sequential.hpp" @@ -2895,6 +2897,92 @@ void introduce_ConsequentialPolygonExternalFixedPolygon(z3::solver } +void introduce_ConsequentialPolygonExternalFixedGroupPolygon(z3::solver &Solver, + z3::context &Context, + const z3::expr &dec_var_X1, + const z3::expr &dec_var_Y1, + const z3::expr &dec_var_T1, + const Slic3r::Polygon &polygon, + const std::vector &unreachable_polygons, + const Rational &dec_value_group_min_T, + const Rational &dec_value_group_max_T, + const Slic3r::Polygon &group_polygon, + const std::vector &group_unreachable_polygons) +{ + for (unsigned int poly2 = 0; poly2 < group_unreachable_polygons.size(); ++poly2) + { + for (unsigned int p1 = 0; p1 < polygon.points.size(); ++p1) + { + const Point &point1 = polygon.points[p1]; + + introduce_ConsequentialPointOutsideFixedPolygon(Solver, + Context, + dec_var_X1 + point1.x(), + dec_var_Y1 + point1.y(), + dec_var_T1, + Rational(0), + Rational(0), + dec_value_group_min_T, + group_unreachable_polygons[poly2]); + } + } + + for (unsigned int poly2 = 0; poly2 < group_unreachable_polygons.size(); ++poly2) + { + for (unsigned int p2 = 0; p2 < group_unreachable_polygons[poly2].points.size(); ++p2) + { + const Point &pro_point2 = group_unreachable_polygons[poly2].points[p2]; + + introduce_ConsequentialFixedPointOutsidePolygon(Solver, + Context, + pro_point2.x(), + pro_point2.y(), + dec_var_T1, + dec_var_X1, + dec_var_Y1, + dec_value_group_min_T, + polygon); + } + } + + for (unsigned int poly1 = 0; poly1 < unreachable_polygons.size(); ++poly1) + { + for (unsigned int p2 = 0; p2 < group_polygon.points.size(); ++p2) + { + const Point &point2 = group_polygon.points[p2]; + + introduce_ConsequentialFixedPointOutsidePolygon(Solver, + Context, + point2.x(), + point2.y(), + dec_value_group_max_T, + dec_var_X1, + dec_var_Y1, + dec_var_T1, + unreachable_polygons[poly1]); + } + } + + for (unsigned int poly1 = 0; poly1 < unreachable_polygons.size(); ++poly1) + { + for (unsigned int p1 = 0; p1 < unreachable_polygons[poly1].points.size(); ++p1) + { + const Point &pro_point1 = unreachable_polygons[poly1].points[p1]; + + introduce_ConsequentialPointOutsideFixedPolygon(Solver, + Context, + dec_var_X1 + pro_point1.x(), + dec_var_Y1 + pro_point1.y(), + dec_value_group_max_T, + Rational(0), + Rational(0), + dec_var_T1, + group_polygon); + } + } +} + + /*----------------------------------------------------------------*/ void introduce_PolygonWeakNonoverlapping(z3::solver &Solver, @@ -3171,7 +3259,8 @@ void introduce_SequentialPolygonWeakNonoverlapping(z3::solver } -void introduce_ConsequentialPolygonWeakNonoverlapping(z3::solver &Solver, +void introduce_ConsequentialPolygonWeakNonoverlapping(const SolverConfiguration &solver_configuration, + z3::solver &Solver, z3::context &Context, const z3::expr_vector &dec_vars_X, const z3::expr_vector &dec_vars_Y, @@ -3192,7 +3281,8 @@ void introduce_ConsequentialPolygonWeakNonoverlapping(z3::solver _unreachable_polygons[poly].push_back(unreachable_polygons[poly]); } - introduce_ConsequentialPolygonWeakNonoverlapping(Solver, + introduce_ConsequentialPolygonWeakNonoverlapping(solver_configuration, + Solver, Context, dec_vars_X, dec_vars_Y, @@ -3207,7 +3297,8 @@ void introduce_ConsequentialPolygonWeakNonoverlapping(z3::solver } -void introduce_ConsequentialPolygonWeakNonoverlapping(z3::solver &Solver, +void introduce_ConsequentialPolygonWeakNonoverlapping(const SolverConfiguration &solver_configuration, + z3::solver &Solver, z3::context &Context, const z3::expr_vector &dec_vars_X, const z3::expr_vector &dec_vars_Y, @@ -3219,7 +3310,7 @@ void introduce_ConsequentialPolygonWeakNonoverlapping(z3::solver const std::vector &undecided, const std::vector &polygons, const std::vector > &unreachable_polygons) -{ +{ for (unsigned int i = 0; i < undecided.size() - 1; ++i) { for (unsigned int j = i + 1; j < undecided.size(); ++j) @@ -3244,27 +3335,124 @@ void introduce_ConsequentialPolygonWeakNonoverlapping(z3::solver } } - for (unsigned int i = 0; i < undecided.size(); ++i) + if (fixed.size() < (unsigned int)solver_configuration.fixed_object_grouping_limit) { - for (unsigned int j = 0; j < fixed.size(); ++j) + for (unsigned int i = 0; i < undecided.size(); ++i) + { + for (unsigned int j = 0; j < fixed.size(); ++j) + { + #ifdef DEBUG + { + printf("PoFP: %d,%d\n", undecided[i], fixed[j]); + } + #endif + introduce_ConsequentialPolygonExternalFixedPolygon(Solver, + Context, + dec_vars_X[undecided[i]], + dec_vars_Y[undecided[i]], + dec_vars_T[undecided[i]], + polygons[undecided[i]], + unreachable_polygons[undecided[i]], + dec_values_X[fixed[j]], + dec_values_Y[fixed[j]], + dec_values_T[fixed[j]], + polygons[fixed[j]], + unreachable_polygons[fixed[j]]); + } + } + } + else + { + for (unsigned int i = 0; i < undecided.size(); ++i) + { + for (unsigned int j = fixed.size() - (unsigned int)solver_configuration.fixed_object_grouping_limit; j < fixed.size(); ++j) + { + #ifdef DEBUG + { + printf("PoFP: %d,%d\n", undecided[i], fixed[j]); + } + #endif + introduce_ConsequentialPolygonExternalFixedPolygon(Solver, + Context, + dec_vars_X[undecided[i]], + dec_vars_Y[undecided[i]], + dec_vars_T[undecided[i]], + polygons[undecided[i]], + unreachable_polygons[undecided[i]], + dec_values_X[fixed[j]], + dec_values_Y[fixed[j]], + dec_values_T[fixed[j]], + polygons[fixed[j]], + unreachable_polygons[fixed[j]]); + } + } + + Slic3r::Polygons flat_polygons; + for (unsigned int i = 0; i < fixed.size() - (unsigned int)solver_configuration.fixed_object_grouping_limit; ++i) + { + Polygon fixed_polygon = polygons[fixed[i]]; + + for (unsigned int p = 0; p < fixed_polygon.points.size(); ++p) + { + fixed_polygon.points[p] += Point(dec_values_X[fixed[i]].as_double(), dec_values_Y[fixed[i]].as_double()); + } + flat_polygons.push_back(fixed_polygon); + } + + Slic3r::Polygons flat_unreachable_polygons; + for (unsigned int i = 0; i < fixed.size() - (unsigned int)solver_configuration.fixed_object_grouping_limit; ++i) + { + for (unsigned int j = 0; j < unreachable_polygons[fixed[i]].size(); ++j) + { + Polygon fixed_polygon = unreachable_polygons[fixed[i]][j]; + + for (unsigned int p = 0; p < fixed_polygon.points.size(); ++p) + { + fixed_polygon.points[p] += Point(dec_values_X[fixed[i]].as_double(), dec_values_Y[fixed[i]].as_double()); + } + flat_unreachable_polygons.push_back(fixed_polygon); + } + } + Polygon flat_hull = Slic3r::Geometry::convex_hull(flat_polygons); + Polygon flat_unreachable_hull = Slic3r::Geometry::convex_hull(flat_unreachable_polygons); + std::vector flat_unreachable_hulls; + flat_unreachable_hulls.push_back(flat_unreachable_hull); + + assert(!fixed.empty()); + Rational dec_value_flat_min_T = dec_values_T[fixed[0]]; + Rational dec_value_flat_max_T = dec_values_T[fixed[0]]; + + for (unsigned int i = 1; i < fixed.size() - (unsigned int)solver_configuration.fixed_object_grouping_limit; ++i) + { + if (dec_values_T[fixed[i]] < dec_value_flat_min_T) + { + dec_value_flat_min_T = dec_values_T[fixed[i]]; + } + if (dec_values_T[fixed[i]] > dec_value_flat_max_T) + { + dec_value_flat_max_T = dec_values_T[fixed[i]]; + } + } + + for (unsigned int i = 0; i < undecided.size(); ++i) { #ifdef DEBUG { - printf("PoFP: %d,%d\n", undecided[i], fixed[j]); + printf("PoGROUP: %d\n", undecided[i]); } #endif - introduce_ConsequentialPolygonExternalFixedPolygon(Solver, - Context, - dec_vars_X[undecided[i]], - dec_vars_Y[undecided[i]], - dec_vars_T[undecided[i]], - polygons[undecided[i]], - unreachable_polygons[undecided[i]], - dec_values_X[fixed[j]], - dec_values_Y[fixed[j]], - dec_values_T[fixed[j]], - polygons[fixed[j]], - unreachable_polygons[fixed[j]]); + + introduce_ConsequentialPolygonExternalFixedGroupPolygon(Solver, + Context, + dec_vars_X[undecided[i]], + dec_vars_Y[undecided[i]], + dec_vars_T[undecided[i]], + polygons[undecided[i]], + unreachable_polygons[undecided[i]], + dec_value_flat_min_T, + dec_value_flat_max_T, + flat_hull, + flat_unreachable_hulls); } } } @@ -6766,7 +6954,8 @@ void build_SequentialWeakPolygonNonoverlapping(z3::solver } -void build_ConsequentialWeakPolygonNonoverlapping(z3::solver &Solver, +void build_ConsequentialWeakPolygonNonoverlapping(const SolverConfiguration &solver_configuration, + z3::solver &Solver, z3::context &Context, const std::vector &polygons, const std::vector &unreachable_polygons, @@ -6788,7 +6977,8 @@ void build_ConsequentialWeakPolygonNonoverlapping(z3::solver _unreachable_polygons[poly].push_back(unreachable_polygons[poly]); } - build_ConsequentialWeakPolygonNonoverlapping(Solver, + build_ConsequentialWeakPolygonNonoverlapping(solver_configuration, + Solver, Context, polygons, _unreachable_polygons, @@ -6804,7 +6994,8 @@ void build_ConsequentialWeakPolygonNonoverlapping(z3::solver } -void build_ConsequentialWeakPolygonNonoverlapping(z3::solver &Solver, +void build_ConsequentialWeakPolygonNonoverlapping(const SolverConfiguration &solver_configuration, + z3::solver &Solver, z3::context &Context, const std::vector &polygons, const std::vector > &unreachable_polygons, @@ -6842,7 +7033,8 @@ void build_ConsequentialWeakPolygonNonoverlapping(z3::solver dec_var_names_map[name] = i; } - introduce_ConsequentialPolygonWeakNonoverlapping(Solver, + introduce_ConsequentialPolygonWeakNonoverlapping(solver_configuration, + Solver, Context, dec_vars_X, dec_vars_Y, @@ -10085,7 +10277,8 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So build_start = clock(); } #endif - build_ConsequentialWeakPolygonNonoverlapping(z_solver, + build_ConsequentialWeakPolygonNonoverlapping(solver_configuration, + z_solver, z_context, polygons, unreachable_polygons, @@ -10368,7 +10561,8 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So } #endif - build_ConsequentialWeakPolygonNonoverlapping(z_solver, + build_ConsequentialWeakPolygonNonoverlapping(solver_configuration, + z_solver, z_context, polygons, unreachable_polygons, diff --git a/src/libseqarrange/src/seq_sequential.hpp b/src/libseqarrange/src/seq_sequential.hpp index 3386f6d2f1..2a97a022a4 100644 --- a/src/libseqarrange/src/seq_sequential.hpp +++ b/src/libseqarrange/src/seq_sequential.hpp @@ -994,7 +994,8 @@ void introduce_SequentialPolygonWeakNonoverlapping(z3::solver const std::vector &polygons, const std::vector > &unreachable_polygons); -void introduce_ConsequentialPolygonWeakNonoverlapping(z3::solver &Solver, +void introduce_ConsequentialPolygonWeakNonoverlapping(const SolverConfiguration &solver_configuration, + z3::solver &Solver, z3::context &Context, const z3::expr_vector &dec_vars_X, const z3::expr_vector &dec_vars_Y, @@ -1007,7 +1008,8 @@ void introduce_ConsequentialPolygonWeakNonoverlapping(z3::solver const std::vector &polygons, const std::vector &unreachable_polygons); -void introduce_ConsequentialPolygonWeakNonoverlapping(z3::solver &Solver, +void introduce_ConsequentialPolygonWeakNonoverlapping(const SolverConfiguration &solver_configuration, + z3::solver &Solver, z3::context &Context, const z3::expr_vector &dec_vars_X, const z3::expr_vector &dec_vars_Y, @@ -1339,7 +1341,8 @@ void build_SequentialWeakPolygonNonoverlapping(z3::solver const std::vector &undecided, string_map &dec_var_names_map); -void build_ConsequentialWeakPolygonNonoverlapping(z3::solver &Solver, +void build_ConsequentialWeakPolygonNonoverlapping(const SolverConfiguration &solver_configuration, + z3::solver &Solver, z3::context &Context, const std::vector &polygons, const std::vector &unreachable_polygons, @@ -1353,7 +1356,8 @@ void build_ConsequentialWeakPolygonNonoverlapping(z3::solver const std::vector &undecided, string_map &dec_var_names_map); -void build_ConsequentialWeakPolygonNonoverlapping(z3::solver &Solver, +void build_ConsequentialWeakPolygonNonoverlapping(const SolverConfiguration &solver_configuration, + z3::solver &Solver, z3::context &Context, const std::vector &polygons, const std::vector > &unreachable_polygons, diff --git a/src/libseqarrange/src/sequential_prusa.cpp b/src/libseqarrange/src/sequential_prusa.cpp index a1a73c40f0..8097a66208 100644 --- a/src/libseqarrange/src/sequential_prusa.cpp +++ b/src/libseqarrange/src/sequential_prusa.cpp @@ -242,7 +242,6 @@ int solve_SequentialPrint(const CommandParameters &command_parameters) if (!objects_to_print[i].pgns_at_height[j].second.points.empty()) { Polygon decimated_polygon; - //ground_PolygonByFirstPoint(objects_to_print[i].pgns_at_height[j].second); if (command_parameters.decimation) { @@ -264,7 +263,7 @@ int solve_SequentialPrint(const CommandParameters &command_parameters) decimated_polygon = objects_to_print[i].pgns_at_height[j].second; decimated_polygon.make_counter_clockwise(); } - if (!check_PolygonSize(solver_configuration, SEQ_SLICER_SCALE_FACTOR, decimated_polygon)) + if (!check_PolygonSizeFitToPlate(solver_configuration, SEQ_SLICER_SCALE_FACTOR, decimated_polygon)) { printf("Object too large to fit onto plate [ID:%d RID:%d].\n", original_index_map[i], i); return -1; @@ -362,7 +361,6 @@ int solve_SequentialPrint(const CommandParameters &command_parameters) vector remaining_polygons; vector polygon_index_map; - //vector original_index_map; vector decided_polygons; for (unsigned int index = 0; index < polygons.size(); ++index)