diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index b2feb87b1292ece9302c1ce22cc0aff4f5c116cf..9e72734f667afefe62e3cce47dec7f8a64e9b72a 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -21,9 +21,9 @@ DMASuperCell.prototype = Object.create(DMACell.prototype); DMASuperCell.prototype._makeChildCells = function(index, range){ var cells = [];//todo make cells a 3d array? - for (var x=0;i<range.x;x++){ + for (var x=0;x<range.x;x++){ for (var y=0;y<range.y;y++){ - for (var z=0;i<range.z;z++){ + for (var z=0;z<range.z;z++){ cells.push(this._makeSubCellForIndex({x:x, y:y, z:z})); } } @@ -60,7 +60,8 @@ DMASuperCell.prototype.setMode = function(mode){ }; DMASuperCell.prototype.getLength = function(){ - return this.cells.length-1; + if (this.cells) return this.cells.length-1; + return globals.lattice.get("superCellRange").x; }; DMASuperCell.prototype.destroy = function(){ diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js index be95d73f61b6ef99be4bb0ffade13cb2952d120b..12e975ca61739980f7bd8092063e633939aedaff 100644 --- a/js/cells/supercells/GIKSuperCell.js +++ b/js/cells/supercells/GIKSuperCell.js @@ -47,7 +47,7 @@ GIKSuperCell.prototype._rotateCell = function(object3D){ }; GIKSuperCell.prototype._buildMesh = function(){ - var length = globals.lattice.get("gikLength"); + var length = globals.lattice.get("superCellRange").x; var meshes = []; var superCellGeo = new THREE.BoxGeometry(1,1,1.28); superCellGeo.applyMatrix(new THREE.Matrix4().makeScale(length, 1, 1));