From f0365904841727b8c96e7917abc890f1732ec33c Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Fri, 21 Aug 2015 14:59:46 -0400
Subject: [PATCH] sync with will

---
 js/cam/assemblers/Assembler.js             | 9 +++++++--
 js/cam/assemblers/AssemblerPost.js         | 6 +++---
 js/lattice/latticeSubclasses/GIKLattice.js | 4 ++--
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js
index 8c69af97..a36e2099 100644
--- a/js/cam/assemblers/Assembler.js
+++ b/js/cam/assemblers/Assembler.js
@@ -69,6 +69,11 @@ 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, -1.28));//todo get rid of these
+
+
+//            geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-4, -4.5, 0));
+//            geometry.applyMatrix(new THREE.Matrix4().makeRotationZ(-Math.PI/2));
+//            geometry.applyMatrix(new THREE.Matrix4().makeTranslation(4.5, -4, 0));
 //            geometry.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI/2));
             return geometry;
         }
@@ -209,8 +214,8 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
         _.each(this.stock, function(stock){
             stock.show();
         });
-        if (index.z%2 != 0) {//rotate on odd rows
-            this.components.substrate.rotateTo(new THREE.Vector3(0, 0, Math.PI/2), speed, callback);
+        if (index.z%2 == 0) {//rotate on odd rows
+            this.components.substrate.rotateTo(new THREE.Vector3(0, 0, -Math.PI/2), speed, callback);
             return;
         }
         this.components.substrate.rotateTo(new THREE.Vector3(0, 0, 0), speed, callback);
diff --git a/js/cam/assemblers/AssemblerPost.js b/js/cam/assemblers/AssemblerPost.js
index 11a8673b..667cb95b 100644
--- a/js/cam/assemblers/AssemblerPost.js
+++ b/js/cam/assemblers/AssemblerPost.js
@@ -121,11 +121,11 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti
 
     position.sub(settings.originPosition);
 
-    if (index.z%2 != 0){
+    if (index.z%2 == 0){
         //offset for rotation
-        var offset = self.components.substrate.centerOfRotation.clone().multiplyScalar(settings.scale);//offset in mm
+        var offset = self.components.substrate.centerOfRotation.clone().multiplyScalar(settings.scale);//offset in lattice pitch
         var dist = position.clone().sub(offset);
-        position = offset.add(new THREE.Vector3(dist.y, -dist.x, position.z));
+        position = offset.add(new THREE.Vector3(-dist.y-3*settings.scale, dist.x-0.335, position.z));
     }
 
     var stock = _.find(self.stock, function(thisStock){
diff --git a/js/lattice/latticeSubclasses/GIKLattice.js b/js/lattice/latticeSubclasses/GIKLattice.js
index 67f16a40..d95bd225 100644
--- a/js/lattice/latticeSubclasses/GIKLattice.js
+++ b/js/lattice/latticeSubclasses/GIKLattice.js
@@ -44,12 +44,12 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
         },
 
         _zIndexRotation: function(index){
-            if (index.z%2 != 0) return Math.PI/2;
+            if (index.z%2 == 0) return Math.PI/2;
             return 0;
         },
 
         _zIndexRotationSuperCell: function(index){
-            if (index.z%2 != 0) return Math.PI/2;//this goes neg if zIndexRotation rules are opp? need to clear this up eventually
+            if (index.z%2 != 0) return -Math.PI/2;//this goes neg if zIndexRotation rules are opp? need to clear this up eventually
             return 0;
         },
 
-- 
GitLab