From 9414b53cdd27460076773c71f16df5377f948b12 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 3 Mar 2015 18:10:59 -0500 Subject: [PATCH] inverse geometry bugs --- js/fea/DmaCell.js | 4 +++- js/models/Lattice.js | 4 ++-- js/models/ThreeModel.js | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/js/fea/DmaCell.js b/js/fea/DmaCell.js index 622d264c..6b532fb7 100644 --- a/js/fea/DmaCell.js +++ b/js/fea/DmaCell.js @@ -69,7 +69,9 @@ DMACell.prototype.getIndex = function(){ DMACell.prototype.destroy = function(){ if (this.cellMesh) { - dmaGlobals.three.sceneRemove(this.cellMesh, "cell"); + var type = "cell"; + if (this.isInverse) type = "inverseCell" + dmaGlobals.three.sceneRemove(this.cellMesh, type); this.cellMesh.myParent = null; // this.cellMesh.dispose(); // geometry.dispose(); diff --git a/js/models/Lattice.js b/js/models/Lattice.js index febe16ab..efbe5027 100644 --- a/js/models/Lattice.js +++ b/js/models/Lattice.js @@ -143,6 +143,7 @@ Lattice = Backbone.Model.extend({ 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); }, //////////////////////////////////////////////////////////////////////////////////// @@ -556,8 +557,7 @@ Lattice = Backbone.Model.extend({ self._checkForMatrixExpansion(invCells, invIndex, invIndex, "inverseCellsMax", "inverseCellsMin"); var indexRel = self._subtract(invIndex, self.get("inverseCellsMin")); if (!invCells[indexRel.x][indexRel.y][indexRel.z]) { - var cell = self._makeInvCellForLatticeType(invIndex, scale); - invCells[indexRel.x][indexRel.y][indexRel.z] = cell; + invCells[indexRel.x][indexRel.y][indexRel.z] = self._makeInvCellForLatticeType(invIndex, scale); self.set("numInvCells", self.get("numInvCells")+1); } }); diff --git a/js/models/ThreeModel.js b/js/models/ThreeModel.js index 39768f44..2c47785a 100644 --- a/js/models/ThreeModel.js +++ b/js/models/ThreeModel.js @@ -56,7 +56,7 @@ function ThreeModel(){ if (type == "cell"){ cells.push(object.children[0]); } else if (type == "inverseCell"){ - invCells.push(object); + invCells.push(object.children[0]); } else if (type == "part"){ parts.push(object); } else if (type == "basePlane"){ @@ -71,7 +71,7 @@ function ThreeModel(){ if (type == "cell"){ cells.splice(cells.indexOf(objectToRemove.children[0]), 1); } else if (type == "inverseCell"){ - invCells.splice(invCells.indexOf(objectToRemove), 1); + invCells.splice(invCells.indexOf(objectToRemove.children[0]), 1); } else if (type == "part"){ parts.splice(parts.indexOf(objectToRemove), 1); } else if (type == "basePlane"){ -- GitLab