From 7cb5966c8cc3554668b26fc323b5991ac87a9656 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Tue, 10 Mar 2015 02:09:07 -0400
Subject: [PATCH] remove inverse cells

---
 js/fea/DmaCell.js           |  33 +---
 js/fea/DmaCellOther.js      |   4 +-
 js/fea/DmaCellTetra.js      |   4 +-
 js/menus/LatticeMenuView.js |  16 +-
 js/models/AppState.js       |   3 -
 js/models/Lattice.js        |  64 +++-----
 js/models/LatticeOcta.js    | 292 +++++++++++++++++-------------------
 js/models/ThreeModel.js     |  10 --
 8 files changed, 173 insertions(+), 253 deletions(-)

diff --git a/js/fea/DmaCell.js b/js/fea/DmaCell.js
index 2c3753ed..a6076343 100644
--- a/js/fea/DmaCell.js
+++ b/js/fea/DmaCell.js
@@ -8,32 +8,29 @@
 var cellMaterials = [new THREE.MeshNormalMaterial(),
         new THREE.MeshBasicMaterial({color:0x000000, wireframe:true})];
 
-function DMACell(indices, scale, inverse) {
+function DMACell(indices, scale) {
 
     this.indices = indices;
-    if (!inverse) inverse = false;
-    this.isInverse = inverse;
     this.cellMesh = this._buildCellMesh();
     this.nodes = this._initNodes(this.cellMesh.children[0].geometry.vertices);
     this.beams = this._initBeams(this.nodes, this.cellMesh.children[0].geometry.faces);
 
     var cellMode = dmaGlobals.lattice.get("cellMode");
-    var inverseMode = dmaGlobals.lattice.get("inverseMode");
     var beamMode = dmaGlobals.lattice.get("partType") == "beam";
-    this.drawForMode(scale, cellMode, inverseMode, beamMode);
+    this.drawForMode(scale, cellMode, beamMode);
 }
 
 //todo this is a mess
-DMACell.prototype.drawForMode = function(scale, cellMode, inverseMode, beamMode){
+DMACell.prototype.drawForMode = function(scale, cellMode, beamMode){
     this.updateForScale(scale, cellMode);
-    this._setCellMeshVisibility(cellMode == "cell" && inverseMode==this.isInverse);//only show if in the correct inverseMode
+    this._setCellMeshVisibility(cellMode == "cell");
     if (!beamMode && cellMode == "part" && !this.parts) this.parts = this._initParts();
     _.each(this.parts, function(part){
         if (part) part.setVisibility(cellMode == "part" && !beamMode);
     });
     var self = this;
     _.each(this.beams, function(beam){
-        beam.setVisibility(beamMode && cellMode == "part" && inverseMode==self.isInverse);
+        beam.setVisibility(beamMode && cellMode == "part");
     });
 };
 
@@ -42,8 +39,7 @@ DMACell.prototype._buildCellMesh = function(unitCellGeo, material){//called from
     var mesh = THREE.SceneUtils.createMultiMaterialObject(unitCellGeo, material);
     this._doMeshTransformations(mesh);//some cell types require transformations, this may go away if i decide to do this in the geo instead
     mesh.myParent = this;//we need a reference to this instance from the mesh for intersection selection stuff
-    if (this.isInverse) dmaGlobals.three.sceneAdd(mesh, "inverseCell");
-    else dmaGlobals.three.sceneAdd(mesh, "cell");
+    dmaGlobals.three.sceneAdd(mesh, "cell");
     return mesh;
 };
 
@@ -92,7 +88,6 @@ DMACell.prototype.getEulerRotation = function(){
 };
 
 DMACell.prototype._calcPosition = function(){//need for part relay
-    if (this.isInverse) return dmaGlobals.lattice.getInvCellPositionForIndex(this.indices);
     return dmaGlobals.lattice.getPositionForIndex(this.indices);
 };
 
@@ -169,9 +164,7 @@ DMACell.prototype.removePart = function(index){
 
 DMACell.prototype.destroy = function(){
     if (this.cellMesh) {
-        var type = "cell";
-        if (this.isInverse) type = "inverseCell";
-        dmaGlobals.three.sceneRemove(this.cellMesh, type);
+        dmaGlobals.three.sceneRemove(this.cellMesh, "cell");
         this.cellMesh.myParent = null;
 //            this.cellMesh.dispose();
 //            geometry.dispose();
@@ -228,14 +221,4 @@ DMAFreeFormCell.prototype.toJSON = function(){
         type: this.getType()
     });
     return json;
-};
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////INVERSE SUPERCLASS/////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-function DMAInverseCell(indices, scale){//no rigid lattice structure for cells
-    DMACell.call(this, indices, scale, true);
-}
-DMAInverseCell.prototype = Object.create(DMACell.prototype);
+};
\ No newline at end of file
diff --git a/js/fea/DmaCellOther.js b/js/fea/DmaCellOther.js
index 190973b5..3de932db 100644
--- a/js/fea/DmaCellOther.js
+++ b/js/fea/DmaCellOther.js
@@ -56,9 +56,9 @@ var cellMaterial = [new THREE.MeshNormalMaterial()];
     unitCellGeo.computeFaceNormals();
 
     function DMATruncCubeCell(indices, scale){
-        DMAInverseCell.call(this, indices, scale);
+        DMACell.call(this, indices, scale);
     }
-    DMATruncCubeCell.prototype = Object.create(DMAInverseCell.prototype);
+    DMATruncCubeCell.prototype = Object.create(DMACell.prototype);
 
     DMATruncCubeCell.prototype._buildCellMesh = function(){//abstract mesh representation of cell
         var mesh = DMACell.prototype._buildCellMesh.call(this, unitCellGeo, cellMaterial);
diff --git a/js/fea/DmaCellTetra.js b/js/fea/DmaCellTetra.js
index c9194193..79a92dae 100644
--- a/js/fea/DmaCellTetra.js
+++ b/js/fea/DmaCellTetra.js
@@ -15,9 +15,9 @@ var unitCellGeoUpsideDown = unitCellGeo.clone();
 unitCellGeoUpsideDown.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI));
 
 function DMATetraFaceCell(indices, scale){
-    DMAInverseCell.call(this, indices, scale);
+    DMACell.call(this, indices, scale);
 }
-DMATetraFaceCell.prototype = Object.create(DMAInverseCell.prototype);
+DMATetraFaceCell.prototype = Object.create(DMACell.prototype);
 
 DMATetraFaceCell.prototype._buildCellMesh = function(){//abstract mesh representation of cell
     var zIndex = this.indices.z;
diff --git a/js/menus/LatticeMenuView.js b/js/menus/LatticeMenuView.js
index 44ae8f2b..ad42225e 100644
--- a/js/menus/LatticeMenuView.js
+++ b/js/menus/LatticeMenuView.js
@@ -15,9 +15,8 @@ LatticeMenuView = Backbone.View.extend({
         "slide #scaleSlider":                           "_sliderDidSlide",
         "slideStop #scaleSlider":                       "_changeScaleSlider",
         "change #preserveCells":                        "_changePreserveCells",
-        "change #showInverse":                          "_showInverseCells",
         "click #freeformTetraCell":                     "_setTetraCell",
-        "click #freeformOctaCell":                      "_setOctaCell",
+        "click #freeformOctaCell":                      "_setOctaCell"
     },
 
 
@@ -95,10 +94,6 @@ LatticeMenuView = Backbone.View.extend({
         this.lattice.set("shouldPreserveCells", $(e.target).prop("checked"));
     },
 
-    _showInverseCells: function(e){
-        this.lattice.set("inverseMode", $(e.target).prop("checked"));
-    },
-
     _setTetraCell: function(e){
         e.preventDefault();
         this.lattice.set("freeformCellType", "tetra");
@@ -155,10 +150,6 @@ LatticeMenuView = Backbone.View.extend({
         </label>\
         <% } %>\
         <br/>\
-        <label class="checkbox">\
-            <input type="checkbox"  <% if (inverseMode) { %> checked="checked" <% } %> value="" id="showInverse" data-toggle="checkbox" class="custom-checkbox"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>\
-            Show Inverse Geometry (hold "i" key)\
-        </label><br/>\
         Scale:&nbsp;&nbsp;<input id="scaleSlider" data-slider-id="ex1Slider" type="text" data-slider-min="1" data-slider-max="100" data-slider-step="0.1" data-slider-value="<%= scale %>"/>\
         <br/><input id="latticeScale" value="<%= scale %>" placeholder="enter scale" class="form-control" type="text"><br/>\
         Num Cells:&nbsp;&nbsp;<%= numCells %><br/>\
@@ -168,9 +159,4 @@ LatticeMenuView = Backbone.View.extend({
         hold "p" key to see parts\
         ')
 
-//    <label class="checkbox" for="invertGeo">\
-//            <input type="checkbox" checked="checked" value="" id="invertGeo" data-toggle="checkbox" class="custom-checkbox"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>\
-//            Show Inverse Geometry\
-//        </label>\
-
 });
\ No newline at end of file
diff --git a/js/models/AppState.js b/js/models/AppState.js
index 81525836..6ef2c5d6 100644
--- a/js/models/AppState.js
+++ b/js/models/AppState.js
@@ -145,9 +145,6 @@ AppState = Backbone.Model.extend({
                 if (cellMode == "part") this.lattice.set("cellMode", "cell");
                 else if (cellMode == "cell") this.lattice.set("cellMode", "part");
                 break;
-            case 73://i inverse mode
-                this.lattice.set("inverseMode", !this.lattice.get("inverseMode"));
-                break;
             case 83://s save
                 if (e.ctrlKey || e.metaKey){//command
                     e.preventDefault();
diff --git a/js/models/Lattice.js b/js/models/Lattice.js
index 1a09726e..82ad93b3 100644
--- a/js/models/Lattice.js
+++ b/js/models/Lattice.js
@@ -11,11 +11,7 @@ Lattice = Backbone.Model.extend({
         cells: [[[null]]],//3D matrix containing all cells and null, dynamic size
         cellsMin: {x:0, y:0, z:0},//min position of cells matrix
         cellsMax: {x:0, y:0, z:0},//max position of cells matrix
-        inverseCells: [[[null]]],//3d matrix containing all inverse cells and null, dynamic size
-        inverseCellsMin: {x:0, y:0, z:0},//min position of inverse cells matrix
-        inverseCellsMax: {x:0, y:0, z:0},//max position of inverse cells matrix
         numCells: 0,
-        numInvCells: 0,
 
         basePlane: null,//plane to build from
         scale: 20,
@@ -29,7 +25,6 @@ Lattice = Backbone.Model.extend({
         zSeparation: 0.0,
 
         cellMode: "cell",//show cells vs parts
-        inverseMode: false,//show negative space
         cellType: "octa",
         connectionType: "face",
         partType: "triangle"
@@ -43,7 +38,7 @@ Lattice = Backbone.Model.extend({
 
         //bind events
         this.listenTo(this, "change:scale", this._scaleDidChange);
-        this.listenTo(this, "change:inverseMode change:cellMode change:partType", this._updateForMode);
+        this.listenTo(this, "change:cellMode change:partType", this._updateForMode);
         this.listenTo(this, "change:cellType change:connectionType", this._updateLatticeType);
 
     },
@@ -89,22 +84,22 @@ Lattice = Backbone.Model.extend({
 
     },
 
-    _addInverseCellsForIndex: function(index){
-
-        var inverseIndicesToAdd = this._inverseIndicesToAdd(_.clone(index));
-
-        var invCells = this.get("inverseCells");
-        var scale = this.get("scale");
-        var self = this;
-        _.each(inverseIndicesToAdd, function(invIndex){
-            self._checkForMatrixExpansion(invCells, invIndex, invIndex, "inverseCellsMax", "inverseCellsMin");
-            var indexRel = self._subtract(invIndex, self.get("inverseCellsMin"));
-            if (!invCells[indexRel.x][indexRel.y][indexRel.z]) {
-                invCells[indexRel.x][indexRel.y][indexRel.z] = self._makeInvCellForLatticeType(invIndex, scale);
-                self.set("numInvCells", self.get("numInvCells")+1);
-            }
-        });
-    },
+//    _addInverseCellsForIndex: function(index){
+//
+//        var inverseIndicesToAdd = this._inverseIndicesToAdd(_.clone(index));
+//
+//        var invCells = this.get("inverseCells");
+//        var scale = this.get("scale");
+//        var self = this;
+//        _.each(inverseIndicesToAdd, function(invIndex){
+//            self._checkForMatrixExpansion(invCells, invIndex, invIndex, "inverseCellsMax", "inverseCellsMin");
+//            var indexRel = self._subtract(invIndex, self.get("inverseCellsMin"));
+//            if (!invCells[indexRel.x][indexRel.y][indexRel.z]) {
+//                invCells[indexRel.x][indexRel.y][indexRel.z] = self._makeInvCellForLatticeType(invIndex, scale);
+//                self.set("numInvCells", self.get("numInvCells")+1);
+//            }
+//        });
+//    },
 
     _indexForPosition: function(absPosition){
         var position = {};
@@ -152,7 +147,6 @@ Lattice = Backbone.Model.extend({
             if (cell && cell.destroy) cell.destroy();
         });
         this.set("cells", [[[null]]]);
-        this._clearInverseCells();
         this.set("cellsMax", {x:0, y:0, z:0});
         this.set("cellsMin", {x:0, y:0, z:0});
         this.set("nodes", []);
@@ -161,16 +155,6 @@ Lattice = Backbone.Model.extend({
         dmaGlobals.three.render();
     },
 
-    _clearInverseCells: function(){
-        this._iterCells(this.get("inverseCells"), function(cell){
-            if (cell && cell.destroy) cell.destroy();
-        });
-        this.set("inverseCells", [[[null]]]);
-        this.set("inverseCellsMin", {x:0, y:0, z:0});
-        this.set("inverseCellsMax", {x:0, y:0, z:0});
-        this.set("numInvCells", 0);
-    },
-
     ////////////////////////////////////////////////////////////////////////////////////
     ///////////////////////////////FILL GEOMETRY////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////
@@ -335,14 +319,10 @@ Lattice = Backbone.Model.extend({
 
     _updateForMode: function(){
         var cellMode = this.get("cellMode");
-        var inverseMode = this.get("inverseMode");
         var beamMode =  this.get("partType") == "beam";
         var scale = this.get("scale");
         this._iterCells(this.get("cells"), function(cell){
-            if (cell) cell.drawForMode(scale, cellMode, inverseMode, beamMode);
-        });
-        this._iterCells(this.get("inverseCells"), function(cell){
-            if (cell) cell.drawForMode(scale, cellMode, inverseMode, beamMode);
+            if (cell) cell.drawForMode(scale, cellMode, beamMode);
         });
         dmaGlobals.three.render();
     },
@@ -356,9 +336,6 @@ Lattice = Backbone.Model.extend({
         this._iterCells(this.get("cells"), function(cell){
             if (cell) cell.updateForScale(scale, cellMode);
         });
-        this._iterCells(this.get("inverseCells"), function(cell){
-            if (cell) cell.updateForScale(scale, cellMode);
-        });
 
         dmaGlobals.three.render();
     },
@@ -404,7 +381,6 @@ Lattice = Backbone.Model.extend({
             var self = this;
             var scale = this.get("scale");
             var cells = this.get("cells");
-            this._clearInverseCells();
             this._loopCells(cells, function(cell, x, y, z){
                 if (!cell) return;
 
@@ -461,6 +437,10 @@ Lattice = Backbone.Model.extend({
         }
     },
 
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////SAVE////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+
     saveJSON: function(name){
         if (!name) name = "lattice";
         var data = JSON.stringify(_.omit(this.toJSON(), ["highlighter", "basePlane"]));
diff --git a/js/models/LatticeOcta.js b/js/models/LatticeOcta.js
index 579c3d67..dcceb93c 100644
--- a/js/models/LatticeOcta.js
+++ b/js/models/LatticeOcta.js
@@ -53,41 +53,41 @@ OctaLatticeSubclasses = {
             return position;
         },
 
-        getInvCellPositionForIndex: function(index){
-
-            var scale = this.get("scale");
-            var position = _.clone(index);
-
-            var oddZ = position.z%2 != 0;
-            var upPoint = (position.z%4 == 0 || Math.abs(position.z%4) == 3);
-            position.z = Math.floor(position.z/2);
-
-            if (!upPoint){
-                position.x = (position.x)*this.xScale(scale);
-                position.y = position.y*this.yScale(scale);
-            } else {
-                position.x = (position.x+0.5)*this.xScale(scale);
-                position.y = (position.y)*this.yScale(scale)-scale/Math.sqrt(3)/2;
-            }
-
-            if (oddZ){
-                position.z = (position.z + 1)*this.zScale(scale);
-            } else {
-                position.z = (position.z)*this.zScale(scale);
-            }
-
-//            if (Math.abs(index.z%4) == 1 || Math.abs(index.z%4) == 2) position.z += this.zScale(scale);
-
-            if ((index.y%2) != 0) {
-                if (!upPoint){
-                    position.x += this.xScale(scale)/2;
-                } else {
-                    position.x -= this.xScale(scale)/2;
-                }
-            }
-
-            return position;
-        },
+//        getInvCellPositionForIndex: function(index){
+//
+//            var scale = this.get("scale");
+//            var position = _.clone(index);
+//
+//            var oddZ = position.z%2 != 0;
+//            var upPoint = (position.z%4 == 0 || Math.abs(position.z%4) == 3);
+//            position.z = Math.floor(position.z/2);
+//
+//            if (!upPoint){
+//                position.x = (position.x)*this.xScale(scale);
+//                position.y = position.y*this.yScale(scale);
+//            } else {
+//                position.x = (position.x+0.5)*this.xScale(scale);
+//                position.y = (position.y)*this.yScale(scale)-scale/Math.sqrt(3)/2;
+//            }
+//
+//            if (oddZ){
+//                position.z = (position.z + 1)*this.zScale(scale);
+//            } else {
+//                position.z = (position.z)*this.zScale(scale);
+//            }
+//
+////            if (Math.abs(index.z%4) == 1 || Math.abs(index.z%4) == 2) position.z += this.zScale(scale);
+//
+//            if ((index.y%2) != 0) {
+//                if (!upPoint){
+//                    position.x += this.xScale(scale)/2;
+//                } else {
+//                    position.x -= this.xScale(scale)/2;
+//                }
+//            }
+//
+//            return position;
+//        },
 
         xScale: function(scale){
             if (!scale) scale = this.get("scale");
@@ -105,52 +105,47 @@ OctaLatticeSubclasses = {
         },
 
         _makeCellForLatticeType: function(indices, scale){
-            this._addInverseCellsForIndex(indices);
             return new DMAFaceOctaCell(indices, scale);
         },
 
-        _makeInvCellForLatticeType: function(indices, scale){
-            return new DMATetraFaceCell(indices, scale, true);
-        },
-
-        _inverseIndicesToAdd: function(index){
-
-            var oddZ = index.z%2 != 0;
-
-            index = _.clone(index);
-            index.z*=2;
-
-            var z0 = 0;
-            if (oddZ) z0 = 1;
-
-            if (this.get("connectionType") == "edge") z0 = 0;
-            var z1 = Math.abs(z0-1);
-
-            var inverseIndicesToAdd;
-            if (index.y%2 == 0){
-
-                inverseIndicesToAdd = [
-                    this._add(index, {x:0,y:0,z:z0}),
-                    this._add(index, {x:0,y:1,z:z0}),
-                    this._add(index, {x:1,y:1,z:z0}),
-
-                    this._add(index, {x:0,y:0,z:z1}),
-                    this._add(index, {x:0,y:1,z:z1}),
-                    this._add(index, {x:1,y:0,z:z1})
-                ];
-            } else {
-                inverseIndicesToAdd = [
-                    this._add(index, {x:0,y:0,z:z0}),
-                    this._add(index, {x:-1,y:1,z:z0}),
-                    this._add(index, {x:0,y:1,z:z0}),
-
-                    this._add(index, {x:-1,y:0,z:z1}),
-                    this._add(index, {x:0,y:1,z:z1}),
-                    this._add(index, {x:0,y:0,z:z1})
-                ];
-            }
-            return inverseIndicesToAdd;
-        },
+//        _inverseIndicesToAdd: function(index){
+//
+//            var oddZ = index.z%2 != 0;
+//
+//            index = _.clone(index);
+//            index.z*=2;
+//
+//            var z0 = 0;
+//            if (oddZ) z0 = 1;
+//
+//            if (this.get("connectionType") == "edge") z0 = 0;
+//            var z1 = Math.abs(z0-1);
+//
+//            var inverseIndicesToAdd;
+//            if (index.y%2 == 0){
+//
+//                inverseIndicesToAdd = [
+//                    this._add(index, {x:0,y:0,z:z0}),
+//                    this._add(index, {x:0,y:1,z:z0}),
+//                    this._add(index, {x:1,y:1,z:z0}),
+//
+//                    this._add(index, {x:0,y:0,z:z1}),
+//                    this._add(index, {x:0,y:1,z:z1}),
+//                    this._add(index, {x:1,y:0,z:z1})
+//                ];
+//            } else {
+//                inverseIndicesToAdd = [
+//                    this._add(index, {x:0,y:0,z:z0}),
+//                    this._add(index, {x:-1,y:1,z:z0}),
+//                    this._add(index, {x:0,y:1,z:z0}),
+//
+//                    this._add(index, {x:-1,y:0,z:z1}),
+//                    this._add(index, {x:0,y:1,z:z1}),
+//                    this._add(index, {x:0,y:0,z:z1})
+//                ];
+//            }
+//            return inverseIndicesToAdd;
+//        },
 
         _undo: function(){//remove all the mixins, this will help with debugging later
             this.stopListening(this, "change:columnSeparation");
@@ -300,55 +295,50 @@ OctaLatticeSubclasses = {
         },
 
         _makeCellForLatticeType: function(indices, scale){
-            this._addInverseCellsForIndex(indices);
             return new DMAEdgeOctaCell(indices, scale);
         },
 
-        _makeInvCellForLatticeType: function(indices, scale){
-            return new DMATetraEdgeCell(indices, scale);
-        },
-
-        getInvCellPositionForIndex: function(index){
-
-            var scale = this.get("scale");
-            var position = _.clone(index);
-
-            var oddZ = position.z%2 != 0;
-            position.z = Math.floor(position.z/2);
-            var yScale = scale/Math.sqrt(3);
-
-            if (oddZ){
-                position.x = (position.x)*this.xScale(scale);
-                position.y = position.y*this.yScale(scale);
-            } else {
-                position.x = (position.x+0.5)*this.xScale(scale);
-                position.y = (position.y)*this.yScale(scale)-yScale/2;
-            }
-
-            if (oddZ){
-                position.z = (position.z + 1)*this.zScale(scale);
-            } else {
-                position.z = (position.z)*this.zScale(scale);
-            }
-
-            if ((index.y%2) != 0) {
-                if (oddZ){
-                    position.x += this.xScale(scale)/2;
-                } else {
-                    position.x -= this.xScale(scale)/2;
-                }
-            }
-
-            var zLayer = Math.floor(index.z/2)%3;
-            if (zLayer == 1) {
-                position.x += this.xScale(scale)/2;
-                position.y -= yScale/2;
-            } else if (zLayer == 2){
-                position.y -= yScale;
-            }
-
-            return position;
-        },
+//        getInvCellPositionForIndex: function(index){
+//
+//            var scale = this.get("scale");
+//            var position = _.clone(index);
+//
+//            var oddZ = position.z%2 != 0;
+//            position.z = Math.floor(position.z/2);
+//            var yScale = scale/Math.sqrt(3);
+//
+//            if (oddZ){
+//                position.x = (position.x)*this.xScale(scale);
+//                position.y = position.y*this.yScale(scale);
+//            } else {
+//                position.x = (position.x+0.5)*this.xScale(scale);
+//                position.y = (position.y)*this.yScale(scale)-yScale/2;
+//            }
+//
+//            if (oddZ){
+//                position.z = (position.z + 1)*this.zScale(scale);
+//            } else {
+//                position.z = (position.z)*this.zScale(scale);
+//            }
+//
+//            if ((index.y%2) != 0) {
+//                if (oddZ){
+//                    position.x += this.xScale(scale)/2;
+//                } else {
+//                    position.x -= this.xScale(scale)/2;
+//                }
+//            }
+//
+//            var zLayer = Math.floor(index.z/2)%3;
+//            if (zLayer == 1) {
+//                position.x += this.xScale(scale)/2;
+//                position.y -= yScale/2;
+//            } else if (zLayer == 2){
+//                position.y -= yScale;
+//            }
+//
+//            return position;
+//        },
 
         _undo: function(){//remove all the mixins, this will help with debugging later
             var self = this;
@@ -381,7 +371,6 @@ OctaLatticeSubclasses = {
         },
 
         _makeCellForLatticeType: function(indices, scale){
-//            this._addInverseCellsForIndex(indices);
             return new DMAVertexOctaCell(indices, scale);
         },
 
@@ -430,30 +419,30 @@ OctaLatticeSubclasses = {
             return this._positionForIndex(index);
         },
 
-        getInvCellPositionForIndex: function(index){
-
-            var position = this._positionForIndex(index);
-
-            var scale = this.get("scale");
-            position.x -= this.xScale(scale)/2;
-            position.y -= this.yScale(scale)/2;
-            position.z -= this.zScale(scale)/2;
-            return position;
-        },
-
-        _inverseIndicesToAdd: function(index){
-            return [
-                this._add(index, {x:0,y:0,z:0}),
-                this._add(index, {x:0,y:1,z:0}),
-                this._add(index, {x:1,y:0,z:0}),
-                this._add(index, {x:1,y:1,z:0}),
-
-                this._add(index, {x:0,y:0,z:1}),
-                this._add(index, {x:0,y:1,z:1}),
-                this._add(index, {x:1,y:0,z:1}),
-                this._add(index, {x:1,y:1,z:1})
-            ];
-        },
+//        getInvCellPositionForIndex: function(index){
+//
+//            var position = this._positionForIndex(index);
+//
+//            var scale = this.get("scale");
+//            position.x -= this.xScale(scale)/2;
+//            position.y -= this.yScale(scale)/2;
+//            position.z -= this.zScale(scale)/2;
+//            return position;
+//        },
+
+//        _inverseIndicesToAdd: function(index){
+//            return [
+//                this._add(index, {x:0,y:0,z:0}),
+//                this._add(index, {x:0,y:1,z:0}),
+//                this._add(index, {x:1,y:0,z:0}),
+//                this._add(index, {x:1,y:1,z:0}),
+//
+//                this._add(index, {x:0,y:0,z:1}),
+//                this._add(index, {x:0,y:1,z:1}),
+//                this._add(index, {x:1,y:0,z:1}),
+//                this._add(index, {x:1,y:1,z:1})
+//            ];
+//        },
 
         xScale: function(scale){
             if (!scale) scale = this.get("scale");
@@ -469,14 +458,9 @@ OctaLatticeSubclasses = {
         },
 
         _makeCellForLatticeType: function(indices, scale){
-            this._addInverseCellsForIndex(indices);
             return new DMAVertexOctaCell(indices, scale);
         },
 
-        _makeInvCellForLatticeType: function(indices, scale){
-            return new DMATruncCubeCell(indices, scale);
-        },
-
         _undo: function(){//remove all the mixins, this will help with debugging later
             var self = this;
             _.each(_.keys(this.OctaVertexLattice), function(key){
diff --git a/js/models/ThreeModel.js b/js/models/ThreeModel.js
index 1e7a3197..84baa1bc 100644
--- a/js/models/ThreeModel.js
+++ b/js/models/ThreeModel.js
@@ -11,7 +11,6 @@ function ThreeModel(){
 
     //store all meshes to highlight
     var cells = [];
-    var inverseCells = [];
     var parts = [];
     var basePlane = [];
 
@@ -55,8 +54,6 @@ function ThreeModel(){
 
         if (type == "cell"){
             cells.push(object.children[0]);
-        } else if (type == "inverseCell"){
-            inverseCells.push(object.children[0]);
         } else if (type == "part"){
             parts.push(object);
         } else if (type == "basePlane"){
@@ -70,8 +67,6 @@ function ThreeModel(){
 
         if (type == "cell"){
             cells.splice(cells.indexOf(objectToRemove.children[0]), 1);
-        } else if (type == "inverseCell"){
-            inverseCells.splice(inverseCells.indexOf(objectToRemove.children[0]), 1);
         } else if (type == "part"){
             parts.splice(parts.indexOf(objectToRemove), 1);
         } else if (type == "basePlane"){
@@ -88,11 +83,7 @@ function ThreeModel(){
         _.each(parts, function(part){
             scene.remove(part);
         });
-        _.each(inverseCells, function(cell){
-            scene.remove(cell);
-        });
         cells.splice(0, cells.length);
-        inverseCells.splice(0, inverseCells.length);
         parts.splice(0, parts.length);
     }
 
@@ -116,7 +107,6 @@ function ThreeModel(){
         domElement: renderer.domElement,
         camera: camera,
         cells: cells,
-        inverseCells: inverseCells,
         parts: parts,
         basePlane: basePlane,
         removeAllCells: removeAllCells
-- 
GitLab