diff --git a/package.json b/package.json index 5e9bdcc9..82e76bb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grid-apps", - "version": "4.3.0", + "version": "4.3.1", "description": "grid.space 3d slicing & modeling tools", "author": "Stewart Allen ", "license": "MIT", diff --git a/src/geo/polygon.js b/src/geo/polygon.js index 7eee6ad0..2a2be748 100644 --- a/src/geo/polygon.js +++ b/src/geo/polygon.js @@ -1105,7 +1105,11 @@ export class Polygon { } closeIf(dist = 1) { - if (this.first().distTo2D(this.last()) <= dist) { + let closeDist = this.first().distTo2D(this.last()); + if (closeDist < 0.001) { + this.points.pop(); + return this.setClosed(); + } else if (closeDist <= dist) { return this.setClosed(); } else { return this.setOpen(); diff --git a/src/kiri/mode/fdm/post.js b/src/kiri/mode/fdm/post.js index 7c321bf6..8bf789ff 100644 --- a/src/kiri/mode/fdm/post.js +++ b/src/kiri/mode/fdm/post.js @@ -287,50 +287,50 @@ function trace_noodle(noodle, noodleWidth, minR, midR, maxR, opt = {}) { // micro stepping insets. the same intersect technique used with // medial axis can be applied to this structure to produce an // equivalent output. not as computationally efficient, but much simpler. - if (brute) { - let { intersectRayLine } = base.util; - let tests = insets.slice(1); - let source = POLY.flatten(insets[0], []); - for (let poly of source) { - // segment the smallest inset and test against all other insets - poly.segment(minR).forEachSegment((p1, p2) => { - let np1 = { x:(p1.x+p2.x)/2, y:(p1.y+p2.y)/2 }; - let len = pointDist(p1, p2); - let dx = (p1.x - p2.x) / len; - let dy = (p1.y - p2.y) / len; - let np2 = { x: np1.x + dy * 10, y: np1.y - dx * 10 }; - let max = { dtotl: poly.dtotl, dist: Infinity, maxd: Infinity }; - let term = false; - outer: for (let test of tests) { - for (let tpoly of POLY.flatten(test, [])) { - tpoly.forEachSegment((tp1, tp2) => { - let int = intersectRayLine(np1, { dx: dy, dy: -dx }, tp1, tp2); - if (int && int.dist > int.p1.poly.dtotl) { - return; - } - if (int && int.dist <= max.maxd && int.p1.poly.dtotl > max.dtotl) { - max.dtotl = int.p1.poly.dtotl; - max.dist = int.dist; - max.int = int; - } else if (int && int.dist <= max.maxd && int.p1.poly.dtotl === max.dtotl && int.dist < max.dist) { - max.dtotl = int.p1.poly.dtotl; - max.dist = int.dist; - max.int = int; - } - }); - if (term) { - break outer; - } - } - } - if (max.int) { - lines.push(new Point(np1.x, np1.y)); - lines.push(new Point(max.int.x, max.int.y)); - } - }); - } - return { lines, polys }; - } + // if (brute) { + // let { intersectRayLine } = base.util; + // let tests = insets.slice(1); + // let source = POLY.flatten(insets[0], []); + // for (let poly of source) { + // // segment the smallest inset and test against all other insets + // poly.segment(minR).forEachSegment((p1, p2) => { + // let np1 = { x:(p1.x+p2.x)/2, y:(p1.y+p2.y)/2 }; + // let len = pointDist(p1, p2); + // let dx = (p1.x - p2.x) / len; + // let dy = (p1.y - p2.y) / len; + // let np2 = { x: np1.x + dy * 10, y: np1.y - dx * 10 }; + // let max = { dtotl: poly.dtotl, dist: Infinity, maxd: Infinity }; + // let term = false; + // outer: for (let test of tests) { + // for (let tpoly of POLY.flatten(test, [])) { + // tpoly.forEachSegment((tp1, tp2) => { + // let int = intersectRayLine(np1, { dx: dy, dy: -dx }, tp1, tp2); + // if (int && int.dist > int.p1.poly.dtotl) { + // return; + // } + // if (int && int.dist <= max.maxd && int.p1.poly.dtotl > max.dtotl) { + // max.dtotl = int.p1.poly.dtotl; + // max.dist = int.dist; + // max.int = int; + // } else if (int && int.dist <= max.maxd && int.p1.poly.dtotl === max.dtotl && int.dist < max.dist) { + // max.dtotl = int.p1.poly.dtotl; + // max.dist = int.dist; + // max.int = int; + // } + // }); + // if (term) { + // break outer; + // } + // } + // } + // if (max.int) { + // lines.push(new Point(np1.x, np1.y)); + // lines.push(new Point(max.int.x, max.int.y)); + // } + // }); + // } + // return { lines, polys }; + // } let pointMap = new Map(); let lineMap = new Map(); diff --git a/src/kiri/mode/fdm/slice.js b/src/kiri/mode/fdm/slice.js index 291dcf24..41472f5d 100644 --- a/src/kiri/mode/fdm/slice.js +++ b/src/kiri/mode/fdm/slice.js @@ -1009,7 +1009,7 @@ function doRender(slice, isSynth, params, opt = {}) { .setLayer("walls", Color.thin) .addPolys(top.thin_wall.map(a => a.length === 1 ? - newPolygon().centerCircle(a[0], a[0].r, 6) : + newPolygon().centerCircle(a[0], a[0].r/2, 12) : newPolygon(a.map(p => newPoint(p.x, p.y))) .setZ(slice.z) .closeIf(height) diff --git a/src/moto/license.js b/src/moto/license.js index ae5ed98c..21ca7569 100644 --- a/src/moto/license.js +++ b/src/moto/license.js @@ -3,9 +3,9 @@ const terms = { COPYRIGHT: "Copyright (C) Stewart Allen - All Rights Reserved", LICENSE: "See the license.md file included with the source distribution", - VERSION: "4.3.0" + VERSION: "4.3.1" }; -export const beta = 1; +export const beta = 0; export const license = terms; export const version = terms.VERSION; diff --git a/web/kiri/manifest.json b/web/kiri/manifest.json index ce4522be..051f5f4c 100644 --- a/web/kiri/manifest.json +++ b/web/kiri/manifest.json @@ -1,5 +1,5 @@ { - "name": "Kiri:Moto 4.3.0", + "name": "Kiri:Moto 4.3.1", "short_name": "Kiri:Moto", "description": "Slicer for 3D printers, CNC mills, laser cutters and more", "start_url": "/kiri/",