bump rev 4.3.1 and fix thinwall closed poly
This commit is contained in:
parent
33aa8a550f
commit
e8d5c9e743
6 changed files with 54 additions and 50 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "grid-apps",
|
"name": "grid-apps",
|
||||||
"version": "4.3.0",
|
"version": "4.3.1",
|
||||||
"description": "grid.space 3d slicing & modeling tools",
|
"description": "grid.space 3d slicing & modeling tools",
|
||||||
"author": "Stewart Allen <sa@grid.space>",
|
"author": "Stewart Allen <sa@grid.space>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
||||||
|
|
@ -1105,7 +1105,11 @@ export class Polygon {
|
||||||
}
|
}
|
||||||
|
|
||||||
closeIf(dist = 1) {
|
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();
|
return this.setClosed();
|
||||||
} else {
|
} else {
|
||||||
return this.setOpen();
|
return this.setOpen();
|
||||||
|
|
|
||||||
|
|
@ -287,50 +287,50 @@ function trace_noodle(noodle, noodleWidth, minR, midR, maxR, opt = {}) {
|
||||||
// micro stepping insets. the same intersect technique used with
|
// micro stepping insets. the same intersect technique used with
|
||||||
// medial axis can be applied to this structure to produce an
|
// medial axis can be applied to this structure to produce an
|
||||||
// equivalent output. not as computationally efficient, but much simpler.
|
// equivalent output. not as computationally efficient, but much simpler.
|
||||||
if (brute) {
|
// if (brute) {
|
||||||
let { intersectRayLine } = base.util;
|
// let { intersectRayLine } = base.util;
|
||||||
let tests = insets.slice(1);
|
// let tests = insets.slice(1);
|
||||||
let source = POLY.flatten(insets[0], []);
|
// let source = POLY.flatten(insets[0], []);
|
||||||
for (let poly of source) {
|
// for (let poly of source) {
|
||||||
// segment the smallest inset and test against all other insets
|
// // segment the smallest inset and test against all other insets
|
||||||
poly.segment(minR).forEachSegment((p1, p2) => {
|
// poly.segment(minR).forEachSegment((p1, p2) => {
|
||||||
let np1 = { x:(p1.x+p2.x)/2, y:(p1.y+p2.y)/2 };
|
// let np1 = { x:(p1.x+p2.x)/2, y:(p1.y+p2.y)/2 };
|
||||||
let len = pointDist(p1, p2);
|
// let len = pointDist(p1, p2);
|
||||||
let dx = (p1.x - p2.x) / len;
|
// let dx = (p1.x - p2.x) / len;
|
||||||
let dy = (p1.y - p2.y) / len;
|
// let dy = (p1.y - p2.y) / len;
|
||||||
let np2 = { x: np1.x + dy * 10, y: np1.y - dx * 10 };
|
// let np2 = { x: np1.x + dy * 10, y: np1.y - dx * 10 };
|
||||||
let max = { dtotl: poly.dtotl, dist: Infinity, maxd: Infinity };
|
// let max = { dtotl: poly.dtotl, dist: Infinity, maxd: Infinity };
|
||||||
let term = false;
|
// let term = false;
|
||||||
outer: for (let test of tests) {
|
// outer: for (let test of tests) {
|
||||||
for (let tpoly of POLY.flatten(test, [])) {
|
// for (let tpoly of POLY.flatten(test, [])) {
|
||||||
tpoly.forEachSegment((tp1, tp2) => {
|
// tpoly.forEachSegment((tp1, tp2) => {
|
||||||
let int = intersectRayLine(np1, { dx: dy, dy: -dx }, tp1, tp2);
|
// let int = intersectRayLine(np1, { dx: dy, dy: -dx }, tp1, tp2);
|
||||||
if (int && int.dist > int.p1.poly.dtotl) {
|
// if (int && int.dist > int.p1.poly.dtotl) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
if (int && int.dist <= max.maxd && int.p1.poly.dtotl > max.dtotl) {
|
// if (int && int.dist <= max.maxd && int.p1.poly.dtotl > max.dtotl) {
|
||||||
max.dtotl = int.p1.poly.dtotl;
|
// max.dtotl = int.p1.poly.dtotl;
|
||||||
max.dist = int.dist;
|
// max.dist = int.dist;
|
||||||
max.int = int;
|
// max.int = int;
|
||||||
} else if (int && int.dist <= max.maxd && int.p1.poly.dtotl === max.dtotl && int.dist < max.dist) {
|
// } else if (int && int.dist <= max.maxd && int.p1.poly.dtotl === max.dtotl && int.dist < max.dist) {
|
||||||
max.dtotl = int.p1.poly.dtotl;
|
// max.dtotl = int.p1.poly.dtotl;
|
||||||
max.dist = int.dist;
|
// max.dist = int.dist;
|
||||||
max.int = int;
|
// max.int = int;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
if (term) {
|
// if (term) {
|
||||||
break outer;
|
// break outer;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (max.int) {
|
// if (max.int) {
|
||||||
lines.push(new Point(np1.x, np1.y));
|
// lines.push(new Point(np1.x, np1.y));
|
||||||
lines.push(new Point(max.int.x, max.int.y));
|
// lines.push(new Point(max.int.x, max.int.y));
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
return { lines, polys };
|
// return { lines, polys };
|
||||||
}
|
// }
|
||||||
|
|
||||||
let pointMap = new Map();
|
let pointMap = new Map();
|
||||||
let lineMap = new Map();
|
let lineMap = new Map();
|
||||||
|
|
|
||||||
|
|
@ -1009,7 +1009,7 @@ function doRender(slice, isSynth, params, opt = {}) {
|
||||||
.setLayer("walls", Color.thin)
|
.setLayer("walls", Color.thin)
|
||||||
.addPolys(top.thin_wall.map(a =>
|
.addPolys(top.thin_wall.map(a =>
|
||||||
a.length === 1 ?
|
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)))
|
newPolygon(a.map(p => newPoint(p.x, p.y)))
|
||||||
.setZ(slice.z)
|
.setZ(slice.z)
|
||||||
.closeIf(height)
|
.closeIf(height)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
const terms = {
|
const terms = {
|
||||||
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
|
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
|
||||||
LICENSE: "See the license.md file included with the source distribution",
|
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 license = terms;
|
||||||
export const version = terms.VERSION;
|
export const version = terms.VERSION;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "Kiri:Moto 4.3.0",
|
"name": "Kiri:Moto 4.3.1",
|
||||||
"short_name": "Kiri:Moto",
|
"short_name": "Kiri:Moto",
|
||||||
"description": "Slicer for 3D printers, CNC mills, laser cutters and more",
|
"description": "Slicer for 3D printers, CNC mills, laser cutters and more",
|
||||||
"start_url": "/kiri/",
|
"start_url": "/kiri/",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue