From dcea419d2cba7083b24c5009d42960372edcc5c9 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Sat, 12 Sep 2015 13:59:17 -0400
Subject: [PATCH] lattice aspect ratio moving to plist

---
 js/cells/DMACell.js                           |  6 +--
 js/cells/supercells/GIKSuperCell.js           |  2 +-
 js/lattice/Lattice.js                         | 32 ++++++-------
 js/lattice/latticeSubclasses/CubeLattice.js   | 14 ------
 js/lattice/latticeSubclasses/GIKLattice.js    | 14 ------
 .../latticeSubclasses/HexagonalLattice.js     | 15 ------
 .../latticeSubclasses/HexagonalRotLattice.js  | 15 ------
 js/lattice/latticeSubclasses/KelvinLattice.js | 14 ------
 .../latticeSubclasses/OctaEdgeLattice.js      | 14 ------
 .../latticeSubclasses/OctaFaceLattice.js      | 14 ------
 .../latticeSubclasses/OctaRotEdgeLattice.js   | 14 ------
 .../latticeSubclasses/OctaVertexLattice.js    | 14 ------
 .../latticeSubclasses/TetraStackedLattice.js  | 14 ------
 .../latticeSubclasses/TetraVertexLattice.js   | 14 ------
 .../latticeSubclasses/TruncatedCubeLattice.js | 14 ------
 js/menus/LatticeMenuView.js                   |  7 +--
 js/menus/templates/LatticeMenuView.html       |  6 +--
 js/menus/templates/PartMenuView.html          |  5 +-
 js/plists/PList.js                            | 46 +++++++++++++------
 js/simulation/electronics/LatticeEsim.js      |  2 +-
 20 files changed, 57 insertions(+), 219 deletions(-)

diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js
index 8400570a..b6b4185e 100644
--- a/js/cells/DMACell.js
+++ b/js/cells/DMACell.js
@@ -399,15 +399,15 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', '
     };
 
     DMACell.prototype.xScale = function(){
-        return lattice.xScale(0);
+        return lattice.xScale();
     };
 
     DMACell.prototype.yScale = function(){
-        return lattice.yScale(0);
+        return lattice.yScale();
     };
 
     DMACell.prototype.zScale = function(){
-        return lattice.zScale(0);
+        return lattice.zScale();
     };
 
 
diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js
index 3738fc66..ea7f1fe9 100644
--- a/js/cells/supercells/GIKSuperCell.js
+++ b/js/cells/supercells/GIKSuperCell.js
@@ -10,7 +10,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell',
     var unitGeos = {};
 
     function makePartWithLength(length){
-        var geo = new THREE.BoxGeometry(lattice.xScale(0),lattice.yScale(0),lattice.zScale(0));
+        var geo = new THREE.BoxGeometry(lattice.xScale(),lattice.yScale(),lattice.zScale());
         geo.applyMatrix(new THREE.Matrix4().makeScale(length, 1, 1));
         geo.applyMatrix(new THREE.Matrix4().makeTranslation(length/2-0.5, 0, 0));
         return geo;
diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js
index 1352ff6d..1d4890b6 100644
--- a/js/lattice/Lattice.js
+++ b/js/lattice/Lattice.js
@@ -23,21 +23,17 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             denseCellsMin: null,
             overlapDetected: false,
 
-            nodes: [],
-
-            cellSeparation: {xy:0, z:0}//spacing for connectors/joints
+            nodes: []
         }),
 
 
         __initialize: function(){
 
-            //todo change latticeType
             this.listenTo(this, "change:partType change:latticeType", this._updatePartType);
             this.listenTo(this, "change:cellType change:connectionType", function(){
                 this._updateLatticeConfig();//pass no params
             });
             this.listenTo(this, "change:latticeType", this._updateLatticeType);
-            this.listenTo(this, "change:cellSeparation", this._updateCellSeparation);
 
             this.listenTo(appState, "change:currentNav", this._navChanged);
             this.listenTo(this, "change:cellsMin change:cellsMax", function(){
@@ -85,6 +81,10 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
 
             var newMaterialClass = (latticeData.materialClasses || _.keys(plist.allMaterialClasses))[0];
             appState.set("materialClass", newMaterialClass);
+
+            if (latticeData.options){
+                if (latticeData.options.gikLength) appState.set("gikLength", latticeData.options.gikLength);
+            }
         },
 
         _setDefaultCellMode: function(){//if no part associated with this lattice type
@@ -107,25 +107,25 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return subclass;
         },
 
+        xScale: function(){
+            return this.get("aspectRatio").x;
+        },
+
+        yScale: function(){
+            return this.get("aspectRatio").y;
+        },
 
+        zScale: function(){
+            return this.get("aspectRatio").z;
+        },
 
 
 
 
 
-        //events
 
-        _updateCellSeparation: function(){
-            var cellSep = this.get("cellSeparation");
-            globals.basePlane.updateXYSeparation(cellSep.xy);
 
-            var cellMode = appState.get("cellMode");
-            var partType = this.get("partType");
-//            this._iterCells(this.cells, function(cell){
-//                if (cell) cell.updateForScale(cellMode, partType);
-//            });
-            three.render();
-        },
+        //events
 
         __clearCells: function(silent){
             three.removeAllCells();//todo add flag in cell destroy to avoid redundancy here
diff --git a/js/lattice/latticeSubclasses/CubeLattice.js b/js/lattice/latticeSubclasses/CubeLattice.js
index b3499ff3..df951705 100644
--- a/js/lattice/latticeSubclasses/CubeLattice.js
+++ b/js/lattice/latticeSubclasses/CubeLattice.js
@@ -28,20 +28,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return this._positionForIndex(index);
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 1+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return 1+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "cubeCell";
         },
diff --git a/js/lattice/latticeSubclasses/GIKLattice.js b/js/lattice/latticeSubclasses/GIKLattice.js
index d95bd225..9458c80d 100644
--- a/js/lattice/latticeSubclasses/GIKLattice.js
+++ b/js/lattice/latticeSubclasses/GIKLattice.js
@@ -29,20 +29,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return this._positionForIndex(index);
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 1+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return 1.28*(1+2*cellSeparation);
-        },
-
         _zIndexRotation: function(index){
             if (index.z%2 == 0) return Math.PI/2;
             return 0;
diff --git a/js/lattice/latticeSubclasses/HexagonalLattice.js b/js/lattice/latticeSubclasses/HexagonalLattice.js
index b62b5c27..950668e8 100644
--- a/js/lattice/latticeSubclasses/HexagonalLattice.js
+++ b/js/lattice/latticeSubclasses/HexagonalLattice.js
@@ -36,21 +36,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return position;
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return Math.sqrt(3)+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 1.5+2*cellSeparation;
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return 1+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "hexCell";
         },
diff --git a/js/lattice/latticeSubclasses/HexagonalRotLattice.js b/js/lattice/latticeSubclasses/HexagonalRotLattice.js
index 66186904..458a98a9 100644
--- a/js/lattice/latticeSubclasses/HexagonalRotLattice.js
+++ b/js/lattice/latticeSubclasses/HexagonalRotLattice.js
@@ -42,21 +42,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return position;
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 3+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 1+2*cellSeparation;
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return Math.sqrt(3)/2+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "hexRotCell";
         },
diff --git a/js/lattice/latticeSubclasses/KelvinLattice.js b/js/lattice/latticeSubclasses/KelvinLattice.js
index 1b850891..1ba33649 100644
--- a/js/lattice/latticeSubclasses/KelvinLattice.js
+++ b/js/lattice/latticeSubclasses/KelvinLattice.js
@@ -29,20 +29,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return this._positionForIndex(index);
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 2*Math.sqrt(2)+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return 2*Math.sqrt(2)+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "kelvinCell";
         },
diff --git a/js/lattice/latticeSubclasses/OctaEdgeLattice.js b/js/lattice/latticeSubclasses/OctaEdgeLattice.js
index f5ca9901..52270647 100644
--- a/js/lattice/latticeSubclasses/OctaEdgeLattice.js
+++ b/js/lattice/latticeSubclasses/OctaEdgeLattice.js
@@ -66,20 +66,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
 //            return position;
 //        },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 1+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation)/2*Math.sqrt(3);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return 2/Math.sqrt(6)+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "octaEdgeCell";
         },
diff --git a/js/lattice/latticeSubclasses/OctaFaceLattice.js b/js/lattice/latticeSubclasses/OctaFaceLattice.js
index 5e0d1d06..766007f6 100644
--- a/js/lattice/latticeSubclasses/OctaFaceLattice.js
+++ b/js/lattice/latticeSubclasses/OctaFaceLattice.js
@@ -35,20 +35,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return position;
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 1+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation)/2*Math.sqrt(3);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return 2/Math.sqrt(6)+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "octaFaceCell";
         },
diff --git a/js/lattice/latticeSubclasses/OctaRotEdgeLattice.js b/js/lattice/latticeSubclasses/OctaRotEdgeLattice.js
index bf325be9..bd381b61 100644
--- a/js/lattice/latticeSubclasses/OctaRotEdgeLattice.js
+++ b/js/lattice/latticeSubclasses/OctaRotEdgeLattice.js
@@ -39,20 +39,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return position;
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 1 + 2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return Math.sqrt(2)/2 + 2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "octaRotEdgeCell";
         },
diff --git a/js/lattice/latticeSubclasses/OctaVertexLattice.js b/js/lattice/latticeSubclasses/OctaVertexLattice.js
index 7a005de0..515ef779 100644
--- a/js/lattice/latticeSubclasses/OctaVertexLattice.js
+++ b/js/lattice/latticeSubclasses/OctaVertexLattice.js
@@ -28,20 +28,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return this._positionForIndex(index);
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return Math.sqrt(2)+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return Math.sqrt(2)+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "octaVertexCell";
         },
diff --git a/js/lattice/latticeSubclasses/TetraStackedLattice.js b/js/lattice/latticeSubclasses/TetraStackedLattice.js
index 7694dacb..e726f022 100644
--- a/js/lattice/latticeSubclasses/TetraStackedLattice.js
+++ b/js/lattice/latticeSubclasses/TetraStackedLattice.js
@@ -35,20 +35,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return position;
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 1+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation)/2*Math.sqrt(3);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return 2/Math.sqrt(6)+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "tetraStackedCell";
         },
diff --git a/js/lattice/latticeSubclasses/TetraVertexLattice.js b/js/lattice/latticeSubclasses/TetraVertexLattice.js
index a1c2c8ac..41913d7c 100644
--- a/js/lattice/latticeSubclasses/TetraVertexLattice.js
+++ b/js/lattice/latticeSubclasses/TetraVertexLattice.js
@@ -37,20 +37,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return position;
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return 1+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation)/2*Math.sqrt(3);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return 2/Math.sqrt(6)+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "tetraVertexCell";
         },
diff --git a/js/lattice/latticeSubclasses/TruncatedCubeLattice.js b/js/lattice/latticeSubclasses/TruncatedCubeLattice.js
index 4ee6ffc0..1b0f12d0 100644
--- a/js/lattice/latticeSubclasses/TruncatedCubeLattice.js
+++ b/js/lattice/latticeSubclasses/TruncatedCubeLattice.js
@@ -29,20 +29,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             return this._positionForIndex(index);
         },
 
-        xScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
-            return Math.sqrt(2)+2*cellSeparation;
-        },
-
-        yScale: function(cellSeparation){
-            return this.xScale(cellSeparation);
-        },
-
-        zScale: function(cellSeparation){
-            if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
-            return Math.sqrt(2)+2*cellSeparation;
-        },
-
         getCellSubclassFile: function(){
             return "truncatedCubeCell";
         },
diff --git a/js/menus/LatticeMenuView.js b/js/menus/LatticeMenuView.js
index 4aaa1845..8be261c9 100644
--- a/js/menus/LatticeMenuView.js
+++ b/js/menus/LatticeMenuView.js
@@ -21,9 +21,4 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice', 'text!latticeM
 
         template: _.template(template)
     });
-});
-
-//Cell Separation <% if (connectionType != "freeformFace"){ %>(xy, z): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text">\
-//&nbsp;<input data-type="z" value="<%= cellSeparation.z %>" placeholder="Z" class="form-control numberInput cellSeparation" type="text">\
-//<% } else { %>( radial ): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text"><% } %>\
-//<br/><br/>\
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/js/menus/templates/LatticeMenuView.html b/js/menus/templates/LatticeMenuView.html
index ce5210be..2e5923c2 100644
--- a/js/menus/templates/LatticeMenuView.html
+++ b/js/menus/templates/LatticeMenuView.html
@@ -33,8 +33,4 @@ Aspect Ratio:&nbsp;&nbsp;
     Part Length:&nbsp;&nbsp;<input data-property="gikLength" value="<%= gikLength %>" placeholder="Length" class="form-control intInput appState" type="text"><br/><br/>
 <% } %>
 <a href="#" class="clearCells btn btn-block btn-lg btn-danger">Clear All Cells</a><br/>
-Num Cells:&nbsp;&nbsp;<%= numCells %><br/>
-<!--//Cell Separation <% if (connectionType != "freeformFace"){ %>(xy, z): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text">-->
-<!--//&nbsp;<input data-type="z" value="<%= cellSeparation.z %>" placeholder="Z" class="form-control numberInput cellSeparation" type="text">-->
-<!--//<% } else { %>( radial ): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text"><% } %>-->
-<!--//<br/><br/>-->
\ No newline at end of file
+Num Cells:&nbsp;&nbsp;<%= numCells %><br/>
\ No newline at end of file
diff --git a/js/menus/templates/PartMenuView.html b/js/menus/templates/PartMenuView.html
index 038f98ba..329494f3 100644
--- a/js/menus/templates/PartMenuView.html
+++ b/js/menus/templates/PartMenuView.html
@@ -7,7 +7,4 @@ Part Type: &nbsp;&nbsp;
                 <li><a class="lattice dropdownSelector" data-property="partType" data-value="<%= key %>" href="#"><%= val.name %></a></li>
             <% }); %>
         </ul>
-    </div><br/><br/>
-<!--Cell Separation (xy, z): &nbsp;&nbsp;<input data-property="cellSeparation" data-key="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control floatInput lattice" type="text">
-&nbsp;<input data-property="cellSeparation" data-key="z" value="<%= cellSeparation.z %>" placeholder="Z" class="form-control floatInput lattice" type="text">
-<br/><br/>--><br/>
\ No newline at end of file
+    </div><br/><br/>
\ No newline at end of file
diff --git a/js/plists/PList.js b/js/plists/PList.js
index 96502317..9b80dcb4 100644
--- a/js/plists/PList.js
+++ b/js/plists/PList.js
@@ -103,13 +103,13 @@ define(['three'], function(THREE){
                                         name: "Triangle"
                                     }
                                 },
-                                aspectRatio: new THREE.Vector3(1,1,1),
+                                aspectRatio: new THREE.Vector3(1,1/2*Math.sqrt(3),2/Math.sqrt(6)),
                                 materialClasses: ['mechanical']
                             },
                             default: {
                                 name: "Default",
                                 parts: null,
-                                aspectRatio: new THREE.Vector3(1,1,1)
+                                aspectRatio: new THREE.Vector3(1,1/2*Math.sqrt(3),2/Math.sqrt(6))
                             }
                         }
                     },
@@ -131,13 +131,13 @@ define(['three'], function(THREE){
                                         name: "Snap Voxel (low res)"
                                     }
                                 },
-                                aspectRatio: new THREE.Vector3(1,1,1),
+                                aspectRatio: new THREE.Vector3(1,1,Math.sqrt(2)/2),
                                 materialClasses: ['mechanical']
                             },
                             default: {
                                 name: "Default",
                                 parts: null,
-                                aspectRatio: new THREE.Vector3(1,1,1)
+                                aspectRatio: new THREE.Vector3(1,1,Math.sqrt(2)/2)
                             }
                         }
                     },
@@ -159,13 +159,13 @@ define(['three'], function(THREE){
                                     }
                 //                   xShape:"X"
                                 },
-                                aspectRatio: new THREE.Vector3(1,1,1),
+                                aspectRatio: new THREE.Vector3(Math.sqrt(2),Math.sqrt(2),Math.sqrt(2)),
                                 materialClasses: ['mechanical']
                             },
                             default: {
                                 name: "Default",
                                 parts: null,
-                                aspectRatio: new THREE.Vector3(1,1,1)
+                                aspectRatio: new THREE.Vector3(Math.sqrt(2),Math.sqrt(2),Math.sqrt(2))
                             }
                         }
                     }
@@ -181,11 +181,12 @@ define(['three'], function(THREE){
                             default: {
                                 name: "Default",
                                 parts: null,
-                                aspectRatio: new THREE.Vector3(1,1,1)
+                                aspectRatio: new THREE.Vector3(1,1/2*Math.sqrt(3),2/Math.sqrt(6))
                             }
                         }
                     }
                 }
+                //vetex (1, 1//2*Math.sqrt(3), 2/Math.sqrt(6))
             },
             cube: {
                 name: "Cube",
@@ -215,8 +216,27 @@ define(['three'], function(THREE){
                                         name: "Micro LEGO (low res)"
                                     }
                                 },
-                                aspectRatio: new THREE.Vector3(1,1,1.28),
-                                materialClasses: ['electronic']
+                                aspectRatio: new THREE.Vector3(1,1,5),//1.28
+                                materialClasses: ['electronic'],
+                                options: {
+                                    gikLength: 4
+                                }
+                            },
+                            dnaBricks: {
+                                name: "DNA Bricks",
+                                parts: {
+                                    dnaLego: {
+                                        name: "Lego Blocks"
+                                    },
+                                    dnaStraight: {
+                                        name: "DNA (straight chains)"
+                                    }
+                                },
+                                aspectRatio: new THREE.Vector3(1,1,1),
+                                materialClasses: ['mechanical'],
+                                options: {
+                                    gikLength: 2
+                                }
                             },
                             default: {
                                 name: "Default",
@@ -237,7 +257,7 @@ define(['three'], function(THREE){
                             default: {
                                 name: "Default",
                                 parts: null,
-                                aspectRatio: new THREE.Vector3(1,1,1)
+                                aspectRatio: new THREE.Vector3(Math.sqrt(2),Math.sqrt(2),Math.sqrt(2))
                             }
                         }
                     }
@@ -253,7 +273,7 @@ define(['three'], function(THREE){
                             default: {
                                 name: "Default",
                                 parts: null,
-                                aspectRatio: new THREE.Vector3(1,1,1)
+                                aspectRatio: new THREE.Vector3(2*Math.sqrt(2),2*Math.sqrt(2),2*Math.sqrt(2))
                             }
                         }
                     }
@@ -269,7 +289,7 @@ define(['three'], function(THREE){
                             default: {
                                 name: "Default",
                                 parts: null,
-                                aspectRatio: new THREE.Vector3(1,1,1)
+                                aspectRatio: new THREE.Vector3(Math.sqrt(3),1.5,1)
                             }
                         }
                     },
@@ -280,7 +300,7 @@ define(['three'], function(THREE){
                             default: {
                                 name: "Default",
                                 parts: null,
-                                aspectRatio: new THREE.Vector3(1,1,1)
+                                aspectRatio: new THREE.Vector3(3,1,Math.sqrt(3)/2)
                             }
                         }
                     }
diff --git a/js/simulation/electronics/LatticeEsim.js b/js/simulation/electronics/LatticeEsim.js
index 6614c3c5..73a88c12 100644
--- a/js/simulation/electronics/LatticeEsim.js
+++ b/js/simulation/electronics/LatticeEsim.js
@@ -104,7 +104,7 @@ define(['lattice', 'appState', 'three', 'threeModel', 'numeric', 'eSim', 'eSimFi
                 }
             });
 
-            var offset = this.get("cellsMin").clone().sub(new THREE.Vector3(1/(2*resolution)+this.xScale(0)/2, 1/(2*resolution)+this.yScale(0)/2, 1/(2*resolution)+this.zScale(0)/2));
+            var offset = this.get("cellsMin").clone().sub(new THREE.Vector3(1/(2*resolution)+this.xScale()/2, 1/(2*resolution)+this.yScale()/2, 1/(2*resolution)+this.zScale()/2));
             var dataRange = [];
             _.each(conductorGroups, function(group){
                 dataRange.push(group.voltage);
-- 
GitLab