From c7358494f9591076a4093fc0551149557be53666 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 13 Nov 2017 13:00:04 -0500 Subject: [PATCH] remove unused debug code --- js/geo-polygon.js | 12 ------------ js/geo-polygons.js | 3 --- js/kiri-driver-cam.js | 9 --------- js/kiri-slice.js | 17 +++-------------- js/kiri-slicer.js | 6 ------ js/kiri.js | 15 +-------------- js/license.js | 2 +- 7 files changed, 5 insertions(+), 59 deletions(-) diff --git a/js/geo-polygon.js b/js/geo-polygon.js index 1a867590..308fec85 100644 --- a/js/geo-polygon.js +++ b/js/geo-polygon.js @@ -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; diff --git a/js/geo-polygons.js b/js/geo-polygons.js index 1a9dbbd6..ec2c0c1e 100644 --- a/js/geo-polygons.js +++ b/js/geo-polygons.js @@ -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; diff --git a/js/kiri-driver-cam.js b/js/kiri-driver-cam.js index cfba98f2..7ebd92ed 100644 --- a/js/kiri-driver-cam.js +++ b/js/kiri-driver-cam.js @@ -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); } diff --git a/js/kiri-slice.js b/js/kiri-slice.js index 61911a4d..bb15183c 100644 --- a/js/kiri-slice.js +++ b/js/kiri-slice.js @@ -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 = [] }); diff --git a/js/kiri-slicer.js b/js/kiri-slicer.js index 3f4babf4..c9475d1b 100644 --- a/js/kiri-slicer.js +++ b/js/kiri-slicer.js @@ -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); diff --git a/js/kiri.js b/js/kiri.js index 65aa6721..07f0d36e 100644 --- a/js/kiri.js +++ b/js/kiri.js @@ -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(); diff --git a/js/license.js b/js/license.js index 3f13f4dc..a427d209 100644 --- a/js/license.js +++ b/js/license.js @@ -1,7 +1,7 @@ var exports = { COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen - 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;