remove unused debug code
This commit is contained in:
parent
7cf41a8cff
commit
c7358494f9
7 changed files with 5 additions and 59 deletions
|
|
@ -967,12 +967,6 @@ var gs_base_polygon = exports;
|
||||||
*/
|
*/
|
||||||
PRO.isEquivalent = function(poly, recurse, precision) {
|
PRO.isEquivalent = function(poly, recurse, precision) {
|
||||||
// throw new Error("isEquivalent");
|
// throw new Error("isEquivalent");
|
||||||
var debug = DBUG.get('circularity');
|
|
||||||
if (debug) {
|
|
||||||
DBUG.log(["area", this.area(), poly.area(), UTIL.isCloseTo(this.area(), poly.area(), CONF.precision_poly_area)]);
|
|
||||||
DBUG.log(["circ", this.circularity(), poly.circularity()]);
|
|
||||||
DBUG.log(["boun", this.bounds.equals(poly.bounds, precision || CONF.precision_poly_bounds)]);
|
|
||||||
}
|
|
||||||
if (UTIL.isCloseTo(this.area(), poly.area(), precision || CONF.precision_poly_area) &&
|
if (UTIL.isCloseTo(this.area(), poly.area(), precision || CONF.precision_poly_area) &&
|
||||||
this.bounds.equals(poly.bounds, precision || CONF.precision_poly_bounds))
|
this.bounds.equals(poly.bounds, precision || CONF.precision_poly_bounds))
|
||||||
{
|
{
|
||||||
|
|
@ -980,12 +974,7 @@ var gs_base_polygon = exports;
|
||||||
var c1 = this.circularity(),
|
var c1 = this.circularity(),
|
||||||
c2 = poly.circularity();
|
c2 = poly.circularity();
|
||||||
if (ABS(c1-c2) < CONF.precision_circularity && ((1-c1) < CONF.precision_circularity)) {
|
if (ABS(c1-c2) < CONF.precision_circularity && ((1-c1) < CONF.precision_circularity)) {
|
||||||
//DBUG.log("detected circle equivalent");
|
|
||||||
return true;
|
return true;
|
||||||
} else if (debug) {
|
|
||||||
DBUG.log("fail circularity w/ "+ABS(c2-c1)+" 1-c1="+(1-c1)+" 1-c2="+(1-c2));
|
|
||||||
if (c1 > 1.0) this.dump();
|
|
||||||
if (c2 > 1.0) poly.dump();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
|
|
@ -1013,7 +1002,6 @@ var gs_base_polygon = exports;
|
||||||
});
|
});
|
||||||
// fail poly if one point is bad
|
// fail poly if one point is bad
|
||||||
if (!pointok) {
|
if (!pointok) {
|
||||||
if (DBUG.get('equiv')) DBUG.log({min:min, prec:CONF.precision_poly_merge});
|
|
||||||
exit = false;
|
exit = false;
|
||||||
// terminate search
|
// terminate search
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ var gs_base_polygons = exports;
|
||||||
var BASE = self.base,
|
var BASE = self.base,
|
||||||
UTIL = BASE.util,
|
UTIL = BASE.util,
|
||||||
CONF = BASE.config,
|
CONF = BASE.config,
|
||||||
DBUG = BASE.debug,
|
|
||||||
DEG2RAD = Math.PI / 180,
|
DEG2RAD = Math.PI / 180,
|
||||||
ABS = Math.abs,
|
ABS = Math.abs,
|
||||||
SQRT = Math.sqrt,
|
SQRT = Math.sqrt,
|
||||||
|
|
@ -438,8 +437,6 @@ var gs_base_polygons = exports;
|
||||||
* @param {Polygon[]} [first]
|
* @param {Polygon[]} [first]
|
||||||
*/
|
*/
|
||||||
function trace2count(poly, traces, offset, count, depth, last, first) {
|
function trace2count(poly, traces, offset, count, depth, last, first) {
|
||||||
if (DBUG) DBUG.set('last', count === 1);
|
|
||||||
|
|
||||||
if (count === 0) {
|
if (count === 0) {
|
||||||
if (last) last.append(poly);
|
if (last) last.append(poly);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ var gs_kiri_cam = exports;
|
||||||
"facing",
|
"facing",
|
||||||
"drilling"
|
"drilling"
|
||||||
],
|
],
|
||||||
DEBUG = false,
|
|
||||||
MIN = Math.min,
|
MIN = Math.min,
|
||||||
MAX = Math.max,
|
MAX = Math.max,
|
||||||
PI = Math.PI,
|
PI = Math.PI,
|
||||||
|
|
@ -221,7 +220,6 @@ var gs_kiri_cam = exports;
|
||||||
distance = nextdist;
|
distance = nextdist;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// DBUG.log({z:selected.z, dist:distance, off:selected.z - z});
|
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,7 +253,6 @@ var gs_kiri_cam = exports;
|
||||||
slices.forEach(function(slice) {
|
slices.forEach(function(slice) {
|
||||||
if (slice.hasFlats) forced.push(slice);
|
if (slice.hasFlats) forced.push(slice);
|
||||||
})
|
})
|
||||||
// DBUG.log({forced:forced});
|
|
||||||
|
|
||||||
var mid = [];
|
var mid = [];
|
||||||
forced.forEachPair(function(s1, s2) {
|
forced.forEachPair(function(s1, s2) {
|
||||||
|
|
@ -270,13 +267,11 @@ var gs_kiri_cam = exports;
|
||||||
if (Math.abs(delta - step) < slop) return;
|
if (Math.abs(delta - step) < slop) return;
|
||||||
// add another step if decimal too high
|
// add another step if decimal too high
|
||||||
if (dec > slop) nstep = delta / Math.ceil(inc);
|
if (dec > slop) nstep = delta / Math.ceil(inc);
|
||||||
// DBUG.log(['f',delta,step,nstep,delta / nstep]);
|
|
||||||
// find closest slices in-between
|
// find closest slices in-between
|
||||||
for (var zv = s1.z - nstep; zv >= s2.z + nstep/2; zv -= nstep) {
|
for (var zv = s1.z - nstep; zv >= s2.z + nstep/2; zv -= nstep) {
|
||||||
mid.push(closestSliceToZ(slices, zv));
|
mid.push(closestSliceToZ(slices, zv));
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
// DBUG.log({mid:mid});
|
|
||||||
|
|
||||||
forced.appendAll(mid);
|
forced.appendAll(mid);
|
||||||
forced.sort(function(s1, s2) { return s2.z - s1.z; });
|
forced.sort(function(s1, s2) { return s2.z - s1.z; });
|
||||||
|
|
@ -284,7 +279,6 @@ var gs_kiri_cam = exports;
|
||||||
forced = forced.slice(1);
|
forced = forced.slice(1);
|
||||||
forced.forEach(function(slice) {
|
forced.forEach(function(slice) {
|
||||||
emit(slice);
|
emit(slice);
|
||||||
// DBUG.log(slice.z);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// add to output array
|
// add to output array
|
||||||
|
|
@ -498,7 +492,6 @@ var gs_kiri_cam = exports;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG) newtop.push(newPoint(x,y,gridv));
|
|
||||||
newtrace.push(newPoint(x,y,tv));
|
newtrace.push(newPoint(x,y,tv));
|
||||||
ly = y;
|
ly = y;
|
||||||
lv = gridv;
|
lv = gridv;
|
||||||
|
|
@ -545,7 +538,6 @@ var gs_kiri_cam = exports;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG) newtop.push(newPoint(x,y,gridv));
|
|
||||||
newtrace.push(newPoint(x,y,tv));
|
newtrace.push(newPoint(x,y,tv));
|
||||||
lx = x;
|
lx = x;
|
||||||
lv = gridv;
|
lv = gridv;
|
||||||
|
|
@ -719,7 +711,6 @@ var gs_kiri_cam = exports;
|
||||||
shellFinish;
|
shellFinish;
|
||||||
|
|
||||||
if (sliceDepth <= 0.05) {
|
if (sliceDepth <= 0.05) {
|
||||||
DBUG.log("invalid slice depth: "+sliceDepth);
|
|
||||||
return ondone(null);
|
return ondone(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ var gs_kiri_slice = exports;
|
||||||
var KIRI = self.kiri,
|
var KIRI = self.kiri,
|
||||||
BASE = self.base,
|
BASE = self.base,
|
||||||
UTIL = BASE.util,
|
UTIL = BASE.util,
|
||||||
DBUG = BASE.debug,
|
|
||||||
POLY = BASE.polygons,
|
POLY = BASE.polygons,
|
||||||
PRO = Slice.prototype,
|
PRO = Slice.prototype,
|
||||||
fillArea = POLY.fillArea,
|
fillArea = POLY.fillArea,
|
||||||
|
|
@ -303,8 +302,7 @@ var gs_kiri_slice = exports;
|
||||||
tops = slice.tops,
|
tops = slice.tops,
|
||||||
pbuf = [],
|
pbuf = [],
|
||||||
coloridx = 0,
|
coloridx = 0,
|
||||||
open = (slice.camMode === process.FINISH_X || slice.camMode === process.FINISH_Y),
|
open = (slice.camMode === process.FINISH_X || slice.camMode === process.FINISH_Y);
|
||||||
debug = (slice.index === DBUG.get('z-index')) && DBUG.get('outline');
|
|
||||||
|
|
||||||
layer.clear();
|
layer.clear();
|
||||||
|
|
||||||
|
|
@ -342,7 +340,6 @@ var gs_kiri_slice = exports;
|
||||||
case 4:
|
case 4:
|
||||||
tops.forEach(function(top) {
|
tops.forEach(function(top) {
|
||||||
layer.poly(top.poly, colors[0], true, open);
|
layer.poly(top.poly, colors[0], true, open);
|
||||||
if (debug) top.dump();
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -474,8 +471,6 @@ var gs_kiri_slice = exports;
|
||||||
if (this.tops.length === 0) return;
|
if (this.tops.length === 0) return;
|
||||||
if (typeof(angle) != 'number') return;
|
if (typeof(angle) != 'number') return;
|
||||||
|
|
||||||
var debug = (this.index === DBUG.get('z-index')) && DBUG.get('layer-solid');
|
|
||||||
|
|
||||||
this.tops.forEach(function(top) {
|
this.tops.forEach(function(top) {
|
||||||
if (top.inner && top.inner.length > 0) {
|
if (top.inner && top.inner.length > 0) {
|
||||||
top.fill_lines = fillArea(top.inner, angle, spacing, null, 0.00001);
|
top.fill_lines = fillArea(top.inner, angle, spacing, null, 0.00001);
|
||||||
|
|
@ -599,8 +594,7 @@ var gs_kiri_slice = exports;
|
||||||
PRO.doDiff = function(minArea) {
|
PRO.doDiff = function(minArea) {
|
||||||
if (!this.down) return;
|
if (!this.down) return;
|
||||||
|
|
||||||
var debug = (this.index === DBUG.get('z-index')) && DBUG.get('diff'),
|
var top = this,
|
||||||
top = this,
|
|
||||||
bottom = this.down;
|
bottom = this.down;
|
||||||
|
|
||||||
top.bridges = null;
|
top.bridges = null;
|
||||||
|
|
@ -611,9 +605,7 @@ var gs_kiri_slice = exports;
|
||||||
bridges = [],
|
bridges = [],
|
||||||
flats = [];
|
flats = [];
|
||||||
|
|
||||||
if (debug) DBUG.log(['diff.b4', topInner, bottomInner, DBUG.view]);
|
|
||||||
POLY.subtract(topInner, bottomInner, bridges, flats, this.z, minArea);
|
POLY.subtract(topInner, bottomInner, bridges, flats, this.z, minArea);
|
||||||
if (debug) DBUG.log(['diff.af', topInner, bottomInner, bridges, flats, DBUG.view]);
|
|
||||||
|
|
||||||
top.bridges = bridges;
|
top.bridges = bridges;
|
||||||
bottom.flats = flats;
|
bottom.flats = flats;
|
||||||
|
|
@ -682,8 +674,7 @@ var gs_kiri_slice = exports;
|
||||||
scope = this,
|
scope = this,
|
||||||
tops = scope.tops,
|
tops = scope.tops,
|
||||||
solids = scope.solids,
|
solids = scope.solids,
|
||||||
unioned = POLY.union(solids.poly),
|
unioned = POLY.union(solids.poly);
|
||||||
debug = (this.index === DBUG.get('z-index') && DBUG.get('solid-fills'));
|
|
||||||
|
|
||||||
if (solids.length === 0) return false;
|
if (solids.length === 0) return false;
|
||||||
if (unioned.length === 0) return false;
|
if (unioned.length === 0) return false;
|
||||||
|
|
@ -709,8 +700,6 @@ var gs_kiri_slice = exports;
|
||||||
solids.unioned = unioned;
|
solids.unioned = unioned;
|
||||||
solids.trimmed = trims;
|
solids.trimmed = trims;
|
||||||
|
|
||||||
if (debug) DBUG.log(['project', this.index, polys.length, unioned.length, inner.length]);
|
|
||||||
|
|
||||||
// clear old solids and make array for new
|
// clear old solids and make array for new
|
||||||
tops.forEach(function(top) { top.solids = [] });
|
tops.forEach(function(top) { top.solids = [] });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -436,7 +436,6 @@ var gs_kiri_slicer = exports;
|
||||||
connect = [],
|
connect = [],
|
||||||
search = 1,
|
search = 1,
|
||||||
nextMod = 1,
|
nextMod = 1,
|
||||||
debug = (BASE.debug.get('z-index') === index) && BASE.debug.get('connect'),
|
|
||||||
bridge = CONF.bridgeLineGapDistance,
|
bridge = CONF.bridgeLineGapDistance,
|
||||||
p1, p2;
|
p1, p2;
|
||||||
|
|
||||||
|
|
@ -551,7 +550,6 @@ var gs_kiri_slicer = exports;
|
||||||
if (!path.open) closed++; else open++;
|
if (!path.open) closed++; else open++;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (debug) DBUG.log({closed:closed, open:open});
|
|
||||||
// it gets more complicated with multiple possible output paths
|
// it gets more complicated with multiple possible output paths
|
||||||
if (closed > 1 && open === 0) {
|
if (closed > 1 && open === 0) {
|
||||||
// add polygon to path (for area sorting)
|
// add polygon to path (for area sorting)
|
||||||
|
|
@ -563,8 +561,6 @@ var gs_kiri_slicer = exports;
|
||||||
// sort descending by length
|
// sort descending by length
|
||||||
paths.sort(function(a,b) { return b.poly.length - a.poly.length });
|
paths.sort(function(a,b) { return b.poly.length - a.poly.length });
|
||||||
|
|
||||||
if (debug) DBUG.log({paths:paths});
|
|
||||||
|
|
||||||
// emit polygons largest to smallest
|
// emit polygons largest to smallest
|
||||||
// omit polygon if it intersects previously emitted (has del points)
|
// omit polygon if it intersects previously emitted (has del points)
|
||||||
paths.forEach(function(path) {
|
paths.forEach(function(path) {
|
||||||
|
|
@ -575,8 +571,6 @@ var gs_kiri_slicer = exports;
|
||||||
emit(path.poly);
|
emit(path.poly);
|
||||||
emitted++;
|
emitted++;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (debug) DBUG.log({longest:longest.length, paths:paths.length, closed:closed, emitted:emitted});
|
|
||||||
} else {
|
} else {
|
||||||
if (longest.open) {
|
if (longest.open) {
|
||||||
connect.push(longest);
|
connect.push(longest);
|
||||||
|
|
|
||||||
15
js/kiri.js
15
js/kiri.js
|
|
@ -376,8 +376,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
layerSparse: true,
|
layerSparse: true,
|
||||||
layerFill: true,
|
layerFill: true,
|
||||||
layerSupport: true,
|
layerSupport: true,
|
||||||
layerPrint: false,
|
layerPrint: false
|
||||||
layerDebug: false
|
|
||||||
},
|
},
|
||||||
synth: {
|
synth: {
|
||||||
// set in updateSettingsFromFields()
|
// set in updateSettingsFromFields()
|
||||||
|
|
@ -463,10 +462,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
camTopZ = 0;
|
camTopZ = 0;
|
||||||
|
|
||||||
DBUG.enable();
|
DBUG.enable();
|
||||||
DBUG.set('print-move');
|
|
||||||
|
|
||||||
if (SETUP.dc) DBUG.set('connect');
|
|
||||||
if (SETUP.zi) DBUG.set('z-index',parseInt(SETUP.zi[0]));
|
|
||||||
if (SETUP.rm) renderMode = parseInt(SETUP.rm[0]);
|
if (SETUP.rm) renderMode = parseInt(SETUP.rm[0]);
|
||||||
|
|
||||||
KIRI.api = {
|
KIRI.api = {
|
||||||
|
|
@ -2223,7 +2219,6 @@ self.kiri.license = exports.LICENSE;
|
||||||
layerSparse: UC.newBoolean("sparse fill", onBooleanClick, {modes:FDM}),
|
layerSparse: UC.newBoolean("sparse fill", onBooleanClick, {modes:FDM}),
|
||||||
layerSupport: UC.newBoolean("support", onBooleanClick, {modes:FDM}),
|
layerSupport: UC.newBoolean("support", onBooleanClick, {modes:FDM}),
|
||||||
layerPrint: UC.newBoolean("print", onBooleanClick),
|
layerPrint: UC.newBoolean("print", onBooleanClick),
|
||||||
layerDebug: UC.newBoolean("debug", onBooleanClick, {hide:!LOCAL}),
|
|
||||||
|
|
||||||
settingsGroup: UC.newGroup("settings", control),
|
settingsGroup: UC.newGroup("settings", control),
|
||||||
settingsTable: UC.newTableRow([
|
settingsTable: UC.newTableRow([
|
||||||
|
|
@ -3299,14 +3294,6 @@ self.kiri.license = exports.LICENSE;
|
||||||
STATS.add('init');
|
STATS.add('init');
|
||||||
// updateActive(true);
|
// updateActive(true);
|
||||||
|
|
||||||
var zdebug = DBUG.get('z-index');
|
|
||||||
if (zdebug) {
|
|
||||||
prepareSlices(function() {
|
|
||||||
UI.layerRange.checked = true;
|
|
||||||
showSlices(parseInt(zdebug));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// init gcode sender
|
// init gcode sender
|
||||||
KIRI.serial.init();
|
KIRI.serial.init();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
var exports = {
|
var exports = {
|
||||||
COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen <stewart@neuron.com> - All Rights Reserved",
|
COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen <stewart@neuron.com> - All Rights Reserved",
|
||||||
LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.",
|
LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.",
|
||||||
VERSION:"1.0.68"
|
VERSION:"1.0.69"
|
||||||
};
|
};
|
||||||
if (!module) var module = {};
|
if (!module) var module = {};
|
||||||
module.exports = exports;
|
module.exports = exports;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue