change method for eliminating duplicate internal thru polys
This commit is contained in:
parent
32c162e99c
commit
0b26bf35b1
3 changed files with 13 additions and 14 deletions
|
|
@ -223,7 +223,7 @@
|
|||
});
|
||||
shadow = POLY.nest(shadow);
|
||||
|
||||
// expand shadow by half tool diameter + stock to leave
|
||||
// shell = shadow expanded by half tool diameter + leave stock
|
||||
const sadd = roughIn ? toolDiam / 2 : toolDiam / 2;
|
||||
const shell = POLY.offset(shadow, sadd + roughLeave);
|
||||
|
||||
|
|
@ -274,10 +274,12 @@
|
|||
// elimate double inset on inners
|
||||
offset.forEach(op => {
|
||||
if (op.inner) {
|
||||
let operim = op.perimeter();
|
||||
let pv1 = op.perimeter();
|
||||
let newinner = [];
|
||||
op.inner.forEach(oi => {
|
||||
if (Math.abs(oi.perimeter() - operim) > 0.01) {
|
||||
let pv2 = oi.perimeter();
|
||||
let pct = pv1 > pv2 ? pv2/pv1 : pv1/pv2;
|
||||
if (pct < 0.98) {
|
||||
newinner.push(oi);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -580,6 +580,7 @@
|
|||
const flat = opts.flat;
|
||||
const thin = opts.thin && !flat;
|
||||
const ckspeed = opts.speed !== false;
|
||||
const headColor = 0x888888;
|
||||
const moveColor = opts.move >= 0 ? opts.move : 0xaaaaaa;
|
||||
const printColor = opts.print >= 0 ? opts.print : 0x777700;
|
||||
const layers = [];
|
||||
|
|
@ -709,14 +710,14 @@
|
|||
}
|
||||
if (heads.length) {
|
||||
output
|
||||
.setLayer('arrows', { face: moveColor, line: 0x555555, opacity: 0.5 }, true)
|
||||
.setLayer('arrows', { face: headColor, line: 0x112233, opacity: 0.5 }, true)
|
||||
.addAreas(heads.map(points => {
|
||||
const {p1, p2} = points;
|
||||
const slope = p2.slopeTo(p1);
|
||||
const s1 = BASE.newSlopeFromAngle(slope.angle + 20);
|
||||
const s2 = BASE.newSlopeFromAngle(slope.angle - 20);
|
||||
const p3 = points.p2.projectOnSlope(s1, 0.4);
|
||||
const p4 = points.p2.projectOnSlope(s2, 0.4);
|
||||
const p3 = points.p2.projectOnSlope(s1, 0.8);
|
||||
const p4 = points.p2.projectOnSlope(s2, 0.8);
|
||||
return newPolygon().addPoints([p2,p3,p4]).setZ(p2.z + 0.01);
|
||||
}), { thin: true, outline: true });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue