diff --git a/js/API/LatticeAPI.js b/js/API/LatticeAPI.js index c9746c1ba49ecae86451f9088dcbd30023532cd9..e69600a54b78e58e89b4ccedb1bef4d256af6223 100644 --- a/js/API/LatticeAPI.js +++ b/js/API/LatticeAPI.js @@ -26,7 +26,7 @@ define(['lattice', 'plist'], function(lattice){ }, getBoundingBox: function(){ - return lattice.calculateBoundingBox(); + return lattice.getBoundingBox(); }, getAspectRatio: function(){ diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 531797953fe7f2363d1b119bec86c56ae3bbf551..e10080238b2be84629736d30734a28eef131fc6d 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -32,15 +32,13 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre //getters getSize: function(){ - var bBox = this.calculateBoundingBox(); - return bBox.max.sub(bBox.min).add(new THREE.Vector3(1,1,1)); + return this.get("cellMax").clone().sub(this.get("cellsMin")); }, getBoundingBox: function(){ - return this.calculateBoundingBox(); + return {min: this.get("cellsMin"), max:this.get("cellsMax")}; }, - getNumCells: function(){ return this.get("numCells"); }, @@ -530,45 +528,45 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre return {x:xScale, y:yScale, z:zScale}; }, - _parseSparseCell: function(){ - - this.cells = [[[null]]]; - - console.log("parse cells"); - - if (this.get("numCells") == 0) { - console.warn("no cells in assembly"); - this.cells = [[[null]]]; - return; - } - - var bounds = this.calculateBoundingBox(); - this.set("cellsMin", bounds.min.clone().add(this.get("cellsMin"))); - var size = bounds.max.sub(bounds.min); - - //create array of nulls - var cells = []; - for (var x=0;x<size.x;x++){ - cells.push([]); - for (var y=0;y<size.y;y++){ - cells[x].push([]); - for (var z=0;z<size.z;z++){ - cells[x][y].push(null); - } - } - } - - var min = this.get("cellsMin").sub(bounds.min); - var overlap = []; - var forCAM = appState.get("currentNav") == "navAssemble"; - this._loopCells(this.sparseCells, function(cell){ - var overlappingCells = cell.addToDenseArray(cells, min, forCAM); - if (overlappingCells) overlap = overlap.concat(overlappingCells); - }); - this.set("overlappingCells", overlap); - - this.cells = cells; - }, +// _parseSparseCell: function(){ +// +// this.cells = [[[null]]]; +// +// console.log("parse cells"); +// +// if (this.get("numCells") == 0) { +// console.warn("no cells in assembly"); +// this.cells = [[[null]]]; +// return; +// } +// +// var bounds = this.calculateBoundingBox(); +// this.set("cellsMin", bounds.min.clone().add(this.get("cellsMin"))); +// var size = bounds.max.sub(bounds.min); +// +// //create array of nulls +// var cells = []; +// for (var x=0;x<size.x;x++){ +// cells.push([]); +// for (var y=0;y<size.y;y++){ +// cells[x].push([]); +// for (var z=0;z<size.z;z++){ +// cells[x][y].push(null); +// } +// } +// } +// +// var min = this.get("cellsMin").sub(bounds.min); +// var overlap = []; +// var forCAM = appState.get("currentNav") == "navAssemble"; +// this._loopCells(this.sparseCells, function(cell){ +// var overlappingCells = cell.addToDenseArray(cells, min, forCAM); +// if (overlappingCells) overlap = overlap.concat(overlappingCells); +// }); +// this.set("overlappingCells", overlap); +// +// this.cells = cells; +// }, highlightOverlappingCells: function(){ this._loopCells(this.sparseCells, function(cell){