Remove tiny holes

#18
This commit is contained in:
casperlamboo 2018-01-18 15:27:08 +01:00
parent 0bb646a5ac
commit ca3718e492
4 changed files with 12 additions and 10 deletions

16
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -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;

View File

@ -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();