fixed closing line bug

This commit is contained in:
casperlamboo 2015-07-26 15:24:35 +02:00
parent cd71f7a378
commit c541d70157
4 changed files with 15 additions and 14 deletions

View File

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

View File

@ -40,7 +40,7 @@ function init () {
loader.load('models/pokemon/pikachu.stl', function (geometry) {
//var geometry = new THREE.BoxGeometry(10, 10, 10, 1, 1, 1);
//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 () {
"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();
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 + 3, base + 2, base + 1));
}
}*/
var material = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: false, side: THREE.DoubleSide});
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.position.x = 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 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;
break;
}
for (var j = 0; j < connects.length; j ++) {
index = connects[j];
if (done.indexOf(index) === -1) {
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) {
sliceParts.push(part);
}

View File

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