From 961337138ba0303386f2f7bf4ebf604115da8747 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Thu, 18 Jan 2018 12:38:35 +0100 Subject: [PATCH] fix grid size calculation --- src/sliceActions/generateInfills.js | 2 +- src/sliceActions/getFillTemplate.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sliceActions/generateInfills.js b/src/sliceActions/generateInfills.js index 20335fd..e741493 100644 --- a/src/sliceActions/generateInfills.js +++ b/src/sliceActions/generateInfills.js @@ -22,7 +22,7 @@ export default function generateInfills(slices, settings) { const bottomSkinCount = Math.ceil(bottomThickness / layerHeight); const topSkinCount = Math.ceil(topThickness / layerHeight); const nozzleRadius = nozzleDiameter / 2; - const outerFillTemplateSize = Math.sqrt(2 * Math.pow(nozzleDiameter, 2)); + const outerFillTemplateSize = nozzleDiameter; for (let layer = 0; layer < slices.length; layer ++) { const slice = slices[layer]; diff --git a/src/sliceActions/getFillTemplate.js b/src/sliceActions/getFillTemplate.js index 98ee8be..6b3db95 100644 --- a/src/sliceActions/getFillTemplate.js +++ b/src/sliceActions/getFillTemplate.js @@ -1,8 +1,10 @@ import Shape from 'clipper-js'; -export default function getFillTemplate(bounds, size, even, uneven) { +export default function getFillTemplate(bounds, gridSize, even, uneven) { const paths = []; + const size = Math.sqrt(2 * Math.pow(gridSize, 2)); + const left = Math.floor(bounds.left / size) * size; const right = Math.ceil(bounds.right / size) * size; const top = Math.floor(bounds.top / size) * size;