From 1ce7abbb0fe9180e74ed95311cc8b133416d329d Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 18 Aug 2015 15:57:54 -0400 Subject: [PATCH] stock offset, gik rotation --- js/cam/assemblers/Assembler.js | 3 ++- js/cam/assemblers/StockComponent.js | 4 ++-- js/highlighter/SuperCellHighlighter.js | 1 + js/lattice/latticeSubclasses/GIKLattice.js | 2 +- js/plists/CamPList.js | 6 ++++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js index 7e78d7cc..385d8a20 100644 --- a/js/cam/assemblers/Assembler.js +++ b/js/cam/assemblers/Assembler.js @@ -71,7 +71,8 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' } if (json.scale) geometry.applyMatrix(new THREE.Matrix4().makeScale(json.scale, json.scale, json.scale)); - geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-21, -0.63, 0)); + geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-21, -0.63, 0));//todo get rid of these + geometry.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI/2)); return geometry; } diff --git a/js/cam/assemblers/StockComponent.js b/js/cam/assemblers/StockComponent.js index 6ae114be..b258bc18 100644 --- a/js/cam/assemblers/StockComponent.js +++ b/js/cam/assemblers/StockComponent.js @@ -30,8 +30,8 @@ define(['underscore', 'cam', 'three', 'component', 'lattice', 'threeModel'], StockComponent.prototype._setPosition = function(cell, position, rotation){ var object3D = cell.getObject3D();//todo need this? - object3D.position.set(position.x, position.y, position.z); - //todo rotation + if (position) object3D.position.set(position.x, position.y, position.z); + if (rotation) object3D.rotation.set(rotation.x, rotation.y, rotation.z); }; StockComponent.prototype.getPosition = function(){ diff --git a/js/highlighter/SuperCellHighlighter.js b/js/highlighter/SuperCellHighlighter.js index c14bc712..14d6bec7 100644 --- a/js/highlighter/SuperCellHighlighter.js +++ b/js/highlighter/SuperCellHighlighter.js @@ -69,6 +69,7 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' var offset = appState.get("superCellIndex").clone(); offset.applyQuaternion(this.mesh.quaternion).round(); newIndex.sub(offset); + console.log(newIndex.clone()); return newIndex; } }); diff --git a/js/lattice/latticeSubclasses/GIKLattice.js b/js/lattice/latticeSubclasses/GIKLattice.js index e677c707..4ad1b24d 100644 --- a/js/lattice/latticeSubclasses/GIKLattice.js +++ b/js/lattice/latticeSubclasses/GIKLattice.js @@ -49,7 +49,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre }, _zIndexRotationSuperCell: function(index){ - if (index.z%2 != 0) return Math.PI/2; + if (index.z%2 != 0) return Math.PI/2;//this never changes return 0; }, diff --git a/js/plists/CamPList.js b/js/plists/CamPList.js index fa1a63aa..06369459 100644 --- a/js/plists/CamPList.js +++ b/js/plists/CamPList.js @@ -111,7 +111,8 @@ define(['three'], function(THREE){ }, name: "Stock 1", parent: "zAxis", - position: {x:0,y:0,z:0} + position: {x:0,y:0,z:0}, + rotation: {x:0, y:0, z:Math.PI/2} }, stock2: { description:{ @@ -120,7 +121,8 @@ define(['three'], function(THREE){ }, name: "Stock 2", parent: "zAxis", - position: {x:26,y:0.236,z:0} + position: {x:0.236,y:26,z:0}, + rotation: {x:0, y:0, z:Math.PI/2} } }, lattice:{ -- GitLab