fix for poly.union(). needs benchmarking and verification. roll back depth first change
This commit is contained in:
parent
cedb40b5fc
commit
74df1f946a
3 changed files with 14 additions and 5 deletions
|
|
@ -1306,6 +1306,15 @@
|
||||||
if (clip.Execute(ctyp.ctUnion, ctre, cfil.pftEvenOdd, cfil.pftEvenOdd)) {
|
if (clip.Execute(ctyp.ctUnion, ctre, cfil.pftEvenOdd, cfil.pftEvenOdd)) {
|
||||||
let union = POLY().fromClipperTreeUnion(ctre, poly.getZ(), minarea);
|
let union = POLY().fromClipperTreeUnion(ctre, poly.getZ(), minarea);
|
||||||
if (all) {
|
if (all) {
|
||||||
|
if (union.length === 2) {
|
||||||
|
// TODO look for faster equivalence check. area? perimeter?
|
||||||
|
let src = [this, poly].sort((a,b) => { return a.area() - b.area() });
|
||||||
|
let dst = union.sort((a,b) => { return a.area() - b.area() });
|
||||||
|
if (src[0].isEquivalent(dst[0]) && src[1].isEquivalent(dst[1])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return union;
|
||||||
|
}
|
||||||
return union;
|
return union;
|
||||||
}
|
}
|
||||||
if (union.length === 1) {
|
if (union.length === 1) {
|
||||||
|
|
@ -1313,7 +1322,7 @@
|
||||||
union.fillang = fillang;
|
union.fillang = fillang;
|
||||||
return union;
|
return union;
|
||||||
} else {
|
} else {
|
||||||
console.log({check_union_call_path: union});
|
console.log({check_union_call_path: union, this: this, poly});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1064,8 +1064,8 @@
|
||||||
// - it has more than one sibling
|
// - it has more than one sibling
|
||||||
// - it has no parent (top/outer most)
|
// - it has no parent (top/outer most)
|
||||||
// - it is offset from its parent by more than diameter
|
// - it is offset from its parent by more than diameter
|
||||||
// if (poly.isOpen() || !poly.parent || poly.parent.innerCount() > 1 || !polygonWithinOffset(poly, poly.parent, offset)) {
|
if (poly.isOpen() || !poly.parent || poly.parent.innerCount() > 1 || !polygonWithinOffset(poly, poly.parent, offset)) {
|
||||||
if (poly.depth === 0) {
|
// if (poly.depth === 0) {
|
||||||
pools.push(poly);
|
pools.push(poly);
|
||||||
poly.pool = [];
|
poly.pool = [];
|
||||||
poly.poolsDown = [];
|
poly.poolsDown = [];
|
||||||
|
|
|
||||||
|
|
@ -673,7 +673,6 @@
|
||||||
let flat = POLY.flatten(offset, [], true);
|
let flat = POLY.flatten(offset, [], true);
|
||||||
|
|
||||||
offset = POLY.setZ(POLY.nest(flat), slice.z);
|
offset = POLY.setZ(POLY.nest(flat), slice.z);
|
||||||
// slice.tops[0].inner = offset;
|
|
||||||
|
|
||||||
// inset offset array by 1/2 diameter then by tool overlap %
|
// inset offset array by 1/2 diameter then by tool overlap %
|
||||||
slice.tops[0].traces =
|
slice.tops[0].traces =
|
||||||
|
|
@ -1027,8 +1026,9 @@
|
||||||
data.shadow = shadow.clone(true);
|
data.shadow = shadow.clone(true);
|
||||||
data.slice.camMode = CPRO.OUTLINE;
|
data.slice.camMode = CPRO.OUTLINE;
|
||||||
data.slice.shadow = data.shadow;
|
data.slice.shadow = data.shadow;
|
||||||
|
// data.slice.tops[0].inner = shadow;
|
||||||
slices.push(data.slice);
|
slices.push(data.slice);
|
||||||
onupdate(0.2 + (index/total) * 0.1, "roughing");
|
onupdate(0.2 + (index/total) * 0.1, "outlines");
|
||||||
}, genso: true });
|
}, genso: true });
|
||||||
|
|
||||||
shellOutline = tshadow;
|
shellOutline = tshadow;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue