diff --git a/js/cells/supercells/CompositeCell.js b/js/cells/supercells/CompositeCell.js index f90d0a6b162efba58ab6eb001696640475fc9b90..c260f68386c7ce7ab258d96646fcc96108b408c4 100644 --- a/js/cells/supercells/CompositeCell.js +++ b/js/cells/supercells/CompositeCell.js @@ -19,9 +19,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', }; CompositeCell.prototype._rotateCell = function(object3D){ - if (lattice.get("connectionType") == "gik") { - if (this.index.z %2 != 0) return object3D.rotateZ(Math.PI/2); - return object3D; + if (lattice._zIndexRotation) { + return object3D.rotateZ(lattice._zIndexRotation(this.index)); } return DMASuperCell.prototype._rotateCell.call(this, object3D); }; diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js index 373ca701ad7129908f5882668e7a0a15cd5364fa..6161eeffe41fc71a5e5ef713014294c84b81718a 100644 --- a/js/cells/supercells/GIKSuperCell.js +++ b/js/cells/supercells/GIKSuperCell.js @@ -35,7 +35,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', GIKSuperCell.prototype._rotateCell = function(object3D){ if (!this.index) return object3D; - if (this.index.z%2 != 0) object3D.rotateZ(Math.PI/2); + object3D.rotateZ(lattice._zIndexRotation(this.index)); return object3D; }; diff --git a/js/highlighter/SuperCellHighlighter.js b/js/highlighter/SuperCellHighlighter.js index 06bb48a7d192aa60e017b17c7ade6bf02dd66f47..fc5f2b3485c81347322469634eb3f605990b08fe 100644 --- a/js/highlighter/SuperCellHighlighter.js +++ b/js/highlighter/SuperCellHighlighter.js @@ -39,13 +39,12 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' _setRotation: function(direction){ - if (lattice.get("connectionType") == "gik"){ + if (lattice._zIndexRotation){ if (!this.highlightedObject) return; var index = this.highlightedObject.getAbsoluteIndex(); - - if ((index.z%2 == 0 && Math.abs(direction.z) > 0.9) || (index.z%2 != 0 && Math.abs(direction.z) < 0.1)) - this.mesh.rotation.set(0, 0, Math.PI/2); - else this.mesh.rotation.set(0,0,0); + if (Math.abs(direction.z) > 0.9) index.z+=1; + else if (Math.abs(direction.z) < 0.1) index.z -=1; + this.mesh.rotation.set(0,0, lattice._zIndexRotation(index)); } var superCellIndex = appState.get("superCellIndex"); diff --git a/js/lattice/latticeSubclasses/GIKLattice.js b/js/lattice/latticeSubclasses/GIKLattice.js index 0b7250b0444e8c7bd9d0bf13cdff57bf49089689..639a42cf156e68d556b323a2e948d891114d2901 100644 --- a/js/lattice/latticeSubclasses/GIKLattice.js +++ b/js/lattice/latticeSubclasses/GIKLattice.js @@ -43,6 +43,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre return 1.28*(1+2*cellSeparation); }, + _zIndexRotation: function(index){ + if (index.z%2 != 0) return Math.PI/2; + return 0; + }, + getCellSubclassFile: function(){ return "gikSuperCell"; }, diff --git a/js/plists/CamPList.js b/js/plists/CamPList.js index b4074cec2317f3c431104ba6831bcd5c99bdd048..fa1a63aab50cf2f1923fb444f24f997972e025db 100644 --- a/js/plists/CamPList.js +++ b/js/plists/CamPList.js @@ -35,37 +35,34 @@ define(['three'], function(THREE){ camProcesses: ["gcode"], numMaterials: 2, translation: {x:-4.0757,y: -4.3432,z: -6.2154}, - rotation: {x:Math.PI/2,y:0,z:0}, + rotation: {x:Math.PI/2,y:0,z:0},//Math.PI/2 scale: 20, components: { xAxis: { - name: "X Axis", + name: "Y Axis", rotary: false, axisOfMotion: null, //minBound //maxBound parent: "yAxis", - motionVector: {x:1, y:0, z:0}, + motionVector: {x:0, y:1, z:0}, stl: { - filename: "assets/stls/stapler/xAxis.stl", - offset: {x:0,y:0,z:0}, - scale: 1.0, - rotation: {x:0,y:0,z:0} + filename: "assets/stls/stapler/xAxis.stl" +// offset: {x:0,y:0,z:0}, +// scale: 1.0, +// rotation: {x:0,y:0,z:0} } }, frame: { - name: "Y Axis", + name: "X Axis", rotary: false, axisOfMotion: null, //minBound //maxBound parent: "substrate", - motionVector: {x:0, y:1, z:0}, + motionVector: {x:1, y:0, z:0}, stl: { - filename: "assets/stls/stapler/yAxis.stl", - offset: {x:0,y:0,z:0}, - scale: 1.0, - rotation: {x:0,y:0,z:0} + filename: "assets/stls/stapler/yAxis.stl" } }, zAxis: { @@ -77,10 +74,7 @@ define(['three'], function(THREE){ parent: "xAxis", motionVector: {x:0, y:0, z:1}, stl: { - filename: "assets/stls/stapler/zAxis.stl", - offset: {x:0,y:0,z:0}, - scale: 1.0, - rotation: {x:0,y:0,z:0} + filename: "assets/stls/stapler/zAxis.stl" } }, yAxis: { @@ -92,26 +86,20 @@ define(['three'], function(THREE){ parent: "frame", isStatic: true, stl: { - filename: "assets/stls/stapler/frame.stl", - offset: {x:0,y:0,z:0}, - scale: 1.0, - rotation: {x:0,y:0,z:0} + filename: "assets/stls/stapler/frame.stl" } }, substrate: { name: "Substrate", rotary: true, axisOfMotion: null, - centerOfRotation: {x:10,y:10,z:0}, + centerOfRotation: {x:10,y:10,z:0},//(5.08mm, 5.715mm) //minBound //maxBound parent: null, motionVector: {x:0, y:0, z:1}, stl: { - filename: "assets/stls/stapler/substrate.stl", - offset: {x:0,y:0,z:0}, - scale: 1.0, - rotation: {x:0,y:0,z:0} + filename: "assets/stls/stapler/substrate.stl" } } },