From 83f543b62bbf6f37347d30a7ad649ddb32fbe46a Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Tue, 18 Jul 2017 16:55:27 +0200 Subject: [PATCH] fix isFlat check --- src/sliceActions/calculateLayersIntersections.js | 4 ++-- src/sliceActions/createLines.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sliceActions/calculateLayersIntersections.js b/src/sliceActions/calculateLayersIntersections.js index 76b0e9f..114bc2b 100644 --- a/src/sliceActions/calculateLayersIntersections.js +++ b/src/sliceActions/calculateLayersIntersections.js @@ -9,9 +9,9 @@ export default function calculateLayersIntersections(lines, settings) { const layerIntersectionPoints = Array.from(Array(numLayers)).map(() => []); for (let lineIndex = 0; lineIndex < lines.length; lineIndex ++) { - const line = lines[lineIndex].line; + const { line, isFlat } = lines[lineIndex]; - if (line.isFlat) continue; + 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); diff --git a/src/sliceActions/createLines.js b/src/sliceActions/createLines.js index 188f1c3..5a6e3fc 100644 --- a/src/sliceActions/createLines.js +++ b/src/sliceActions/createLines.js @@ -25,7 +25,7 @@ export default function createLines(geometry, settings) { const lookupB = lineLookup[`${face.c}_${face.b}`]; const lookupC = lineLookup[`${face.a}_${face.c}`]; - const isFlat = face.normal.y !== 1 && face.normal.y !== -1; + const isFlat = face.normal.y > 0.999 || face.normal.y < -0.999; // only add unique lines // returns index of said line