rename slice object from top to slice for clarity

This commit is contained in:
Stewart Allen 2019-05-08 12:26:07 -04:00
commit 8e8902c6b9

View file

@ -895,24 +895,24 @@ var gs_kiri_slice = exports;
PRO.doSupport = function(minOffset, maxBridge, expand, minArea, pillarSize, offset, gap) { PRO.doSupport = function(minOffset, maxBridge, expand, minArea, pillarSize, offset, gap) {
var min = minArea || 0.1, var min = minArea || 0.1,
size = (pillarSize || 2), size = (pillarSize || 2),
slice = this,
mergeDist = size * 3, // pillar merge dist mergeDist = size * 3, // pillar merge dist
top = this, tops = slice.gatherTopPolys([]),
tops = top.gatherTopPolys([]),
trimTo = tops; trimTo = tops;
// creates outer clip offset from tops // creates outer clip offset from tops
if (expand) POLY.expand(tops, expand, top.z, trimTo = []); if (expand) POLY.expand(tops, expand, slice.z, trimTo = []);
// create inner clip offset from tops // create inner clip offset from tops
POLY.expand(tops, offset, top.z, top.offsets = []); POLY.expand(tops, offset, slice.z, slice.offsets = []);
// skip support detection for bottom layer // skip support detection for bottom layer
if (!top.down) return; if (!slice.down) return;
var traces = POLY.flatten(top.gatherTraces([])), var traces = POLY.flatten(slice.gatherTraces([])),
fill = top.gatherFillLines([]), fill = slice.gatherFillLines([]),
points = [], points = [],
down = top.down, down = slice.down,
down_tops = down.gatherTopPolys([]), down_tops = down.gatherTopPolys([]),
down_traces = POLY.flatten(down.gatherTraces([])); down_traces = POLY.flatten(down.gatherTraces([]));
@ -993,7 +993,7 @@ var gs_kiri_slice = exports;
culled = []; culled = [];
// clip supports to shell offsets // clip supports to shell offsets
POLY.subtract(supports, down.gatherTopPolys([]), trimmed, null, top.z, min); POLY.subtract(supports, down.gatherTopPolys([]), trimmed, null, slice.z, min);
// set depth hint on support polys for infill density // set depth hint on support polys for infill density
trimmed.forEach(function(trim) { trimmed.forEach(function(trim) {