From 942cac957fc53b08ddda74a17ab53c67c918fd24 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 18 Aug 2015 18:36:44 -0400 Subject: [PATCH] gik cell orientation worked out --- js/cam/assemblers/Assembler.js | 6 +++--- js/highlighter/SuperCellHighlighter.js | 2 -- js/lattice/Lattice.js | 1 - js/lattice/LatticeBase.js | 2 +- js/lattice/latticeSubclasses/GIKLattice.js | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js index 385d8a20..4edf6fd8 100644 --- a/js/cam/assemblers/Assembler.js +++ b/js/cam/assemblers/Assembler.js @@ -339,10 +339,10 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' if (totalThreads > 0) return; callback(); } - var startingPos = {x:this.components.xAxis.getPosition().x, y:this.components.yAxis.getPosition().y, z:this.components.zAxis.getPosition().z}; + var startingPos = {x:this.components.yAxis.getPosition().x, y:this.components.xAxis.getPosition().y, z:this.components.zAxis.getPosition().z}; speed = this._normalizeSpeed(startingPos, position, new THREE.Vector3(speed, speed, speed)); - this.components.xAxis.moveTo(this._makeAxisVector(position, "x"), speed.x, sketchyCallback); - this.components.yAxis.moveTo(this._makeAxisVector(position, "y"), speed.y, sketchyCallback); + this.components.yAxis.moveTo(this._makeAxisVector(position, "x"), speed.x, sketchyCallback); + this.components.xAxis.moveTo(this._makeAxisVector(position, "y"), speed.y, sketchyCallback); this.components.zAxis.moveTo(this._makeAxisVector(position, "z"), speed.z, sketchyCallback); }; diff --git a/js/highlighter/SuperCellHighlighter.js b/js/highlighter/SuperCellHighlighter.js index 14d6bec7..f08f59d5 100644 --- a/js/highlighter/SuperCellHighlighter.js +++ b/js/highlighter/SuperCellHighlighter.js @@ -43,7 +43,6 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' if (!this.highlightedObject) return; var index = this.highlightedObject.getAbsoluteIndex(); if (Math.abs(direction.z) > 0.9) index.z+=1; - else if (Math.abs(direction.z) < 0.1) index.z -=1; if (appState._drawingWithCompositeMaterialType()) this.mesh.rotation.set(0,0, lattice._zIndexRotationSuperCell(index)); else this.mesh.rotation.set(0,0, lattice._zIndexRotation(index)); } @@ -69,7 +68,6 @@ 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/Lattice.js b/js/lattice/Lattice.js index a01b559e..b8f54050 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -143,7 +143,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre var min = this.get("cellsMin").sub(bounds.min); var overlap = false; var forCAM = appState.get("currentNav") == "navAssemble"; - console.log(forCAM); this._loopCells(this.sparseCells, function(cell){ if (!cell) return; overlap |= cell.addToDenseArray(cells, min, forCAM); diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index c54c27b9..c50e2575 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -205,7 +205,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre if (cell){ var material = cell.getMaterial(); var dimensions = material.dimensions; - if (dimensions) dimensions.clone(); + if (dimensions) dimensions = dimensions.clone(); else dimensions = new THREE.Vector3(cell.length, 1, 1); dimensions.sub(new THREE.Vector3(1,1,1)); var subCellRange = (new THREE.Vector3(x, y, z)).add(cell.applyRotation(dimensions).round().add(new THREE.Vector3(1,1,1))); diff --git a/js/lattice/latticeSubclasses/GIKLattice.js b/js/lattice/latticeSubclasses/GIKLattice.js index 4ad1b24d..1c0150a2 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;//this never changes + if (index.z%2 != 0) return -Math.PI/2;//this never changes return 0; }, -- GitLab