normalize cleanDelta with precision

This commit is contained in:
casperlamboo 2017-05-13 15:26:46 +02:00 committed by Simon Voordouw
parent f70723d6dc
commit 0bc84ed0a2

View File

@ -1,7 +1,9 @@
import Shape from 'Doodle3D/clipper-js'; import Shape from 'Doodle3D/clipper-js';
import Slice from '../Slice.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) { export default function shapesToSlices(shapes, settings) {
const sliceLayers = []; const sliceLayers = [];
@ -12,11 +14,11 @@ export default function shapesToSlices(shapes, settings) {
closedShapes = new Shape(closedShapes, true, true, true, true) closedShapes = new Shape(closedShapes, true, true, true, true)
.fixOrientation() .fixOrientation()
.simplify('pftNonZero') .simplify('pftNonZero')
.clean(CLEAN_DELTA) .clean(cleanDelta)
.seperateShapes(); .seperateShapes();
openShapes = new Shape(openShapes, false, true, true, true) openShapes = new Shape(openShapes, false, true, true, true)
.clean(CLEAN_DELTA); .clean(cleanDelta);
const slice = new Slice(); const slice = new Slice();