Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'xs/src/libnest2d/examples/main.cpp')
-rw-r--r--xs/src/libnest2d/examples/main.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/xs/src/libnest2d/examples/main.cpp b/xs/src/libnest2d/examples/main.cpp
index 3d3f30b76..4623a6add 100644
--- a/xs/src/libnest2d/examples/main.cpp
+++ b/xs/src/libnest2d/examples/main.cpp
@@ -84,7 +84,8 @@ void arrangeRectangles() {
// {{0, 0}, {0, 20*SCALE}, {10*SCALE, 0}, {0, 0}}
// };
- std::vector<Item> crasher = {
+ std::vector<Item> crasher =
+ {
{
{-5000000, 8954050},
{5000000, 8954050},
@@ -527,12 +528,12 @@ void arrangeRectangles() {
};
std::vector<Item> input;
-// input.insert(input.end(), prusaParts().begin(), prusaParts().end());
+ input.insert(input.end(), prusaParts().begin(), prusaParts().end());
// input.insert(input.end(), prusaExParts().begin(), prusaExParts().end());
// input.insert(input.end(), stegoParts().begin(), stegoParts().end());
// input.insert(input.end(), rects.begin(), rects.end());
// input.insert(input.end(), proba.begin(), proba.end());
- input.insert(input.end(), crasher.begin(), crasher.end());
+// input.insert(input.end(), crasher.begin(), crasher.end());
Box bin(250*SCALE, 210*SCALE);
@@ -545,18 +546,18 @@ void arrangeRectangles() {
Packer::PlacementConfig pconf;
pconf.alignment = Placer::Config::Alignment::CENTER;
+ pconf.starting_point = Placer::Config::Alignment::CENTER;
pconf.rotations = {0.0/*, Pi/2.0, Pi, 3*Pi/2*/};
pconf.object_function = [&bin](Placer::Pile pile, double area,
double norm, double penality) {
auto bb = ShapeLike::boundingBox(pile);
- double diameter = PointLike::distance(bb.minCorner(),
- bb.maxCorner());
-
- // We will optimize to the diameter of the circle around the bounding
- // box and use the norming factor to get rid of the physical dimensions
- double score = diameter / norm;
+ auto& sh = pile.back();
+ auto rv = Nfp::referenceVertex(sh);
+ auto c = bin.center();
+ auto d = PointLike::distance(rv, c);
+ double score = double(d)/norm;
// If it does not fit into the print bed we will beat it
// with a large penality
@@ -568,7 +569,9 @@ void arrangeRectangles() {
Packer::SelectionConfig sconf;
// sconf.allow_parallel = false;
// sconf.force_parallel = false;
+// sconf.try_triplets = true;
// sconf.try_reverse_order = true;
+// sconf.waste_increment = 0.1;
arrange.configure(pconf, sconf);