diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index 388d98c12579986ef592d70bb1d77c44afa786ec..607cfa63ad384e9e8b6897e08d6cffc097eb8e3a 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -9,7 +9,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell', 'mat function DMASuperCell(json, superCell){//supercells might have supercells - this.cells = true;//flag for now + this.sparseCells = true;//flag for now DMACell.call(this, json, superCell); @@ -55,7 +55,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell', 'mat var origin = this.getAbsoluteOrigin(); var index = this.getAbsoluteIndex(); var min = index.clone().sub(origin); - var max = index.add(this.getAbsoluteDimensions()).sub(origin); + var max = index.add(this.getAbsoluteDimensions()).sub(origin).sub(new THREE.Vector3(1,1,1)); return {min: min, max: max}; }; diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index 75079cf6107f92d3f60e07682798823383b5a629..befd9593bc2bd2ed3d6ccb8289f65b22da92885f 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -14,8 +14,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis scale: 1.0, cellType: "cube", - connectionType: "face", - applicationType: "default", + connectionType: "gik", + applicationType: "willGik", partType: null, aspectRatio: null, diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index ad090915b5f001b19cbb802d19e7ec6d4f7fa058..b1a2b02653e3a2016c7b917fc972322f3183aaae 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -156,8 +156,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre self._loopCells(flattenedCells, function(flatCell, x, y, z){ self.cells[relIndex.x+x][relIndex.y+y][relIndex.z+z] = flatCell; }); - console.log(self.cells); - console.log(self.sparseCells); cell.addToScene(); }); diff --git a/js/simulation/electronics/cells/eSimSuperCell.js b/js/simulation/electronics/cells/eSimSuperCell.js index 9b2f78943f06eddef67b53ca9c178711db7e9ee7..a548f673ca8acc52c5cdb8982bcc01ae97410d05 100644 --- a/js/simulation/electronics/cells/eSimSuperCell.js +++ b/js/simulation/electronics/cells/eSimSuperCell.js @@ -7,10 +7,10 @@ define(['underscore', 'superCell'], function(_, DMASuperCell){ DMASuperCell.prototype.conductiveGroupVisible = function(allVisible, groupNum){ if (allVisible) return this.isConductive(); - for (var i=0;i<this.cells.length;i++){ - for (var j=0;j<this.cells[0].length;j++){ - for (var k=0;k<this.cells[0][0].length;k++){ - if (this.cells[i][j][k] && this.cells[i][j][k].conductiveGroupVisible(allVisible, groupNum)) return true; + for (var i=0;i<this.sparseCells.length;i++){ + for (var j=0;j<this.sparseCells[0].length;j++){ + for (var k=0;k<this.sparseCells[0][0].length;k++){ + if (this.sparseCells[i][j][k] && this.sparseCells[i][j][k].conductiveGroupVisible(allVisible, groupNum)) return true; } } } @@ -18,10 +18,10 @@ define(['underscore', 'superCell'], function(_, DMASuperCell){ }; DMASuperCell.prototype.structuralGroupVisible = function(groupNum){ - for (var i=0;i<this.cells.length;i++){ - for (var j=0;j<this.cells[0].length;j++){ - for (var k=0;k<this.cells[0][0].length;k++){ - if (this.cells[i][j][k] && this.cells[i][j][k].structuralGroupVisible(groupNum)) return true; + for (var i=0;i<this.sparseCells.length;i++){ + for (var j=0;j<this.sparseCells[0].length;j++){ + for (var k=0;k<this.sparseCells[0][0].length;k++){ + if (this.sparseCells[i][j][k] && this.sparseCells[i][j][k].structuralGroupVisible(groupNum)) return true; } } } diff --git a/js/three/ThreeModel.js b/js/three/ThreeModel.js index 7d1be5af20261c7b26493ef8496f0c703eff8a74..a5ac8315959e659862d20f951f8d1409da2af3b9 100644 --- a/js/three/ThreeModel.js +++ b/js/three/ThreeModel.js @@ -114,11 +114,15 @@ define(['underscore', 'three'], function(_, THREE){ } function removeCell(cell){ - cells.splice(cells.indexOf(cell), 1); + var index = cells.indexOf(cell); + if (index < 0) return; + cells.splice(index, 1); } function removeCompositeCell(cell){ - compositeCells.splice(compositeCells.indexOf(cell), 1); + var index = compositeCells.indexOf(cell); + if (index < 0) return; + compositeCells.splice(index, 1); } function getCells(){