diff --git a/js/cells/supercells/CompositeCell.js b/js/cells/supercells/CompositeCell.js index f449d77eb880ca43816f8e6086b474d3af875c8b..622282f820f8b936ff2ffba5eeb5efe53be42bb7 100644 --- a/js/cells/supercells/CompositeCell.js +++ b/js/cells/supercells/CompositeCell.js @@ -14,7 +14,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', CompositeCell.prototype._getGeometry = function(){ var dimensions = materials[this.materialName].dimensions; var geo = new THREE.BoxGeometry(dimensions.x*lattice.xScale(), dimensions.y*lattice.yScale(), dimensions.z*lattice.zScale()); - geo.applyMatrix(new THREE.Matrix4().makeTranslation(dimensions.x/2-0.5, dimensions.y/2-0.5, dimensions.z/2-0.5)); + geo.applyMatrix(new THREE.Matrix4().makeTranslation((dimensions.x/2-0.5)*lattice.xScale(), (dimensions.y/2-0.5)*lattice.yScale(), (dimensions.z/2-0.5)*lattice.zScale())); return geo; }; diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index 37d16d71a45f53c3c0057282ffd58ab36779a7d2..44bf5cee50087cfc46cd8695e2dd1186c01f398d 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -40,9 +40,9 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], cells[x][y].push(null); - var json = {index: new THREE.Vector3(x,y,z)}; + var json = {index: new THREE.Vector3(x, y, z)}; var callback = function(cell){ - var cellIndex = cell.getIndex();//x,y,z have changed by now + var cellIndex = cell.getIndex();//x, y, z have changed by now cells[cellIndex.x][cellIndex.y][cellIndex.z] = cell; }; diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 06fdd267cc27a7cea38aa250f411bc433c9d111d..15b3c4f0352fadb0f587ee98af92f9f1b866710b 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -204,7 +204,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre if (cell){ var material = cell.getMaterial(); if (material.dimensions){ - var subCellMax = (new THREE.Vector3(x, y, z)).add(material.dimensions); + var subCellMax = (new THREE.Vector3(x, y, z)).add(cell.applyAbsoluteRotation(material.dimensions)); dimVector.max(subCellMax); } else if (cell.length){ var subCellMax = (new THREE.Vector3(x, y, z)).add(cell.applyAbsoluteRotation(new THREE.Vector3(cell.length, 1, 1)));