diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index d0169cc08e16a7847eb3064c4f11511dc03f0d09..1c5e78a6144c00f9c7bb06d973fbe9e603ba6901 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -102,7 +102,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' return null; } if (!this.superCell) return this.getIndex(); - return this.superCell.getAbsoluteIndex().add(this.superCell.applyRotation(this.getIndex())); + return this.superCell.getAbsoluteIndex().add(this.superCell.applyRotation(this.getIndex()).round()); }; DMACell.prototype.getPosition = function(){ diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 88ce0c206e9cb5dfd9cc93c9bd7604499aa9cf04..e045e8ba0dd32ec2754c6ec7fe1d706f48785a66 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -204,20 +204,13 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre this._loopCells(this.sparseCells, function(cell, x, y, z){ if (cell){ var material = cell.getMaterial(); - if (material.dimensions){ - var subCellRange = (new THREE.Vector3(x, y, z)).add(cell.applyRotation(material.dimensions.clone()).round()); - dimMax.max(subCellRange); - dimMin.min(subCellRange); - } else if (cell.length){//gik - var subCellRange = (new THREE.Vector3(x, y, z)).add(cell.applyRotation(new THREE.Vector3(cell.length, 0, 0)).round()); - var padding = cell.applyRotation(new THREE.Vector3(0,1,1)).round(); - _.each(padding, function(element, key){ - if (element == -1) padding[key] = 1; - }); - subCellRange.add(padding); - dimMax.max(subCellRange); - dimMin.min(subCellRange); - } + var dimensions = material.dimensions; + if (dimensions) dimensions.clone(); + else dimensions = new THREE.Vector3(cell.length, 1, 1); + dimensions.sub(new THREE.Vector3(1,1,1)); + var subCellRange = (new THREE.Vector3(x, y, z)).add(cell.applyRotation(dimensions).round().add(new THREE.Vector3(1,1,1))); + dimMax.max(subCellRange); + dimMin.min(subCellRange); } }); return {max:dimMax, min:dimMin};