From ca3718e4925a686a0a4c22655175d875c486ec79 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Thu, 18 Jan 2018 15:27:08 +0100 Subject: [PATCH] Remove tiny holes #18 --- package-lock.json | 16 ++++++++-------- package.json | 2 +- src/constants.js | 1 + src/sliceActions/shapesToSlices.js | 3 ++- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index da8be14..8e6597c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,9 +10,9 @@ "integrity": "sha512-1qXg62qaZkc/zYPan37CXvUtaJk4aFVLz2y8cqnkN9Y0r1Er5soIZ5esMz4YYyjUrQGawBoYcGvatRALYnzlvg==" }, "@doodle3d/clipper-js": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@doodle3d/clipper-js/-/clipper-js-1.0.7.tgz", - "integrity": "sha512-8Ji8rrFWZ7LAEpIp1SQZJgewxt0FUBFeDku+ZRIR5PS0Jc6Abbq5KykQLVh1zOh3oqX2Cgl+myhqMhFeZXqutA==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@doodle3d/clipper-js/-/clipper-js-1.0.10.tgz", + "integrity": "sha512-BSLvOvS9ECFyV90BsG1rXPb9W/g0j+azlPu5ntohFdIyUJPIzmRNAYq4lreQKBO8FSF0e9BVGG0QX8vC6ZQa4w==", "requires": { "@doodle3d/clipper-lib": "6.4.2-b" } @@ -26,7 +26,7 @@ "version": "github:doodle3d/doodle3d-core#36a73c233e569fca79d2059a50edb6bdb511aa58", "requires": { "@doodle3d/cal": "0.0.8", - "@doodle3d/clipper-js": "1.0.7", + "@doodle3d/clipper-js": "1.0.10", "@doodle3d/fill-path": "1.0.7", "@doodle3d/potrace-js": "0.0.6", "@doodle3d/threejs-export-obj": "0.0.8", @@ -79,9 +79,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.1.0.tgz", "integrity": "sha512-dQoid9tqQ+uotGhuTKEY11X4xhyYePVnqGSoSm3OGKh2E8LZ6RPULp1uXTctk33IeERlrRJYoVSBglsL05F5Uw==" - }, - "three-js-csg": { - "version": "github:Doodle3D/three-js-csg#a36f23da6e9be2405a9094de5709cb0ae8f58045" } } }, @@ -90,7 +87,7 @@ "resolved": "https://registry.npmjs.org/@doodle3d/fill-path/-/fill-path-1.0.7.tgz", "integrity": "sha512-4sdgWQ28JgRsmnyy1OnuKHE+DZ8kDGpluGqFmMASh2/6dlyjp2/oXnNEgNefG4/xiEitV8AtzEij9Bijh6yNRw==", "requires": { - "@doodle3d/clipper-js": "1.0.7" + "@doodle3d/clipper-js": "1.0.10" } }, "@doodle3d/potrace-js": { @@ -7849,6 +7846,9 @@ "resolved": "https://registry.npmjs.org/three/-/three-0.88.0.tgz", "integrity": "sha1-QlbC/Djk+yOg0j66K2zOTfjkZtU=" }, + "three-js-csg": { + "version": "github:Doodle3D/three-js-csg#a36f23da6e9be2405a9094de5709cb0ae8f58045" + }, "through2": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", diff --git a/package.json b/package.json index 5c07c7f..8b655e4 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "build:module:settings": "cp -r src/settings module" }, "dependencies": { - "@doodle3d/clipper-js": "^1.0.7", + "@doodle3d/clipper-js": "^1.0.10", "@doodle3d/doodle3d-core": "github:doodle3d/doodle3d-core", "babel-plugin-transform-class-properties": "^6.24.1", "file-saver": "^1.3.3", diff --git a/src/constants.js b/src/constants.js index 828d62e..2bc85da 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,4 +1,5 @@ export const PRECISION = 0.01; export const VERSION = '0.0.18'; export const LOCAL_STORAGE_KEY = 'PRINTER_SETTINGS'; +export const MIN_AREA = 25; export const Z_OFFSET = 0.3; diff --git a/src/sliceActions/shapesToSlices.js b/src/sliceActions/shapesToSlices.js index 71d3ab7..23bea79 100644 --- a/src/sliceActions/shapesToSlices.js +++ b/src/sliceActions/shapesToSlices.js @@ -1,7 +1,7 @@ import Shape from 'clipper-js'; import Slice from './helpers/Slice.js'; -import { PRECISION } from '../constants.js'; +import { PRECISION, MIN_AREA } from '../constants.js'; export default function shapesToSlices(shapes, settings) { const sliceLayers = []; @@ -11,6 +11,7 @@ export default function shapesToSlices(shapes, settings) { fillShapes = new Shape(fillShapes, true, true, true, true) .fixOrientation() + .thresholdArea(MIN_AREA / Math.pow(PRECISION, 2)) .simplify('pftNonZero') .clean(1) .seperateShapes();