mark poly depth during fdm shelling
This commit is contained in:
parent
e3ad319292
commit
a92bb122a9
3 changed files with 17 additions and 11 deletions
|
|
@ -422,7 +422,9 @@ var gs_base_polygons = exports;
|
||||||
|
|
||||||
if (out) out.appendAll(polys);
|
if (out) out.appendAll(polys);
|
||||||
if (collector) collector(polys, count);
|
if (collector) collector(polys, count);
|
||||||
if ((count === 0 || count > 1) && polys.length > 0) expand(polys, distance2 || distance, z, out, count > 0 ? count-1 : 0, distance2, collector);
|
if ((count === 0 || count > 1) && polys.length > 0) {
|
||||||
|
expand(polys, distance2 || distance, z, out, count > 0 ? count-1 : 0, distance2, collector);
|
||||||
|
}
|
||||||
|
|
||||||
return polys;
|
return polys;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,11 +82,11 @@ var gs_kiri_slice = exports;
|
||||||
*/
|
*/
|
||||||
function Top(polygon) {
|
function Top(polygon) {
|
||||||
this.poly = polygon; // outline poly
|
this.poly = polygon; // outline poly
|
||||||
this.traces = null; // array of offset/inset trace polygons
|
this.traces = null; // array of offset/inset trace polygons (ordered outer to inner)
|
||||||
this.inner = null; // array of inner fillable polygon areas (inside last trace)
|
this.inner = null; // array of inner fillable areas (inset from last trace)
|
||||||
this.outer = null; // array of outer trace polygons
|
this.outer = null; // array of outer trace polygons (TODO remove)
|
||||||
this.fill_lines = null; // array of solid fill lines
|
this.fill_lines = null; // solid fill lines (array of points)
|
||||||
this.fill_sparse = null; // array of sparse fill polygons
|
this.fill_sparse = null; // sparse fill area open polygons (poly lines)
|
||||||
this.solids = null; // solid fill regions in otherwise sparse fill (from solids.trimmed)
|
this.solids = null; // solid fill regions in otherwise sparse fill (from solids.trimmed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ var gs_kiri_slice = exports;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends all top polygons into a given array and returns it
|
* Returns all top polygons as an array
|
||||||
*
|
*
|
||||||
* @param {Polygon[]} out array to populate
|
* @param {Polygon[]} out array to populate
|
||||||
* @returns {Polygon[]} array of top polygons
|
* @returns {Polygon[]} array of top polygons
|
||||||
|
|
@ -375,13 +375,17 @@ var gs_kiri_slice = exports;
|
||||||
last = [top.poly].clone(true);
|
last = [top.poly].clone(true);
|
||||||
top.traces = last;
|
top.traces = last;
|
||||||
} else {
|
} else {
|
||||||
POLY.expand([top.poly], -offset1, top.poly.getZ(), top.traces, count, -offsetN, function(polys, count2) {
|
POLY.expand([top.poly], -offset1, top.poly.getZ(), top.traces, count, -offsetN, function(polys, countNow) {
|
||||||
if (count === count2) top.outer = polys;
|
// first offset is the outer poly group (max count #)
|
||||||
|
if (count === countNow) top.outer = polys;
|
||||||
last = polys;
|
last = polys;
|
||||||
|
// mark each poly with depth (offset #) starting at 0
|
||||||
|
polys.forEach(function(p) { p.depth = count - countNow });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate fill offset poly set from last offset to top.inner
|
||||||
if (fillOffset && last.length > 0) {
|
if (fillOffset && last.length > 0) {
|
||||||
last.forEach(function(inner) {
|
last.forEach(function(inner) {
|
||||||
POLY.trace2count(inner, top.inner, fillOffset, 1, 0);
|
POLY.trace2count(inner, top.inner, fillOffset, 1, 0);
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@
|
||||||
"express-useragent": "^1.0.8",
|
"express-useragent": "^1.0.8",
|
||||||
"leveldown": "^1.9.0",
|
"leveldown": "^1.9.0",
|
||||||
"levelup": "^1.3.9",
|
"levelup": "^1.3.9",
|
||||||
"moment": "^2.19.1",
|
"moment": "^2.19.3",
|
||||||
"n3d-threejs": "^72.0.0",
|
"n3d-threejs": "^72.0.0",
|
||||||
"pixi.js": "^4.6.0",
|
"pixi.js": "^4.6.2",
|
||||||
"request": "^2.83.0",
|
"request": "^2.83.0",
|
||||||
"serve-static": "^1.13.1",
|
"serve-static": "^1.13.1",
|
||||||
"tween.js": "^0.14.0",
|
"tween.js": "^0.14.0",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue