filter remaining trace polygons to >= minArea
This commit is contained in:
parent
a78ec87fb7
commit
c39576ce37
1 changed files with 47 additions and 31 deletions
|
|
@ -182,51 +182,67 @@ function thin_type_3(params) {
|
||||||
let maxR = midR * 1.5; // max double wall extrusion width
|
let maxR = midR * 1.5; // max double wall extrusion width
|
||||||
let maxF = midR * 2; // max interior extrusion width
|
let maxF = midR * 2; // max interior extrusion width
|
||||||
|
|
||||||
for (let i=0; i<1; i++) {
|
let lines = [];
|
||||||
console.log({ noodle });
|
let polys = [];
|
||||||
|
let trace = [];
|
||||||
|
|
||||||
let { lines, polys, remain, trace } = trace_noodle(noodle, noodleWidth, minR, midR, maxR, {
|
for (let i=0; i<count; i++) {
|
||||||
|
let remain = [];
|
||||||
|
|
||||||
|
for (let n of noodle)
|
||||||
|
trace_noodle(
|
||||||
|
[ n ],
|
||||||
|
noodleWidth,
|
||||||
|
minR,
|
||||||
|
i === 0 ? midR : midR * 1.25,
|
||||||
|
i === 0 ? maxR : maxF,
|
||||||
|
{
|
||||||
|
lines,
|
||||||
|
polys,
|
||||||
|
remain,
|
||||||
|
trace,
|
||||||
brute: false,
|
brute: false,
|
||||||
showMedialAxis: i > 0,
|
showMedialAxis: false,
|
||||||
showChainIntersect: i > 0
|
showChainIntersect: false
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log({ lines, polys, remain, trace });
|
console.log({ remain });
|
||||||
|
|
||||||
POLY.setZ([...lines, ...polys], z);
|
|
||||||
thin.push(...lines);
|
|
||||||
shells.push(...polys);
|
|
||||||
|
|
||||||
// show extrusion
|
|
||||||
if (i === 0)
|
|
||||||
for (let point of trace) {
|
|
||||||
shells.push(newPolygon().centerCircle(point, point.r, 12));
|
|
||||||
}
|
|
||||||
|
|
||||||
// show remaining noodle after single trace
|
// show remaining noodle after single trace
|
||||||
shells.push(...POLY.flatten(remain));
|
shells.push(...POLY.flatten(remain));
|
||||||
|
|
||||||
noodle = [ POLY.nest(remain)[3] ];
|
noodle = remain;
|
||||||
// break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log({ lines, polys, trace });
|
||||||
|
|
||||||
|
// show extrusion
|
||||||
|
for (let point of trace) {
|
||||||
|
shells.push(newPolygon().centerCircle(point, point.r, 12));
|
||||||
|
}
|
||||||
|
|
||||||
|
POLY.setZ([...lines, ...polys], z);
|
||||||
|
thin.push(...lines);
|
||||||
|
shells.push(...polys);
|
||||||
|
|
||||||
return { last, gaps };
|
return { last, gaps };
|
||||||
}
|
}
|
||||||
|
|
||||||
// trace a single extrusion line around the inside of the noodle poly
|
// trace a single extrusion line around the inside of the noodle poly
|
||||||
function trace_noodle(noodle, noodleWidth, minR, midR, maxR, {
|
function trace_noodle(noodle, noodleWidth, minR, midR, maxR, opt = {}) {
|
||||||
brute,
|
let {
|
||||||
showInset,
|
brute,
|
||||||
showMedialAxis,
|
showInset,
|
||||||
showChainIntersect,
|
showMedialAxis,
|
||||||
}) {
|
showChainIntersect,
|
||||||
let scale = 1000;
|
minArea = midR * midR,
|
||||||
|
lines = [],
|
||||||
let remain = [];
|
polys = [],
|
||||||
let trace = [];
|
remain = [],
|
||||||
let polys = [];
|
trace = [],
|
||||||
let lines = [];
|
} = opt;
|
||||||
let insets = [];
|
let insets = [];
|
||||||
|
let scale = 1000;
|
||||||
let dstep = minR / 4;
|
let dstep = minR / 4;
|
||||||
let dtotl = 0;
|
let dtotl = 0;
|
||||||
|
|
||||||
|
|
@ -498,7 +514,7 @@ function trace_noodle(noodle, noodleWidth, minR, midR, maxR, {
|
||||||
POLY.flatten(setA, [], true).map(p => {
|
POLY.flatten(setA, [], true).map(p => {
|
||||||
return p.clean().simplify();
|
return p.clean().simplify();
|
||||||
}).flat()
|
}).flat()
|
||||||
);
|
).filter(p => p.area() >= minArea);
|
||||||
remain.push(...ret);
|
remain.push(...ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue