From 7a15cd46fb44dda1a9f22c4e9a1572d369ed61f4 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Fri, 10 Jul 2015 18:07:21 +0200 Subject: [PATCH] better names --- slice_test.html | 4 ++-- src/slice.js | 10 +++++----- src/slicer.js | 9 ++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/slice_test.html b/slice_test.html index 277651f..42a937c 100644 --- a/slice_test.html +++ b/slice_test.html @@ -67,7 +67,7 @@ function init () { })(); */ - /*var path = [{x: 60, y: 40}, {x: 60, y: 50}, {x: 60, y: 60}, {x: 80, y: 60}, {x: 40, y: 40}, {x: 50, y: 40}, {x: 10, y: 60}]; + var path = [{x: 60, y: 40}, {x: 60, y: 50}, {x: 60, y: 60}, {x: 80, y: 60}, {x: 40, y: 40}, {x: 50, y: 40}, {x: 10, y: 60}]; var geometry = new THREE.Geometry(); for (var i = 0; i < path.length; i ++) { @@ -82,7 +82,7 @@ function init () { geometry.faces.push(new THREE.Face3(base, base + 1, base + 2)); geometry.faces.push(new THREE.Face3(base + 3, base + 2, base + 1)); - }*/ + } var material = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: false, side: THREE.DoubleSide}); var mesh = new THREE.Mesh(geometry, material); diff --git a/src/slice.js b/src/slice.js index f782555..e56a261 100644 --- a/src/slice.js +++ b/src/slice.js @@ -26,7 +26,7 @@ D3D.Slice.prototype.optimizePaths = function (start) { for (var i = 0; i < this.parts.length; i ++) { var part = this.parts[i]; - if (part.addFill) { + if (part.closed) { var bounds = part.outerLine.bounds(); } else { @@ -49,7 +49,7 @@ D3D.Slice.prototype.optimizePaths = function (start) { var part = this.parts.splice(closestPart, 1)[0]; parts.push(part); - if (part.addFill) { + if (part.closed) { if (part.outerLine.length > 0) { part.outerLine = part.outerLine.optimizePath(start); start = part.outerLine.lastPoint(); @@ -92,7 +92,7 @@ D3D.Slice.prototype.getOutline = function () { for (var i = 0; i < this.parts.length; i ++) { var part = this.parts[i]; - if (part.addFill) { + if (part.closed) { outLines.join(this.parts[i].outerLine); } } @@ -108,13 +108,13 @@ D3D.Slice.prototype.add = function (intersect) { innerLines: [], outerLine: new D3D.Paths([], true), fill: new D3D.Paths([], false), - addFill: true + closed: true }); } else { this.parts.push({ intersect: intersect, - addFill: false + closed: false }); } }; \ No newline at end of file diff --git a/src/slicer.js b/src/slicer.js index 03d5cec..1f4c0e6 100644 --- a/src/slicer.js +++ b/src/slicer.js @@ -251,7 +251,6 @@ D3D.Slicer.prototype._slice = function (lines, printer) { done.push(index); var intersection = intersections[index]; - console.log(intersection); //uppercase X and Y because clipper vector shape.unshift({X: intersection.x, Y: intersection.y}); } @@ -345,7 +344,7 @@ D3D.Slicer.prototype._generateInnerLines = function (slices, printer) { for (var i = 0; i < slice.parts.length; i ++) { var part = slice.parts[i]; - if (part.addFill) { + if (part.closed) { var outerLine = part.intersect.clone().scaleUp(scale).offset(-nozzleRadius); if (outerLine.length > 0) { @@ -404,7 +403,7 @@ D3D.Slicer.prototype._generateInfills = function (slices, printer) { for (var i = 0; i < slice.parts.length; i ++) { var part = slice.parts[i]; - if (part.addFill) { + if (part.closed) { var outerLine = part.outerLine; if (outerLine.length > 0) { @@ -537,7 +536,7 @@ D3D.Slicer.prototype._optimizePaths = function (slices, printer) { for (var i = 0; i < slice.parts.length; i ++) { var part = slice.parts[i]; - if (part.addFill) { + if (part.closed) { part.outerLine.scaleDown(scale); for (var j = 0; j < part.innerLines.length; j ++) { var innerLine = part.innerLines[j]; @@ -640,7 +639,7 @@ D3D.Slicer.prototype._slicesToGCode = function (slices, printer) { for (var i = 0; i < slice.parts.length; i ++) { var part = slice.parts[i]; - if (part.addFill) { + if (part.closed) { pathToGCode(part.outerLine, false, true, "outerLine"); for (var j = 0; j < part.innerLines.length; j ++) {