add missing thin wall render
This commit is contained in:
parent
709336c36e
commit
e7a050e03e
7 changed files with 37 additions and 21 deletions
|
|
@ -157,7 +157,6 @@
|
||||||
|
|
||||||
registerDecoder('top', function(v, state) {
|
registerDecoder('top', function(v, state) {
|
||||||
let top = KIRI.newTop(decode(v.poly, state));
|
let top = KIRI.newTop(decode(v.poly, state));
|
||||||
|
|
||||||
// top.traces = decode(v.traces, state);
|
// top.traces = decode(v.traces, state);
|
||||||
// top.inner = decode(v.inner, state);
|
// top.inner = decode(v.inner, state);
|
||||||
// // top.thinner = decode(v.thinner, state);
|
// // top.thinner = decode(v.thinner, state);
|
||||||
|
|
@ -166,7 +165,6 @@
|
||||||
// top.fill_lines = decodePointArray(v.fill_lines, state);
|
// top.fill_lines = decodePointArray(v.fill_lines, state);
|
||||||
// top.fill_sparse = decode(v.fill_sparse, state);
|
// top.fill_sparse = decode(v.fill_sparse, state);
|
||||||
// top.polish = decode(v.polish, state);
|
// top.polish = decode(v.polish, state);
|
||||||
|
|
||||||
return top;
|
return top;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
VIEWS = CONF.VIEWS,
|
VIEWS = CONF.VIEWS,
|
||||||
clone = Object.clone,
|
clone = Object.clone,
|
||||||
settings = clone(CONF.template),
|
settings = clone(CONF.template),
|
||||||
settingsDefault = clone(settings),
|
// settingsDefault = clone(settings),
|
||||||
// ---------------
|
// ---------------
|
||||||
Widget = kiri.Widget,
|
Widget = kiri.Widget,
|
||||||
newWidget = kiri.newWidget,
|
newWidget = kiri.newWidget,
|
||||||
|
|
|
||||||
|
|
@ -614,7 +614,7 @@
|
||||||
|
|
||||||
function intersectsTop(p1, p2) {
|
function intersectsTop(p1, p2) {
|
||||||
let int = false;
|
let int = false;
|
||||||
POLY.flatten(slice.gatherTopPolys([])).forEach(function(poly) {
|
POLY.flatten(slice.topPolys().clone(true)).forEach(function(poly) {
|
||||||
if (!int) poly.forEachSegment(function(s1, s2) {
|
if (!int) poly.forEachSegment(function(s1, s2) {
|
||||||
if (UTIL.intersect(p1,p2,s1,s2,BASE.key.SEGINT)) {
|
if (UTIL.intersect(p1,p2,s1,s2,BASE.key.SEGINT)) {
|
||||||
int = true;
|
int = true;
|
||||||
|
|
@ -879,7 +879,7 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// top object
|
// top object
|
||||||
let bounds = POLY.flatten(next.gatherOuter([]));
|
let bounds = POLY.flatten(next.shellsAtDepth(0));
|
||||||
|
|
||||||
let dir = -1; // 1 == inside out, -1 == outside-in
|
let dir = -1; // 1 == inside out, -1 == outside-in
|
||||||
|
|
||||||
|
|
@ -888,7 +888,7 @@
|
||||||
outputTraces([].appendAll(next.innerTraces() || []));
|
outputTraces([].appendAll(next.innerTraces() || []));
|
||||||
|
|
||||||
// sort perimeter polygon by length to go out-to-in or in-to-out
|
// sort perimeter polygon by length to go out-to-in or in-to-out
|
||||||
(next.traces || []).sort(function(a,b) {
|
(next.shells || []).sort(function(a,b) {
|
||||||
return a.perimeter() > b.perimeter() ? dir : -dir;
|
return a.perimeter() > b.perimeter() ? dir : -dir;
|
||||||
}).forEach(function(poly, index) {
|
}).forEach(function(poly, index) {
|
||||||
outputTraces(poly);
|
outputTraces(poly);
|
||||||
|
|
|
||||||
|
|
@ -69,17 +69,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends all outermost trace polygons into a given array
|
* Returns shell polygons of a given depth
|
||||||
* and returns it. used by Print
|
* used by Print (FDM)
|
||||||
*
|
*
|
||||||
* @param {Polygon[]} out array to populate
|
* @param {Polygon[]} out array to populate
|
||||||
* @returns {Polygon[]} array of top polygons
|
* @returns {Polygon[]} array of top polygons
|
||||||
*/
|
*/
|
||||||
Top.prototype.gatherOuter = function(out) {
|
Top.prototype.shellsAtDepth = function(depth) {
|
||||||
this.traces.forEach(function(trace) {
|
return this.shells.filter(poly => poly.depth === depth);
|
||||||
if (trace.depth === 0) out.append(trace);
|
|
||||||
});
|
|
||||||
return out;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** ******************************************************************
|
/** ******************************************************************
|
||||||
|
|
@ -161,17 +158,34 @@
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new top object given a polygon
|
|
||||||
*
|
|
||||||
* @param {Polygon} poly to add
|
|
||||||
*/
|
|
||||||
PRO.addTop = function(poly) {
|
PRO.addTop = function(poly) {
|
||||||
let top = new Top(poly);
|
let top = new Top(poly);
|
||||||
this.tops.push(top);
|
this.tops.push(top);
|
||||||
return top;
|
return top;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PRO.findClosestPointTo = function(target) {
|
||||||
|
let min, find;
|
||||||
|
|
||||||
|
if (this.tops.length) {
|
||||||
|
this.tops.forEach(function(top) {
|
||||||
|
find = top.poly.findClosestPointTo(target);
|
||||||
|
if (!min || find.distance < min.distance) {
|
||||||
|
min = find;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (this.supports) {
|
||||||
|
this.supports.forEach(function(poly) {
|
||||||
|
find = poly.findClosestPointTo(target);
|
||||||
|
if (!min || find.distance < min.distance) {
|
||||||
|
min = find;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return min;
|
||||||
|
};
|
||||||
|
|
||||||
function newTop(poly) {
|
function newTop(poly) {
|
||||||
return new Top(poly);
|
return new Top(poly);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,6 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FDM.printRender = function(print, options) {
|
FDM.printRender = function(print, options) {
|
||||||
let debug = KIRI.api.const.LOCAL;
|
let debug = KIRI.api.const.LOCAL;
|
||||||
let scope = print, emits, last,
|
let scope = print, emits, last,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
let KIRI = self.kiri,
|
let KIRI = self.kiri,
|
||||||
BASE = self.base,
|
BASE = self.base,
|
||||||
UTIL = BASE.util,
|
UTIL = BASE.util,
|
||||||
|
POLY = BASE.polygons,
|
||||||
FDM = KIRI.driver.FDM,
|
FDM = KIRI.driver.FDM,
|
||||||
newPoint = BASE.newPoint;
|
newPoint = BASE.newPoint;
|
||||||
|
|
||||||
|
|
@ -368,6 +369,8 @@
|
||||||
layerout = [];
|
layerout = [];
|
||||||
lastOut = undefined;
|
lastOut = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log({output});
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -444,6 +444,10 @@
|
||||||
.setLayer("infill", COLOR.infill)
|
.setLayer("infill", COLOR.infill)
|
||||||
.addPolys(top.fill_sparse, vopt({ offset, height, open: true, outline: true }))
|
.addPolys(top.fill_sparse, vopt({ offset, height, open: true, outline: true }))
|
||||||
|
|
||||||
|
if (top.thin_fill) output
|
||||||
|
.setLayer("fill", COLOR.fill)
|
||||||
|
.addLines(top.thin_fill, vopt({ offset, height }));
|
||||||
|
|
||||||
// emit solid areas
|
// emit solid areas
|
||||||
// if (isThin && debug) {
|
// if (isThin && debug) {
|
||||||
// output
|
// output
|
||||||
|
|
@ -607,8 +611,6 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const render = slice.output();
|
|
||||||
|
|
||||||
slice.tops.forEach(function(top) {
|
slice.tops.forEach(function(top) {
|
||||||
const lines = fillArea(top.fill_off, angle, spacing, null);
|
const lines = fillArea(top.fill_off, angle, spacing, null);
|
||||||
top.fill_lines.appendAll(lines);
|
top.fill_lines.appendAll(lines);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue