From 1ec4f55c4b6b0986366eb85ee753a03466ccf398 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Sat, 13 May 2017 15:26:46 +0200 Subject: [PATCH] normalize cleanDelta with precision --- src/sliceActions/shapesToSlices.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sliceActions/shapesToSlices.js b/src/sliceActions/shapesToSlices.js index f1727e6..14d2296 100644 --- a/src/sliceActions/shapesToSlices.js +++ b/src/sliceActions/shapesToSlices.js @@ -1,7 +1,9 @@ import Shape from 'Doodle3D/clipper-js'; import Slice from '../Slice.js'; -import { CLEAN_DELTA } from '../constants.js'; +import { CLEAN_DELTA, PRECISION } from '../constants.js'; + +const cleanDelta = CLEAN_DELTA / PRECISION; export default function shapesToSlices(shapes, settings) { const sliceLayers = []; @@ -12,11 +14,11 @@ export default function shapesToSlices(shapes, settings) { closedShapes = new Shape(closedShapes, true, true, true, true) .fixOrientation() .simplify('pftNonZero') - .clean(CLEAN_DELTA) + .clean(cleanDelta) .seperateShapes(); openShapes = new Shape(openShapes, false, true, true, true) - .clean(CLEAN_DELTA); + .clean(cleanDelta); const slice = new Slice();