half stab at remediating organic top diff triggering solid layers

This commit is contained in:
Stewart Allen 2023-02-22 12:00:27 -05:00
commit 2353c33ef3

View file

@ -1354,6 +1354,7 @@ function doSolidsFill(slice, spacing, angle, minArea, fillQ) {
// parent each solid polygon inside the smallest bounding top
let make_solid_layer = false;
let tops_area = tops.map(top => top.poly.areaDeep()).reduce((a,i) => a+i);
for (let solid of solids) {
for (let top of tops) {
let stop = [];
@ -1369,12 +1370,13 @@ function doSolidsFill(slice, spacing, angle, minArea, fillQ) {
}
}
// problematic for organic shapes with lots of big and small tops
// the small tops tend to trigger entire layer fills
// the small tops tend to trigger entire layer fills. for now just
// trip full solid layer if a single top area diff > 50%
if (stop.length) {
let top_area = top.poly.areaDeep();
let stop_area = stop.map(p => p.areaDeep()).reduce((a,v) => a + v);
// if the solid area > 50% of the top area, make entire layer solid
if (stop_area / top_area > 0.5) {
if (stop_area / tops_area > 0.5) {
make_solid_layer = true;
}
}