remove unused debug code

This commit is contained in:
Stewart Allen 2017-11-13 13:00:04 -05:00
commit c7358494f9
7 changed files with 5 additions and 59 deletions

View file

@ -967,12 +967,6 @@ var gs_base_polygon = exports;
*/
PRO.isEquivalent = function(poly, recurse, precision) {
// 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) &&
this.bounds.equals(poly.bounds, precision || CONF.precision_poly_bounds))
{
@ -980,12 +974,7 @@ var gs_base_polygon = exports;
var c1 = this.circularity(),
c2 = poly.circularity();
if (ABS(c1-c2) < CONF.precision_circularity && ((1-c1) < CONF.precision_circularity)) {
//DBUG.log("detected circle equivalent");
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) {
@ -1013,7 +1002,6 @@ var gs_base_polygon = exports;
});
// fail poly if one point is bad
if (!pointok) {
if (DBUG.get('equiv')) DBUG.log({min:min, prec:CONF.precision_poly_merge});
exit = false;
// terminate search
return true;

View file

@ -12,7 +12,6 @@ var gs_base_polygons = exports;
var BASE = self.base,
UTIL = BASE.util,
CONF = BASE.config,
DBUG = BASE.debug,
DEG2RAD = Math.PI / 180,
ABS = Math.abs,
SQRT = Math.sqrt,
@ -438,8 +437,6 @@ var gs_base_polygons = exports;
* @param {Polygon[]} [first]
*/
function trace2count(poly, traces, offset, count, depth, last, first) {
if (DBUG) DBUG.set('last', count === 1);
if (count === 0) {
if (last) last.append(poly);
return;

View file

@ -37,7 +37,6 @@ var gs_kiri_cam = exports;
"facing",
"drilling"
],
DEBUG = false,
MIN = Math.min,
MAX = Math.max,
PI = Math.PI,
@ -221,7 +220,6 @@ var gs_kiri_cam = exports;
distance = nextdist;
}
});
// DBUG.log({z:selected.z, dist:distance, off:selected.z - z});
return selected;
}
@ -255,7 +253,6 @@ var gs_kiri_cam = exports;
slices.forEach(function(slice) {
if (slice.hasFlats) forced.push(slice);
})
// DBUG.log({forced:forced});
var mid = [];
forced.forEachPair(function(s1, s2) {
@ -270,13 +267,11 @@ var gs_kiri_cam = exports;
if (Math.abs(delta - step) < slop) return;
// add another step if decimal too high
if (dec > slop) nstep = delta / Math.ceil(inc);
// DBUG.log(['f',delta,step,nstep,delta / nstep]);
// find closest slices in-between
for (var zv = s1.z - nstep; zv >= s2.z + nstep/2; zv -= nstep) {
mid.push(closestSliceToZ(slices, zv));
}
}, 1);
// DBUG.log({mid:mid});
forced.appendAll(mid);
forced.sort(function(s1, s2) { return s2.z - s1.z; });
@ -284,7 +279,6 @@ var gs_kiri_cam = exports;
forced = forced.slice(1);
forced.forEach(function(slice) {
emit(slice);
// DBUG.log(slice.z);
});
// 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));
ly = y;
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));
lx = x;
lv = gridv;
@ -719,7 +711,6 @@ var gs_kiri_cam = exports;
shellFinish;
if (sliceDepth <= 0.05) {
DBUG.log("invalid slice depth: "+sliceDepth);
return ondone(null);
}

View file

@ -12,7 +12,6 @@ var gs_kiri_slice = exports;
var KIRI = self.kiri,
BASE = self.base,
UTIL = BASE.util,
DBUG = BASE.debug,
POLY = BASE.polygons,
PRO = Slice.prototype,
fillArea = POLY.fillArea,
@ -303,8 +302,7 @@ var gs_kiri_slice = exports;
tops = slice.tops,
pbuf = [],
coloridx = 0,
open = (slice.camMode === process.FINISH_X || slice.camMode === process.FINISH_Y),
debug = (slice.index === DBUG.get('z-index')) && DBUG.get('outline');
open = (slice.camMode === process.FINISH_X || slice.camMode === process.FINISH_Y);
layer.clear();
@ -342,7 +340,6 @@ var gs_kiri_slice = exports;
case 4:
tops.forEach(function(top) {
layer.poly(top.poly, colors[0], true, open);
if (debug) top.dump();
});
break;
}
@ -474,8 +471,6 @@ var gs_kiri_slice = exports;
if (this.tops.length === 0) return;
if (typeof(angle) != 'number') return;
var debug = (this.index === DBUG.get('z-index')) && DBUG.get('layer-solid');
this.tops.forEach(function(top) {
if (top.inner && top.inner.length > 0) {
top.fill_lines = fillArea(top.inner, angle, spacing, null, 0.00001);
@ -599,8 +594,7 @@ var gs_kiri_slice = exports;
PRO.doDiff = function(minArea) {
if (!this.down) return;
var debug = (this.index === DBUG.get('z-index')) && DBUG.get('diff'),
top = this,
var top = this,
bottom = this.down;
top.bridges = null;
@ -611,9 +605,7 @@ var gs_kiri_slice = exports;
bridges = [],
flats = [];
if (debug) DBUG.log(['diff.b4', topInner, bottomInner, DBUG.view]);
POLY.subtract(topInner, bottomInner, bridges, flats, this.z, minArea);
if (debug) DBUG.log(['diff.af', topInner, bottomInner, bridges, flats, DBUG.view]);
top.bridges = bridges;
bottom.flats = flats;
@ -682,8 +674,7 @@ var gs_kiri_slice = exports;
scope = this,
tops = scope.tops,
solids = scope.solids,
unioned = POLY.union(solids.poly),
debug = (this.index === DBUG.get('z-index') && DBUG.get('solid-fills'));
unioned = POLY.union(solids.poly);
if (solids.length === 0) return false;
if (unioned.length === 0) return false;
@ -709,8 +700,6 @@ var gs_kiri_slice = exports;
solids.unioned = unioned;
solids.trimmed = trims;
if (debug) DBUG.log(['project', this.index, polys.length, unioned.length, inner.length]);
// clear old solids and make array for new
tops.forEach(function(top) { top.solids = [] });

View file

@ -436,7 +436,6 @@ var gs_kiri_slicer = exports;
connect = [],
search = 1,
nextMod = 1,
debug = (BASE.debug.get('z-index') === index) && BASE.debug.get('connect'),
bridge = CONF.bridgeLineGapDistance,
p1, p2;
@ -551,7 +550,6 @@ var gs_kiri_slicer = exports;
if (!path.open) closed++; else open++;
});
if (debug) DBUG.log({closed:closed, open:open});
// it gets more complicated with multiple possible output paths
if (closed > 1 && open === 0) {
// add polygon to path (for area sorting)
@ -563,8 +561,6 @@ var gs_kiri_slicer = exports;
// sort descending by length
paths.sort(function(a,b) { return b.poly.length - a.poly.length });
if (debug) DBUG.log({paths:paths});
// emit polygons largest to smallest
// omit polygon if it intersects previously emitted (has del points)
paths.forEach(function(path) {
@ -575,8 +571,6 @@ var gs_kiri_slicer = exports;
emit(path.poly);
emitted++;
});
if (debug) DBUG.log({longest:longest.length, paths:paths.length, closed:closed, emitted:emitted});
} else {
if (longest.open) {
connect.push(longest);

View file

@ -376,8 +376,7 @@ self.kiri.license = exports.LICENSE;
layerSparse: true,
layerFill: true,
layerSupport: true,
layerPrint: false,
layerDebug: false
layerPrint: false
},
synth: {
// set in updateSettingsFromFields()
@ -463,10 +462,7 @@ self.kiri.license = exports.LICENSE;
camTopZ = 0;
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]);
KIRI.api = {
@ -2223,7 +2219,6 @@ self.kiri.license = exports.LICENSE;
layerSparse: UC.newBoolean("sparse fill", onBooleanClick, {modes:FDM}),
layerSupport: UC.newBoolean("support", onBooleanClick, {modes:FDM}),
layerPrint: UC.newBoolean("print", onBooleanClick),
layerDebug: UC.newBoolean("debug", onBooleanClick, {hide:!LOCAL}),
settingsGroup: UC.newGroup("settings", control),
settingsTable: UC.newTableRow([
@ -3299,14 +3294,6 @@ self.kiri.license = exports.LICENSE;
STATS.add('init');
// updateActive(true);
var zdebug = DBUG.get('z-index');
if (zdebug) {
prepareSlices(function() {
UI.layerRange.checked = true;
showSlices(parseInt(zdebug));
});
}
// init gcode sender
KIRI.serial.init();

View file

@ -1,7 +1,7 @@
var exports = {
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.",
VERSION:"1.0.68"
VERSION:"1.0.69"
};
if (!module) var module = {};
module.exports = exports;