From b1c7cc32b7eee0539eecb755989429a7fd0f8cfe Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 25 Feb 2015 12:08:45 -0500 Subject: [PATCH] clean up --- js/models/BasePlane.js | 14 ++++++++------ js/models/Lattice.js | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/js/models/BasePlane.js b/js/models/BasePlane.js index 3cbb141c..9bfd3633 100644 --- a/js/models/BasePlane.js +++ b/js/models/BasePlane.js @@ -142,8 +142,10 @@ OctaBasePlane = BasePlane.extend({ _calcOctaFaceVertices: function(colSep){ var vertices = []; - var latticeScale = 1+2*colSep; - var triangleHeight = latticeScale/2*Math.sqrt(3); + + var xScale = dmaGlobals.lattice.xScale(1); + var yScale = dmaGlobals.lattice.yScale(1); + var dimX = this.get("dimX"); var dimY = this.get("dimY"); @@ -157,12 +159,12 @@ OctaBasePlane = BasePlane.extend({ var xOffset = 0; if (Math.abs(j)%2==0) { } else { - xOffset = 1/2*latticeScale; + xOffset = 1/2*xScale; } - vertices.push(new THREE.Vector3(i*latticeScale + xOffset - horizontalOffset, j*triangleHeight + baseVertOffset, 0)); - vertices.push(new THREE.Vector3(i*latticeScale + xOffset + horizontalOffset, j*triangleHeight + baseVertOffset, 0)); - vertices.push(new THREE.Vector3(i*latticeScale + xOffset, j*triangleHeight - pointVertOffset, 0)); + vertices.push(new THREE.Vector3(i*xScale + xOffset - horizontalOffset, j*yScale + baseVertOffset, 0)); + vertices.push(new THREE.Vector3(i*xScale + xOffset + horizontalOffset, j*yScale + baseVertOffset, 0)); + vertices.push(new THREE.Vector3(i*xScale + xOffset, j*yScale - pointVertOffset, 0)); } diff --git a/js/models/Lattice.js b/js/models/Lattice.js index 5ffd611e..b9948e23 100644 --- a/js/models/Lattice.js +++ b/js/models/Lattice.js @@ -375,11 +375,11 @@ Lattice = Backbone.Model.extend({ _initLatticeType: function(){ //bind events + this.set("columnSeparation", 0.0); this.listenTo(this, "change:columnSeparation", this._changeColSeparation); this.set("basePlane", new OctaBasePlane({scale:this.get("scale")})); this.set("highlighter", new OctaFaceHighlighter({scale:this.get("scale")})); - this.set("columnSeparation", 0.0); }, _changeColSeparation: function(){ @@ -452,11 +452,11 @@ Lattice = Backbone.Model.extend({ _initLatticeType: function(){ //bind events + this.set("columnSeparation", 0.0); this.listenTo(this, "change:columnSeparation", this._changeColSeparation); this.set("basePlane", new OctaBasePlane({scale:this.get("scale")})); this.set("highlighter", new OctaFaceHighlighter({scale:this.get("scale")})); - this.set("columnSeparation", 0.0); }, _changeColSeparation: function(){ -- GitLab