From f032d8c267eccc78d8c65d1e011cb0583707ef1d Mon Sep 17 00:00:00 2001 From: Casper Lamboo Date: Mon, 19 Feb 2018 16:26:13 +0100 Subject: [PATCH] Fix support #39 --- src/sliceActions/generateSupport.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sliceActions/generateSupport.js b/src/sliceActions/generateSupport.js index 2c8393b..f04ffa7 100644 --- a/src/sliceActions/generateSupport.js +++ b/src/sliceActions/generateSupport.js @@ -22,16 +22,14 @@ export default function generateSupport(slices, settings) { let supportArea = new Shape([], true); - for (let layer = slices.length - 1 - supportDistanceLayers; layer >= supportDistanceLayers; layer --) { + for (let layer = slices.length - 1 - supportDistanceLayers; layer >= 0; layer --) { const currentLayer = slices[layer + supportDistanceLayers - 1]; const upSkin = slices[layer + supportDistanceLayers]; const downSkin = slices[layer - supportDistanceLayers]; const neededSupportArea = upSkin.outline.difference(currentLayer.outline.offset(margin)); - if (neededSupportArea.totalArea() * PRECISION_SQUARED > minArea) { - supportArea = supportArea.union(neededSupportArea); - } + if (neededSupportArea.totalArea() * PRECISION_SQUARED > minArea) supportArea = supportArea.union(neededSupportArea); if (downSkin) supportArea = supportArea.difference(downSkin.outline.offset(margin)); const bounds = supportArea.shapeBounds();