fixed closing line bug

This commit is contained in:
casperlamboo 2015-07-26 15:24:35 +02:00 committed by Simon Voordouw
parent 7a15cd46fb
commit d30a1ed107
4 changed files with 15 additions and 14 deletions

View File

@ -1,5 +1,5 @@
{ {
"layerHeight": 0.2, "layerHeight": 0.15,
"bottomThickness": 0.4, "bottomThickness": 0.4,
"topThickness": 0.8, "topThickness": 0.8,
"shellThickness": 0.4, "shellThickness": 0.4,
@ -23,11 +23,11 @@
}, },
"innerLine": { "innerLine": {
"flowRate": 1.0, "flowRate": 1.0,
"speed": 50.0 "speed": 60.0
}, },
"fill": { "fill": {
"flowRate": 1.0, "flowRate": 1.0,
"speed": 50.0 "speed": 100.0
}, },
"brim": { "brim": {
"flowRate": 1.0, "flowRate": 1.0,

View File

@ -40,7 +40,7 @@ function init () {
loader.load('models/pokemon/pikachu.stl', function (geometry) { loader.load('models/pokemon/pikachu.stl', function (geometry) {
//var geometry = new THREE.BoxGeometry(10, 10, 10, 1, 1, 1); //var geometry = new THREE.BoxGeometry(10, 10, 10, 1, 1, 1);
//var geometry = new THREE.SphereGeometry(10, 20, 10); //var geometry = new THREE.SphereGeometry(10, 20, 10);
//var geometry = new THREE.TorusGeometry(20, 10, 30, 30); var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
/* /*
var geometry = (function () { var geometry = (function () {
"use strict"; "use strict";
@ -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,12 +82,12 @@ 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);
mesh.rotation.x = -Math.PI/2; //mesh.rotation.x = -Math.PI/2;
//mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; //mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
mesh.position.x = 60; mesh.position.x = 60;
mesh.position.z = 60; mesh.position.z = 60;

View File

@ -198,14 +198,14 @@ D3D.Slicer.prototype._slice = function (lines, printer) {
var connects = lines[index].connects.clone(); var connects = lines[index].connects.clone();
var faceNormals = lines[index].normals.clone(); var faceNormals = lines[index].normals.clone();
if (shape.length > 2 && connects.indexOf(firstPoint) !== -1) { for (var j = 0; j < connects.length; j ++) {
index = connects[j];
if (shape.length > 2 && index === firstPoint) {
closed = true; closed = true;
break; break;
} }
for (var j = 0; j < connects.length; j ++) {
index = connects[j];
if (done.indexOf(index) === -1) { if (done.indexOf(index) === -1) {
if (intersections[index] !== undefined) { if (intersections[index] !== undefined) {
@ -284,7 +284,8 @@ D3D.Slicer.prototype._slice = function (lines, printer) {
} }
} }
var part = new D3D.Paths([shape], closed).clean(0.01); //var part = new D3D.Paths([shape], closed).clean(0.01);
var part = new D3D.Paths([shape], true).clean(0.01);
if (part.length > 0) { if (part.length > 0) {
sliceParts.push(part); sliceParts.push(part);
} }

View File

@ -34,7 +34,7 @@ var Viewport = function ( editor ) {
selectionBox.material.depthTest = false; selectionBox.material.depthTest = false;
selectionBox.material.transparent = true; selectionBox.material.transparent = true;
selectionBox.visible = false; selectionBox.visible = false;
sceneHelpers.add( selectionBox ); sceneHelpers.add(selectionBox);
var transformControls = new THREE.TransformControls( camera, container.dom ); var transformControls = new THREE.TransformControls( camera, container.dom );
transformControls.addEventListener( 'change', function () { transformControls.addEventListener( 'change', function () {