From 67093d047dd6b00fcc37874a3ba25e770884d97b Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Fri, 12 Jun 2015 21:19:56 +0200 Subject: [PATCH] fixed spelling errors --- index.html | 2 +- settings/user_settings.json | 8 +- src/slicer.js | 179 +++++++++--------- src/slicerworker.js | 2 +- .../css/dark.css | 0 .../css/light.css | 0 .../css/main.css | 0 .../examples/arkanoid.app.json | 0 .../examples/camera.app.json | 0 .../examples/particles.app.json | 0 .../examples/pong.app.json | 0 .../index.html | 0 .../js/Config.js | 0 .../js/Editor.js | 0 .../js/Loader.js | 0 .../js/Menubar.Add.js | 0 .../js/Menubar.Edit.js | 0 .../js/Menubar.Examples.js | 0 .../js/Menubar.File.js | 0 .../js/Menubar.Help.js | 0 .../js/Menubar.Play.js | 0 .../js/Menubar.Status.js | 0 .../js/Menubar.View.js | 0 .../js/Menubar.js | 0 .../js/Player.js | 0 .../js/Script.js | 0 .../js/Sidebar.Animation.js | 0 .../js/Sidebar.Geometry.BoxGeometry.js | 0 .../js/Sidebar.Geometry.BufferGeometry.js | 0 .../js/Sidebar.Geometry.CircleGeometry.js | 0 .../js/Sidebar.Geometry.CylinderGeometry.js | 0 .../js/Sidebar.Geometry.Geometry.js | 0 .../Sidebar.Geometry.IcosahedronGeometry.js | 0 .../js/Sidebar.Geometry.Modifiers.js | 13 ++ .../js/Sidebar.Geometry.PlaneGeometry.js | 0 .../js/Sidebar.Geometry.SphereGeometry.js | 0 .../js/Sidebar.Geometry.TorusGeometry.js | 0 .../js/Sidebar.Geometry.TorusKnotGeometry.js | 0 .../js/Sidebar.Geometry.js | 0 .../js/Sidebar.Material.js | 0 .../js/Sidebar.Object3D.js | 0 .../js/Sidebar.Project.js | 0 .../js/Sidebar.Scene.js | 0 .../js/Sidebar.Script.js | 0 .../js/Sidebar.Slicer.js | 1 - .../js/Sidebar.js | 0 .../js/Storage.js | 0 .../js/Toolbar.js | 0 .../js/Viewport.Info.js | 0 .../js/Viewport.js | 0 .../js/libs/app.js | 0 .../js/libs/codemirror/codemirror.css | 0 .../js/libs/codemirror/codemirror.js | 0 .../js/libs/codemirror/mode/javascript.js | 0 .../js/libs/codemirror/theme/monokai.css | 0 .../js/libs/esprima.js | 0 .../js/libs/jszip.min.js | 0 .../js/libs/signals.min.js | 0 .../js/libs/sortable.min.js | 0 .../js/libs/ui.js | 0 .../js/libs/ui.three.js | 0 webworker_test.html | 4 +- 62 files changed, 114 insertions(+), 95 deletions(-) rename three.js-master/{editor_viewer => editor_slicer}/css/dark.css (100%) rename three.js-master/{editor_viewer => editor_slicer}/css/light.css (100%) rename three.js-master/{editor_viewer => editor_slicer}/css/main.css (100%) rename three.js-master/{editor_viewer => editor_slicer}/examples/arkanoid.app.json (100%) rename three.js-master/{editor_viewer => editor_slicer}/examples/camera.app.json (100%) rename three.js-master/{editor_viewer => editor_slicer}/examples/particles.app.json (100%) rename three.js-master/{editor_viewer => editor_slicer}/examples/pong.app.json (100%) rename three.js-master/{editor_viewer => editor_slicer}/index.html (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Config.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Editor.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Loader.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Menubar.Add.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Menubar.Edit.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Menubar.Examples.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Menubar.File.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Menubar.Help.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Menubar.Play.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Menubar.Status.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Menubar.View.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Menubar.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Player.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Script.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Animation.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.BoxGeometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.BufferGeometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.CircleGeometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.CylinderGeometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.Geometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.IcosahedronGeometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.Modifiers.js (86%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.PlaneGeometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.SphereGeometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.TorusGeometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.TorusKnotGeometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Geometry.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Material.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Object3D.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Project.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Scene.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Script.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.Slicer.js (99%) rename three.js-master/{editor_viewer => editor_slicer}/js/Sidebar.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Storage.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Toolbar.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Viewport.Info.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/Viewport.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/app.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/codemirror/codemirror.css (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/codemirror/codemirror.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/codemirror/mode/javascript.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/codemirror/theme/monokai.css (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/esprima.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/jszip.min.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/signals.min.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/sortable.min.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/ui.js (100%) rename three.js-master/{editor_viewer => editor_slicer}/js/libs/ui.three.js (100%) diff --git a/index.html b/index.html index eb1e49d..43d2290 100644 --- a/index.html +++ b/index.html @@ -31,7 +31,7 @@ $(document).ready(function () { var slice = $(""); var webworker = $(""); - var editor = $(""); + var editor = $(""); listSliceTest.append(slice); listSliceWebworker.append(webworker); diff --git a/settings/user_settings.json b/settings/user_settings.json index 04e7ce1..fbe6e11 100644 --- a/settings/user_settings.json +++ b/settings/user_settings.json @@ -4,16 +4,16 @@ "topThickness": 0.8, "shellThickness": 0.4, "brimOffset": 5.0, - "fillGritSize": 5.0, + "fillGridSize": 5.0, "travelSpeed": 200.0, "retractionAmount": 3.0, "retractionEnabled": true, "retractionSpeed": 50.0, "retractionMinDistance": 0.0, - "supportAccaptanceMargin": 1.5, - "supportDistanceY": 0.4, + "supportAcceptanceMargin": 1.5, + "supportDistanceY": 0.2, "supportUse": true, - "supportGritSize": 6.0, + "supportGridSize": 6.0, "supportMargin": 2.0, "supportPlateSize": 4.0, "outerLine": { diff --git a/src/slicer.js b/src/slicer.js index 9842323..8d86dfe 100644 --- a/src/slicer.js +++ b/src/slicer.js @@ -134,106 +134,109 @@ D3D.Slicer.prototype.slice = function (layerHeight, height) { for (var layer = 0; layer < layersIntersections.length; layer ++) { var layerIntersections = layersIntersections[layer]; - var y = layer * layerHeight; + if (layerIntersections.length > 0) { - var intersections = []; - for (var i = 0; i < layerIntersections.length; i ++) { - var index = layerIntersections[i]; - var line = this.lines[index].line; + var y = layer * layerHeight; + + var intersections = []; + for (var i = 0; i < layerIntersections.length; i ++) { + var index = layerIntersections[i]; + var line = this.lines[index].line; + + if (line.start.y === line.end.y) { + var x = line.start.x; + var z = line.start.z; + } + else { + var alpha = (y - line.start.y) / (line.end.y - line.start.y); + var x = line.end.x * alpha + line.start.x * (1 - alpha); + var z = line.end.z * alpha + line.start.z * (1 - alpha); + } + intersections[index] = new THREE.Vector2(z, x); - if (line.start.y === line.end.y) { - var x = line.start.x; - var z = line.start.z; } - else { - var alpha = (y - line.start.y) / (line.end.y - line.start.y); - var x = line.end.x * alpha + line.start.x * (1 - alpha); - var z = line.end.z * alpha + line.start.z * (1 - alpha); - } - intersections[index] = new THREE.Vector2(z, x); - } + var done = []; + var sliceParts = []; + for (var i = 0; i < layerIntersections.length; i ++) { + var index = layerIntersections[i]; - var done = []; - var sliceParts = []; - for (var i = 0; i < layerIntersections.length; i ++) { - var index = layerIntersections[i]; + if (done.indexOf(index) === -1) { + var shape = []; - if (done.indexOf(index) === -1) { - var shape = []; + while (index !== -1) { + var intersection = intersections[index]; + shape.push({X: intersection.x, Y: intersection.y}); - while (index !== -1) { - var intersection = intersections[index]; - shape.push({X: intersection.x, Y: intersection.y}); + var connects = this.lines[index].connects; + var faceNormals = this.lines[index].normals; + for (var j = 0; j < connects.length; j ++) { + index = connects[j]; - var connects = this.lines[index].connects; - var faceNormals = this.lines[index].normals; - for (var j = 0; j < connects.length; j ++) { - index = connects[j]; + if (intersections[index] !== undefined && done.indexOf(index) === -1) { + done.push(index); - if (intersections[index] !== undefined && done.indexOf(index) === -1) { - done.push(index); + var a = new THREE.Vector2(intersection.x, intersection.y); + var b = intersections[index]; - var a = new THREE.Vector2(intersection.x, intersection.y); - var b = intersections[index]; + var faceNormal = faceNormals[Math.floor(j/2)]; - var faceNormal = faceNormals[Math.floor(j/2)]; - - if (a.distanceTo(b) === 0 || faceNormal.equals(new THREE.Vector2(0, 0))) { - connects = connects.concat(this.lines[index].connects); - faceNormals = faceNormals.concat(this.lines[index].normals); - index = -1; - } - else { - var normal = a.sub(b).normal().normalize(); - - if (normal.dot(faceNormal) >= 0) { - //if (true) { - break; - } - else { + if (a.distanceTo(b) === 0 || faceNormal.equals(new THREE.Vector2(0, 0))) { + connects = connects.concat(this.lines[index].connects); + faceNormals = faceNormals.concat(this.lines[index].normals); index = -1; } + else { + var normal = a.sub(b).normal().normalize(); + + if (normal.dot(faceNormal) >= 0) { + //if (true) { + break; + } + else { + index = -1; + } + } + } + else { + index = -1; } } - else { - index = -1; - } + } + + //think this check is not nescesary, always higher as 0 + if (shape.length > 1) { + var part = new D3D.Paths([shape]).clean(0.01); + sliceParts.push(part); } } + } - //think this check is not nescesary, always higher as 0 - if (shape.length > 0) { - var part = new D3D.Paths([shape]).clean(0.01); - sliceParts.push(part); + var slice = new D3D.Slice(); + + for (var i = 0; i < sliceParts.length; i ++) { + var slicePart1 = sliceParts[i]; + var merge = false; + + for (var j = 0; j < slice.parts.length; j ++) { + var slicePart2 = slice.parts[j].intersect; + + if (slicePart2.intersect(slicePart1).length > 0) { + slicePart2.join(slicePart1); + merge = true; + break; + } + } + if (!merge) { + slice.addIntersect(slicePart1); } } + + slices.push(slice); + + this.progress.sliceLayer = layer; + this.updateProgress(); } - - var slice = new D3D.Slice(); - - for (var i = 0; i < sliceParts.length; i ++) { - var slicePart1 = sliceParts[i]; - var merge = false; - - for (var j = 0; j < slice.parts.length; j ++) { - var slicePart2 = slice.parts[j].intersect; - - if (slicePart2.intersect(slicePart1).length > 0) { - slicePart2.join(slicePart1); - merge = true; - break; - } - } - if (!merge) { - slice.addIntersect(slicePart1); - } - } - - slices.push(slice); - - this.progress.sliceLayer = layer; - this.updateProgress(); } return slices; }; @@ -245,13 +248,13 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) { var layerHeight = printer.config["layerHeight"]; var nozzleDiameter = printer.config["nozzleDiameter"] * scale; var shellThickness = printer.config["shellThickness"] * scale; - var fillGritSize = printer.config["fillGritSize"] * scale; + var fillGridSize = printer.config["fillGridSize"] * scale; var brimOffset = printer.config["brimOffset"] * scale; var bottomThickness = printer.config["bottomThickness"]; var topThickness = printer.config["topThickness"]; var useSupport = printer.config["supportUse"]; - var supportGritSize = printer.config["supportGritSize"] * scale; - var supportAccaptanceMargin = printer.config["supportAccaptanceMargin"] * scale; + var supportGridSize = printer.config["supportGridSize"] * scale; + var supportAcceptanceMargin = printer.config["supportAcceptanceMargin"] * scale; var supportMargin = printer.config["supportMargin"] * scale; var plateSize = printer.config["supportPlateSize"] * scale; var supportDistanceY = printer.config["supportDistanceY"]; @@ -266,12 +269,16 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) { top: this.geometry.boundingBox.min.x * scale, right: this.geometry.boundingBox.max.z * scale, bottom: this.geometry.boundingBox.max.x * scale - }, fillGritSize, true, true); + }, fillGridSize, true, true); console.log("generating outer lines and inner lines"); for (var layer = 0; layer < slices.length; layer ++) { var slice = slices[layer]; + if (layer === 0) { + console.log(slice.parts[0]); + } + for (var i = 0; i < slice.parts.length; i ++) { var part = slice.parts[i]; @@ -340,7 +347,7 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) { top: this.geometry.boundingBox.min.x * scale, right: this.geometry.boundingBox.max.z * scale, bottom: this.geometry.boundingBox.max.x * scale - }, supportGritSize, true, true); + }, supportGridSize, true, true); var supportAreas = new D3D.Paths([], true); @@ -375,7 +382,7 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) { var slicePart = slice.parts[i]; var outerLine = slicePart.outerLine; - var overlap = supportSkin.offset(supportAccaptanceMargin).intersect(outerLine); + var overlap = supportSkin.offset(supportAcceptanceMargin).intersect(outerLine); var overhang = outerLine.difference(overlap); if (overlap.length === 0 || overhang.length > 0) { @@ -384,7 +391,7 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) { //supportAreas = supportAreas.union(overhang); - supportAreas = supportAreas.union(overhang.offset(supportAccaptanceMargin).intersect(outerLine)); + supportAreas = supportAreas.union(overhang.offset(supportAcceptanceMargin).intersect(outerLine)); } } } diff --git a/src/slicerworker.js b/src/slicerworker.js index 66c5504..78efc1c 100644 --- a/src/slicerworker.js +++ b/src/slicerworker.js @@ -1,7 +1,7 @@ D3D.SlicerWorker = function () { 'use strict'; - this.worker = new Worker('../../webworker/worker.js'); + this.worker = new Worker(window.location.origin + '/webworker/worker.js'); var scope = this; this.worker.addEventListener('message', function (event) { diff --git a/three.js-master/editor_viewer/css/dark.css b/three.js-master/editor_slicer/css/dark.css similarity index 100% rename from three.js-master/editor_viewer/css/dark.css rename to three.js-master/editor_slicer/css/dark.css diff --git a/three.js-master/editor_viewer/css/light.css b/three.js-master/editor_slicer/css/light.css similarity index 100% rename from three.js-master/editor_viewer/css/light.css rename to three.js-master/editor_slicer/css/light.css diff --git a/three.js-master/editor_viewer/css/main.css b/three.js-master/editor_slicer/css/main.css similarity index 100% rename from three.js-master/editor_viewer/css/main.css rename to three.js-master/editor_slicer/css/main.css diff --git a/three.js-master/editor_viewer/examples/arkanoid.app.json b/three.js-master/editor_slicer/examples/arkanoid.app.json similarity index 100% rename from three.js-master/editor_viewer/examples/arkanoid.app.json rename to three.js-master/editor_slicer/examples/arkanoid.app.json diff --git a/three.js-master/editor_viewer/examples/camera.app.json b/three.js-master/editor_slicer/examples/camera.app.json similarity index 100% rename from three.js-master/editor_viewer/examples/camera.app.json rename to three.js-master/editor_slicer/examples/camera.app.json diff --git a/three.js-master/editor_viewer/examples/particles.app.json b/three.js-master/editor_slicer/examples/particles.app.json similarity index 100% rename from three.js-master/editor_viewer/examples/particles.app.json rename to three.js-master/editor_slicer/examples/particles.app.json diff --git a/three.js-master/editor_viewer/examples/pong.app.json b/three.js-master/editor_slicer/examples/pong.app.json similarity index 100% rename from three.js-master/editor_viewer/examples/pong.app.json rename to three.js-master/editor_slicer/examples/pong.app.json diff --git a/three.js-master/editor_viewer/index.html b/three.js-master/editor_slicer/index.html similarity index 100% rename from three.js-master/editor_viewer/index.html rename to three.js-master/editor_slicer/index.html diff --git a/three.js-master/editor_viewer/js/Config.js b/three.js-master/editor_slicer/js/Config.js similarity index 100% rename from three.js-master/editor_viewer/js/Config.js rename to three.js-master/editor_slicer/js/Config.js diff --git a/three.js-master/editor_viewer/js/Editor.js b/three.js-master/editor_slicer/js/Editor.js similarity index 100% rename from three.js-master/editor_viewer/js/Editor.js rename to three.js-master/editor_slicer/js/Editor.js diff --git a/three.js-master/editor_viewer/js/Loader.js b/three.js-master/editor_slicer/js/Loader.js similarity index 100% rename from three.js-master/editor_viewer/js/Loader.js rename to three.js-master/editor_slicer/js/Loader.js diff --git a/three.js-master/editor_viewer/js/Menubar.Add.js b/three.js-master/editor_slicer/js/Menubar.Add.js similarity index 100% rename from three.js-master/editor_viewer/js/Menubar.Add.js rename to three.js-master/editor_slicer/js/Menubar.Add.js diff --git a/three.js-master/editor_viewer/js/Menubar.Edit.js b/three.js-master/editor_slicer/js/Menubar.Edit.js similarity index 100% rename from three.js-master/editor_viewer/js/Menubar.Edit.js rename to three.js-master/editor_slicer/js/Menubar.Edit.js diff --git a/three.js-master/editor_viewer/js/Menubar.Examples.js b/three.js-master/editor_slicer/js/Menubar.Examples.js similarity index 100% rename from three.js-master/editor_viewer/js/Menubar.Examples.js rename to three.js-master/editor_slicer/js/Menubar.Examples.js diff --git a/three.js-master/editor_viewer/js/Menubar.File.js b/three.js-master/editor_slicer/js/Menubar.File.js similarity index 100% rename from three.js-master/editor_viewer/js/Menubar.File.js rename to three.js-master/editor_slicer/js/Menubar.File.js diff --git a/three.js-master/editor_viewer/js/Menubar.Help.js b/three.js-master/editor_slicer/js/Menubar.Help.js similarity index 100% rename from three.js-master/editor_viewer/js/Menubar.Help.js rename to three.js-master/editor_slicer/js/Menubar.Help.js diff --git a/three.js-master/editor_viewer/js/Menubar.Play.js b/three.js-master/editor_slicer/js/Menubar.Play.js similarity index 100% rename from three.js-master/editor_viewer/js/Menubar.Play.js rename to three.js-master/editor_slicer/js/Menubar.Play.js diff --git a/three.js-master/editor_viewer/js/Menubar.Status.js b/three.js-master/editor_slicer/js/Menubar.Status.js similarity index 100% rename from three.js-master/editor_viewer/js/Menubar.Status.js rename to three.js-master/editor_slicer/js/Menubar.Status.js diff --git a/three.js-master/editor_viewer/js/Menubar.View.js b/three.js-master/editor_slicer/js/Menubar.View.js similarity index 100% rename from three.js-master/editor_viewer/js/Menubar.View.js rename to three.js-master/editor_slicer/js/Menubar.View.js diff --git a/three.js-master/editor_viewer/js/Menubar.js b/three.js-master/editor_slicer/js/Menubar.js similarity index 100% rename from three.js-master/editor_viewer/js/Menubar.js rename to three.js-master/editor_slicer/js/Menubar.js diff --git a/three.js-master/editor_viewer/js/Player.js b/three.js-master/editor_slicer/js/Player.js similarity index 100% rename from three.js-master/editor_viewer/js/Player.js rename to three.js-master/editor_slicer/js/Player.js diff --git a/three.js-master/editor_viewer/js/Script.js b/three.js-master/editor_slicer/js/Script.js similarity index 100% rename from three.js-master/editor_viewer/js/Script.js rename to three.js-master/editor_slicer/js/Script.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Animation.js b/three.js-master/editor_slicer/js/Sidebar.Animation.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Animation.js rename to three.js-master/editor_slicer/js/Sidebar.Animation.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.BoxGeometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.BoxGeometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.BoxGeometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.BoxGeometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.BufferGeometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.BufferGeometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.BufferGeometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.BufferGeometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.CircleGeometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.CircleGeometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.CircleGeometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.CircleGeometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.CylinderGeometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.CylinderGeometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.CylinderGeometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.CylinderGeometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.Geometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.Geometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.Geometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.Geometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.IcosahedronGeometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.IcosahedronGeometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.IcosahedronGeometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.IcosahedronGeometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.Modifiers.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.Modifiers.js similarity index 86% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.Modifiers.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.Modifiers.js index 780b32a..f6ceace 100755 --- a/three.js-master/editor_viewer/js/Sidebar.Geometry.Modifiers.js +++ b/three.js-master/editor_slicer/js/Sidebar.Geometry.Modifiers.js @@ -65,6 +65,19 @@ Sidebar.Geometry.Modifiers = function ( signals, object ) { } + var button = new UI.Button( 'Snap to grid' ); + button.onClick( function () { + + geometry.computeBoundingBox(); + + object.position.y = -geometry.boundingBox.min.y; + + object.updateMatrix(); + + } ); + + container.add( button ); + // return container; diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.PlaneGeometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.PlaneGeometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.PlaneGeometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.PlaneGeometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.SphereGeometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.SphereGeometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.SphereGeometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.SphereGeometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.TorusGeometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.TorusGeometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.TorusGeometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.TorusGeometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.TorusKnotGeometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.TorusKnotGeometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.TorusKnotGeometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.TorusKnotGeometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Geometry.js b/three.js-master/editor_slicer/js/Sidebar.Geometry.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Geometry.js rename to three.js-master/editor_slicer/js/Sidebar.Geometry.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Material.js b/three.js-master/editor_slicer/js/Sidebar.Material.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Material.js rename to three.js-master/editor_slicer/js/Sidebar.Material.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Object3D.js b/three.js-master/editor_slicer/js/Sidebar.Object3D.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Object3D.js rename to three.js-master/editor_slicer/js/Sidebar.Object3D.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Project.js b/three.js-master/editor_slicer/js/Sidebar.Project.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Project.js rename to three.js-master/editor_slicer/js/Sidebar.Project.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Scene.js b/three.js-master/editor_slicer/js/Sidebar.Scene.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Scene.js rename to three.js-master/editor_slicer/js/Sidebar.Scene.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Script.js b/three.js-master/editor_slicer/js/Sidebar.Script.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.Script.js rename to three.js-master/editor_slicer/js/Sidebar.Script.js diff --git a/three.js-master/editor_viewer/js/Sidebar.Slicer.js b/three.js-master/editor_slicer/js/Sidebar.Slicer.js similarity index 99% rename from three.js-master/editor_viewer/js/Sidebar.Slicer.js rename to three.js-master/editor_slicer/js/Sidebar.Slicer.js index a1a18b2..5291fb5 100644 --- a/three.js-master/editor_viewer/js/Sidebar.Slicer.js +++ b/three.js-master/editor_slicer/js/Sidebar.Slicer.js @@ -125,7 +125,6 @@ Sidebar.Slicer = function ( editor ) { var slicer = new D3D.SlicerWorker(); slicer.onprogress = function (_progress) { - console.log(_progress); progress.setValue(Math.round(_progress.procent * 100) + "%"); }; slicer.onfinish = function (gcode) { diff --git a/three.js-master/editor_viewer/js/Sidebar.js b/three.js-master/editor_slicer/js/Sidebar.js similarity index 100% rename from three.js-master/editor_viewer/js/Sidebar.js rename to three.js-master/editor_slicer/js/Sidebar.js diff --git a/three.js-master/editor_viewer/js/Storage.js b/three.js-master/editor_slicer/js/Storage.js similarity index 100% rename from three.js-master/editor_viewer/js/Storage.js rename to three.js-master/editor_slicer/js/Storage.js diff --git a/three.js-master/editor_viewer/js/Toolbar.js b/three.js-master/editor_slicer/js/Toolbar.js similarity index 100% rename from three.js-master/editor_viewer/js/Toolbar.js rename to three.js-master/editor_slicer/js/Toolbar.js diff --git a/three.js-master/editor_viewer/js/Viewport.Info.js b/three.js-master/editor_slicer/js/Viewport.Info.js similarity index 100% rename from three.js-master/editor_viewer/js/Viewport.Info.js rename to three.js-master/editor_slicer/js/Viewport.Info.js diff --git a/three.js-master/editor_viewer/js/Viewport.js b/three.js-master/editor_slicer/js/Viewport.js similarity index 100% rename from three.js-master/editor_viewer/js/Viewport.js rename to three.js-master/editor_slicer/js/Viewport.js diff --git a/three.js-master/editor_viewer/js/libs/app.js b/three.js-master/editor_slicer/js/libs/app.js similarity index 100% rename from three.js-master/editor_viewer/js/libs/app.js rename to three.js-master/editor_slicer/js/libs/app.js diff --git a/three.js-master/editor_viewer/js/libs/codemirror/codemirror.css b/three.js-master/editor_slicer/js/libs/codemirror/codemirror.css similarity index 100% rename from three.js-master/editor_viewer/js/libs/codemirror/codemirror.css rename to three.js-master/editor_slicer/js/libs/codemirror/codemirror.css diff --git a/three.js-master/editor_viewer/js/libs/codemirror/codemirror.js b/three.js-master/editor_slicer/js/libs/codemirror/codemirror.js similarity index 100% rename from three.js-master/editor_viewer/js/libs/codemirror/codemirror.js rename to three.js-master/editor_slicer/js/libs/codemirror/codemirror.js diff --git a/three.js-master/editor_viewer/js/libs/codemirror/mode/javascript.js b/three.js-master/editor_slicer/js/libs/codemirror/mode/javascript.js similarity index 100% rename from three.js-master/editor_viewer/js/libs/codemirror/mode/javascript.js rename to three.js-master/editor_slicer/js/libs/codemirror/mode/javascript.js diff --git a/three.js-master/editor_viewer/js/libs/codemirror/theme/monokai.css b/three.js-master/editor_slicer/js/libs/codemirror/theme/monokai.css similarity index 100% rename from three.js-master/editor_viewer/js/libs/codemirror/theme/monokai.css rename to three.js-master/editor_slicer/js/libs/codemirror/theme/monokai.css diff --git a/three.js-master/editor_viewer/js/libs/esprima.js b/three.js-master/editor_slicer/js/libs/esprima.js similarity index 100% rename from three.js-master/editor_viewer/js/libs/esprima.js rename to three.js-master/editor_slicer/js/libs/esprima.js diff --git a/three.js-master/editor_viewer/js/libs/jszip.min.js b/three.js-master/editor_slicer/js/libs/jszip.min.js similarity index 100% rename from three.js-master/editor_viewer/js/libs/jszip.min.js rename to three.js-master/editor_slicer/js/libs/jszip.min.js diff --git a/three.js-master/editor_viewer/js/libs/signals.min.js b/three.js-master/editor_slicer/js/libs/signals.min.js similarity index 100% rename from three.js-master/editor_viewer/js/libs/signals.min.js rename to three.js-master/editor_slicer/js/libs/signals.min.js diff --git a/three.js-master/editor_viewer/js/libs/sortable.min.js b/three.js-master/editor_slicer/js/libs/sortable.min.js similarity index 100% rename from three.js-master/editor_viewer/js/libs/sortable.min.js rename to three.js-master/editor_slicer/js/libs/sortable.min.js diff --git a/three.js-master/editor_viewer/js/libs/ui.js b/three.js-master/editor_slicer/js/libs/ui.js similarity index 100% rename from three.js-master/editor_viewer/js/libs/ui.js rename to three.js-master/editor_slicer/js/libs/ui.js diff --git a/three.js-master/editor_viewer/js/libs/ui.three.js b/three.js-master/editor_slicer/js/libs/ui.three.js similarity index 100% rename from three.js-master/editor_viewer/js/libs/ui.three.js rename to three.js-master/editor_slicer/js/libs/ui.three.js diff --git a/webworker_test.html b/webworker_test.html index 36eafef..d954470 100644 --- a/webworker_test.html +++ b/webworker_test.html @@ -99,8 +99,8 @@ function init () { var mesh = new THREE.Mesh(geometry, material); mesh.rotation.x = -Math.PI/2; - mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.5; - mesh.position.y = -0.1; + mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; + //mesh.position.y = -0.1; mesh.position.x = 60; mesh.position.z = 60;