mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 11:33:49 +01:00
better names
This commit is contained in:
parent
61437295b9
commit
7a15cd46fb
@ -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);
|
||||
|
10
src/slice.js
10
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
|
||||
});
|
||||
}
|
||||
};
|
@ -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 ++) {
|
||||
|
Loading…
Reference in New Issue
Block a user