From 8c546e31b358e7b377a862aa8b532b4ba16306d2 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Thu, 16 Nov 2017 23:32:50 +0100 Subject: [PATCH] fix z offset --- src/sliceActions/calculateLayersIntersections.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sliceActions/calculateLayersIntersections.js b/src/sliceActions/calculateLayersIntersections.js index d96f205..4d3dba2 100644 --- a/src/sliceActions/calculateLayersIntersections.js +++ b/src/sliceActions/calculateLayersIntersections.js @@ -17,15 +17,15 @@ export default function calculateLayersIntersections(lines, settings) { if (isFlat) continue; - const min = Math.ceil(Math.min(line.start.y, line.end.y) / layerHeight); - const max = Math.floor(Math.max(line.start.y, line.end.y) / layerHeight); + const min = Math.ceil((Math.min(line.start.y, line.end.y) - zOffset) / layerHeight); + const max = Math.floor((Math.max(line.start.y, line.end.y) - zOffset) / layerHeight); for (let layerIndex = min; layerIndex <= max; layerIndex ++) { if (layerIndex >= 0 && layerIndex < numLayers) { layerIntersectionIndexes[layerIndex].push(lineIndex); - const y = layerIndex * layerHeight; + const y = layerIndex * layerHeight + zOffset; let x, z; if (line.start.y === line.end.y) {