alter depth first paths to use proper poly2poly parameter
This commit is contained in:
parent
afedbfb5f9
commit
3b07a089dd
2 changed files with 22 additions and 8 deletions
|
|
@ -441,6 +441,10 @@
|
|||
* @returns {Polygon[]} last offset
|
||||
*/
|
||||
function expand(polys, distance, z, out, count, distance2, collector, min) {
|
||||
// return offset(polys, [distance, distance2 || distance], {
|
||||
// z, outs: out, call: collector, minArea: min, count, flat: true
|
||||
// });
|
||||
|
||||
// prepare alignments for clipper lib
|
||||
alignWindings(polys);
|
||||
polys.forEach(function(poly) {
|
||||
|
|
@ -491,6 +495,7 @@
|
|||
|
||||
let orig = polys,
|
||||
opts = opt || {},
|
||||
count = numOrDefault(opt.count, 1),
|
||||
depth = numOrDefault(opt.depth, 0),
|
||||
clean = opts.clean !== false,
|
||||
simple = opts.simple !== false,
|
||||
|
|
@ -538,12 +543,21 @@
|
|||
opt.outs = opt.outs || [];
|
||||
// store polys in accumulator
|
||||
opt.outs.append(polys, opt.flat);
|
||||
if (opt.count > 1) {
|
||||
// callback for expand() compatibility
|
||||
if (opt.call) {
|
||||
opt.call(polys, count);
|
||||
}
|
||||
// check for more offsets
|
||||
if (count > 1) {
|
||||
// decrement count, increment depth
|
||||
opt.count--;
|
||||
opt.count = count - 1;
|
||||
opt.depth = depth + 1;
|
||||
// call next offset
|
||||
offset(polys, dist, opt);
|
||||
// } else if (count === 0) {
|
||||
// // depth = 0 means offset until failure
|
||||
// opt.depth = depth + 1;
|
||||
// offset(polys, dist, opt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1096,9 +1096,9 @@
|
|||
continue;
|
||||
}
|
||||
// do not allow inner and outer polys to mix
|
||||
if (!above.sameWindings(pool)) {
|
||||
continue;
|
||||
}
|
||||
// if (!above.sameWindings(pool)) {
|
||||
// continue;
|
||||
// }
|
||||
// if pool fits into smallest above pool, add it and break
|
||||
if (polygonFitsIn(pool, above, 0.1)) {
|
||||
above.poolsDown.push(pool);
|
||||
|
|
@ -1112,8 +1112,8 @@
|
|||
if (poolPoly.mark) return;
|
||||
poolPoly.mark = true;
|
||||
const polys = poolPoly.pool.slice().append(poolPoly);
|
||||
startPoint = poly2polyEmit(polys, startPoint, emitter);
|
||||
startPoint = poly2polyEmit(poolPoly.poolsDown, startPoint, emitPool, "del_pdown");
|
||||
startPoint = poly2polyEmit(polys, startPoint, emitter, null, false);
|
||||
startPoint = poly2polyEmit(poolPoly.poolsDown, startPoint, emitPool, "del_pdown", false);
|
||||
return startPoint;
|
||||
};
|
||||
|
||||
|
|
@ -1121,7 +1121,7 @@
|
|||
// pools are sorted smallest to largest. pools are polygons with an
|
||||
// attached 'pool' array of polygons
|
||||
layers.forEach(function(pools) {
|
||||
startPoint = poly2polyEmit(pools, startPoint, emitPool, "del_ptop");
|
||||
startPoint = poly2polyEmit(pools, startPoint, emitPool, "del_ptop", true);
|
||||
})
|
||||
return startPoint;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue