From 0085fc5e359634bed4a34f5947a88c10cf180fa1 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Tue, 9 Jun 2015 18:46:54 -0700
Subject: [PATCH] supercell orientation

---
 js/cells/DMACell.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js
index 2a90f01f..ed033200 100644
--- a/js/cells/DMACell.js
+++ b/js/cells/DMACell.js
@@ -22,8 +22,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'],
         if (this.superCell) this.superCell.addChildren(this.object3D);//add as child of supercell
 
         if (this.index){
-            if (!this.cells) three.addCell(this.object3D.children[0]);//add mesh as highlightable object
-            if (!superCell || superCell === undefined) three.sceneAdd(this.object3D);
+            if (!this.cells) three.addCell(this.object3D.children[0]);//add mesh as highlightable object, only for lowest level of hierarchy
+            if (!superCell || superCell === undefined) three.sceneAdd(this.object3D);//add object3d as child of scene if top level of hierarchy
         } else this.hide();//stock cell
 
         if (!this.cells && ( !superCell || superCell === undefined)) this.setMode();
@@ -118,7 +118,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'],
 
     DMACell.prototype.getAbsoluteOrientation = function(){
         if (!this.superCell) return this.getOrientation();
-        return this.getOrientation().cross(this.superCell.getAbsoluteOrientation());//order matters!
+        return this.getOrientation().multiply(this.superCell.getAbsoluteOrientation());//order matters!
     };
 
     DMACell.prototype.getEuler = function(){
@@ -126,7 +126,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'],
     };
 
     DMACell.prototype.applyRotation = function(vector){//
-        vector.applyQuaternion(this.getOrientation());
+        vector.applyQuaternion(this.getAbsoluteOrientation());
+        return vector;
     };
 
     DMACell.prototype.applyAbsoluteRotation = function(vector){
-- 
GitLab