mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-04 21:53:25 +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();
|
var geometry = new THREE.Geometry();
|
||||||
|
|
||||||
for (var i = 0; i < path.length; i ++) {
|
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, base + 1, base + 2));
|
||||||
geometry.faces.push(new THREE.Face3(base + 3, base + 2, base + 1));
|
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 material = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: false, side: THREE.DoubleSide});
|
||||||
var mesh = new THREE.Mesh(geometry, material);
|
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 ++) {
|
for (var i = 0; i < this.parts.length; i ++) {
|
||||||
var part = this.parts[i];
|
var part = this.parts[i];
|
||||||
if (part.addFill) {
|
if (part.closed) {
|
||||||
var bounds = part.outerLine.bounds();
|
var bounds = part.outerLine.bounds();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -49,7 +49,7 @@ D3D.Slice.prototype.optimizePaths = function (start) {
|
|||||||
var part = this.parts.splice(closestPart, 1)[0];
|
var part = this.parts.splice(closestPart, 1)[0];
|
||||||
parts.push(part);
|
parts.push(part);
|
||||||
|
|
||||||
if (part.addFill) {
|
if (part.closed) {
|
||||||
if (part.outerLine.length > 0) {
|
if (part.outerLine.length > 0) {
|
||||||
part.outerLine = part.outerLine.optimizePath(start);
|
part.outerLine = part.outerLine.optimizePath(start);
|
||||||
start = part.outerLine.lastPoint();
|
start = part.outerLine.lastPoint();
|
||||||
@ -92,7 +92,7 @@ D3D.Slice.prototype.getOutline = function () {
|
|||||||
for (var i = 0; i < this.parts.length; i ++) {
|
for (var i = 0; i < this.parts.length; i ++) {
|
||||||
var part = this.parts[i];
|
var part = this.parts[i];
|
||||||
|
|
||||||
if (part.addFill) {
|
if (part.closed) {
|
||||||
outLines.join(this.parts[i].outerLine);
|
outLines.join(this.parts[i].outerLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,13 +108,13 @@ D3D.Slice.prototype.add = function (intersect) {
|
|||||||
innerLines: [],
|
innerLines: [],
|
||||||
outerLine: new D3D.Paths([], true),
|
outerLine: new D3D.Paths([], true),
|
||||||
fill: new D3D.Paths([], false),
|
fill: new D3D.Paths([], false),
|
||||||
addFill: true
|
closed: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.parts.push({
|
this.parts.push({
|
||||||
intersect: intersect,
|
intersect: intersect,
|
||||||
addFill: false
|
closed: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -251,7 +251,6 @@ D3D.Slicer.prototype._slice = function (lines, printer) {
|
|||||||
done.push(index);
|
done.push(index);
|
||||||
|
|
||||||
var intersection = intersections[index];
|
var intersection = intersections[index];
|
||||||
console.log(intersection);
|
|
||||||
//uppercase X and Y because clipper vector
|
//uppercase X and Y because clipper vector
|
||||||
shape.unshift({X: intersection.x, Y: intersection.y});
|
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 ++) {
|
for (var i = 0; i < slice.parts.length; i ++) {
|
||||||
var part = slice.parts[i];
|
var part = slice.parts[i];
|
||||||
|
|
||||||
if (part.addFill) {
|
if (part.closed) {
|
||||||
var outerLine = part.intersect.clone().scaleUp(scale).offset(-nozzleRadius);
|
var outerLine = part.intersect.clone().scaleUp(scale).offset(-nozzleRadius);
|
||||||
|
|
||||||
if (outerLine.length > 0) {
|
if (outerLine.length > 0) {
|
||||||
@ -404,7 +403,7 @@ D3D.Slicer.prototype._generateInfills = function (slices, printer) {
|
|||||||
for (var i = 0; i < slice.parts.length; i ++) {
|
for (var i = 0; i < slice.parts.length; i ++) {
|
||||||
var part = slice.parts[i];
|
var part = slice.parts[i];
|
||||||
|
|
||||||
if (part.addFill) {
|
if (part.closed) {
|
||||||
var outerLine = part.outerLine;
|
var outerLine = part.outerLine;
|
||||||
|
|
||||||
if (outerLine.length > 0) {
|
if (outerLine.length > 0) {
|
||||||
@ -537,7 +536,7 @@ D3D.Slicer.prototype._optimizePaths = function (slices, printer) {
|
|||||||
for (var i = 0; i < slice.parts.length; i ++) {
|
for (var i = 0; i < slice.parts.length; i ++) {
|
||||||
var part = slice.parts[i];
|
var part = slice.parts[i];
|
||||||
|
|
||||||
if (part.addFill) {
|
if (part.closed) {
|
||||||
part.outerLine.scaleDown(scale);
|
part.outerLine.scaleDown(scale);
|
||||||
for (var j = 0; j < part.innerLines.length; j ++) {
|
for (var j = 0; j < part.innerLines.length; j ++) {
|
||||||
var innerLine = part.innerLines[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 ++) {
|
for (var i = 0; i < slice.parts.length; i ++) {
|
||||||
var part = slice.parts[i];
|
var part = slice.parts[i];
|
||||||
|
|
||||||
if (part.addFill) {
|
if (part.closed) {
|
||||||
pathToGCode(part.outerLine, false, true, "outerLine");
|
pathToGCode(part.outerLine, false, true, "outerLine");
|
||||||
|
|
||||||
for (var j = 0; j < part.innerLines.length; j ++) {
|
for (var j = 0; j < part.innerLines.length; j ++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user