diff --git a/src/geo/polygon.js b/src/geo/polygon.js index c8414b63..dbfe2d9d 100644 --- a/src/geo/polygon.js +++ b/src/geo/polygon.js @@ -1730,42 +1730,27 @@ return null; } - function leftmost(p1, p2) { - if (!p1) { - return p2; - } - if (p1.x <= p2.x) { - if (p1.x < p2.x || (p1.x === p2.x && p1.y < p2.y)) { - return p2; - } - } - return p1; - } - - // return top-most, left-post point - PRO.leftmost = function() { - let tl = undefined; - for (let p of this.points) { - tl = leftmost(tl, p); - } - return tl; - }; - PRO.areaDiff = function(poly) { let a1 = this.area(), a2 = poly.area(); return (a1 > a2) ? a2 / a1 : a1 / a2; }; - PRO.areaOrLength = function(poly) { - return this.length === poly.length || this.areaDiff(poly) > 0.98; + PRO.unionMatch = function(polys) { + return polys.filter(poly => poly.isEquivalent(this)).length; + // for (let poly of polys) { + // if (this.isEquivalent(poly)) { + // return true; + // } + // } + // return false; }; /** * return logical OR of two polygons' enclosed areas * * @param {Polygon} poly - * @returns {?Polygon} intersected polygon or null if no intersection + * @returns {?Polygon} intersected polygon, null if no intersection, or all when indicated */ PRO.union = function(poly, min, all) { if (!this.overlaps(poly)) return null; @@ -1788,33 +1773,10 @@ let union = POLY().fromClipperTreeUnion(ctre, poly.getZ(), minarea); if (all) { if (union.length === 2) { - let src = [ this.leftmost(), poly.leftmost() ]; - let dst = [ union[0].leftmost(), union[1].leftmost() ]; - - if (leftmost(src[0], src[1]) === src[1]) { - src.reverse(); - } - if (leftmost(dst[0], dst[1]) === dst[1]) { - dst.reverse(); - } - if ( - src[0].poly && src[1].poly && // missing for cam tabs - src[0].isEqual2D(dst[0]) && - src[1].isEqual2D(dst[1]) && - src[0].poly.areaOrLength(dst[0].poly) && - src[1].poly.areaOrLength(dst[1].poly) - ) { - return null; - // } else { - // console.log("union debug", { - // src, - // dst, - // d0: src[0].poly.areaDiff(dst[0].poly), - // d1: src[1].poly.areaDiff(dst[1].poly), - // m0: src[0].isEqual2D(dst[0]), - // m1: src[1].isEqual2D(dst[1]) - // }); - } + return null; + // if (this.unionMatch(union) || poly.unionMatch(union)) { + // return null; + // } } return union; } diff --git a/src/kiri/main.js b/src/kiri/main.js index a955d4f9..910c8d96 100644 --- a/src/kiri/main.js +++ b/src/kiri/main.js @@ -1954,9 +1954,9 @@ name = name.substring(sp + 1); } UI.mesh.name.innerText = name; - UI.mesh.points.innerText = sel.meta.vertices; - UI.mesh.faces.innerText = sel.meta.vertices / 3; } + UI.mesh.points.innerText = sel.meta.vertices; + UI.mesh.faces.innerText = sel.meta.vertices / 3; } else { UI.mesh.name.innerText = `[${selcount}]`; UI.mesh.points.innerText = '-'; diff --git a/src/mode/fdm/slice.js b/src/mode/fdm/slice.js index 2b15a665..97d8c017 100644 --- a/src/mode/fdm/slice.js +++ b/src/mode/fdm/slice.js @@ -1664,14 +1664,19 @@ } let groups = coplane.group(true); // console.log({v3cache, coplane, groups}); + // let ptotl = Object.values(groups).flat().flat().length; + // console.log({ptotl}); + // let pdone = 0; for (let group of Object.values(groups)) { for (let polys of group) { for (let poly of polys) { if (poly.area() >= process.sliceSupportArea) tP(poly, polys.face); + // console.log(++pdone / ptotl); } } } + widget.supports = add; return add.length > 0; }; @@ -1742,7 +1747,8 @@ .add(arr[1].x, arr[1].y, arr[1].z) .add(arr[2].x, arr[2].y, arr[2].z); }); - let union = POLY.union(parr, 0, true, {wasm:true}); + let union = parr.length === 1 ? parr : + POLY.union(parr, 0, true, {wasm:false}); union.merged = parr.length; union.face = group[0]; return union; diff --git a/web/kiri/lang/en.js b/web/kiri/lang/en.js index 6097b76f..9034d35b 100644 --- a/web/kiri/lang/en.js +++ b/web/kiri/lang/en.js @@ -381,7 +381,7 @@ kiri.lang['en-us'] = { sp_dens_s: "density", sp_dens_l: ["fraction 0.0 - 1.0","recommended 0.15","0 to disable"], sp_size_s: "pillar size", - sp_size_l: ["pillar width","in millimeters"], + sp_size_l: ["pillar width in millimeters","smaller values exponentially","increase detection times"], sp_offs_s: "part offset", sp_offs_l: ["offset from part","in millimeters"], sp_gaps_s: "gap layers", @@ -389,9 +389,9 @@ kiri.lang['en-us'] = { sp_span_s: "max span", sp_span_l: ["unsupported span that causes","a new support to be generated","in millimeters"], sp_angl_s: "max angle", - sp_angl_l: ["max overhang angle before","supporting pillar is generated"], + sp_angl_l: ["max overhang angle before","supporting pillar is generated","normal values 45-60","belt values 0-10"], sp_area_s: "min area", - sp_area_l: ["minimum area for","a support column","in millimeters"], + sp_area_l: ["minimum area for","a support column","in millimeters","smaller values will","slow detection"], sp_xpnd_s: "expand", sp_xpnd_l: ["expand support area","beyond part boundary","in millimeters"], sp_nozl_s: "extruder",