improve outline routing by forcing inside then outside without size/dist weight hack. bump rev 2.8.D4

This commit is contained in:
Stewart Allen 2021-03-22 22:24:50 -04:00
commit 6e0c755a18
5 changed files with 8 additions and 7 deletions

View file

@ -6,7 +6,7 @@
if (!self.kiri) {
self.kiri = {
beta: 2803,
beta: 2804,
driver: {}, // driver modules
loader: [] // module loading: array of functions
};

View file

@ -3,7 +3,7 @@
let terms = {
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
LICENSE: "See the license.md file included with the source distribution",
VERSION: "2.8.D3"
VERSION: "2.8.D4"
};
if (typeof(module) === 'object') {

View file

@ -437,7 +437,7 @@
return start;
}
function depthOutlinePath(start, depth, levels, radius, emitter, clr, ease) {
function depthOutlinePath(start, depth, levels, radius, emitter, dir, ease) {
let bottm = depth < levels.length - 1 ? levels[levels.length - 1] : null;
let above = levels[depth-1];
let level = levels[depth];
@ -462,6 +462,8 @@
// }
return true;
});
// limit level search to polys matching winding (inside vs outside)
level = level.filter(p => p.isClockwise() === dir);
// omit polys that match bottom level polys unless level above is cleared
start = poly2polyEmit(level, start, (poly, index, count, fromPoint) => {
poly.level_emit = true;
@ -472,9 +474,9 @@
if (ease) {
fromPoint.z += ease;
}
fromPoint = depthOutlinePath(fromPoint, depth + 1, levels, radius, emitter, clr, ease);
fromPoint = depthOutlinePath(fromPoint, depth + 1, levels, radius, emitter, dir, ease);
return fromPoint;
}, {weight: true});
}, {weight: false});
return start;
}