mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 07:03:59 -06:00
Improvements of infill path planning:
Implementation of 2-opt pairwise exchange iterative improvement algorithm with an extension to a chain of segments, where the chain of segments may get flipped during the exchange operation. The 2-opt exchange algorithm may be quite slow.
This commit is contained in:
parent
b2a6a07d72
commit
4cff569b62
2 changed files with 903 additions and 16 deletions
|
@ -263,6 +263,42 @@ SCENARIO("Path chaining", "[Geometry]") {
|
|||
}
|
||||
}
|
||||
}
|
||||
GIVEN("Gyroid infill end points") {
|
||||
Polylines polylines = {
|
||||
{ {28122608, 3221037}, {27919139, 56036027} },
|
||||
{ {33642863, 3400772}, {30875220, 56450360} },
|
||||
{ {34579315, 3599827}, {35049758, 55971572} },
|
||||
{ {26483070, 3374004}, {23971830, 55763598} },
|
||||
{ {38931405, 4678879}, {38740053, 55077714} },
|
||||
{ {20311895, 5015778}, {20079051, 54551952} },
|
||||
{ {16463068, 6773342}, {18823514, 53992958} },
|
||||
{ {44433771, 7424951}, {42629462, 53346059} },
|
||||
{ {15697614, 7329492}, {15350896, 52089991} },
|
||||
{ {48085792, 10147132}, {46435427, 50792118} },
|
||||
{ {48828819, 10972330}, {49126582, 48368374} },
|
||||
{ {9654526, 12656711}, {10264020, 47691584} },
|
||||
{ {5726905, 18648632}, {8070762, 45082416} },
|
||||
{ {54818187, 39579970}, {52974912, 43271272} },
|
||||
{ {4464342, 37371742}, {5027890, 39106220} },
|
||||
{ {54139746, 18417661}, {55177987, 38472580} },
|
||||
{ {56527590, 32058461}, {56316456, 34067185} },
|
||||
{ {3303988, 29215290}, {3569863, 32985633} },
|
||||
{ {56255666, 25025857}, {56478310, 27144087} },
|
||||
{ {4300034, 22805361}, {3667946, 25752601} },
|
||||
{ {8266122, 14250611}, {6244813, 17751595} },
|
||||
{ {12177955, 9886741}, {10703348, 11491900} }
|
||||
};
|
||||
Polylines chained = chain_polylines(polylines);
|
||||
THEN("Chained taking the shortest path") {
|
||||
double connection_length = 0.;
|
||||
for (size_t i = 1; i < chained.size(); ++i) {
|
||||
const Polyline &pl1 = chained[i - 1];
|
||||
const Polyline &pl2 = chained[i];
|
||||
connection_length += (pl2.first_point() - pl1.last_point()).cast<double>().norm();
|
||||
}
|
||||
REQUIRE(connection_length < 85206000.);
|
||||
}
|
||||
}
|
||||
GIVEN("Loop pieces") {
|
||||
Point a { 2185796, 19058485 };
|
||||
Point b { 3957902, 18149382 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue