From 917c99ad8ea1ea2ef19df06dfd39d83a4398432c Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Mon, 9 Mar 2015 18:06:37 -0400 Subject: [PATCH] done refactoring cell classes --- js/fea/DmaCellOcta.js | 8 ++++---- js/fea/DmaCellTetra.js | 23 ++++------------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/js/fea/DmaCellOcta.js b/js/fea/DmaCellOcta.js index 7b7194ea..39a9e44d 100644 --- a/js/fea/DmaCellOcta.js +++ b/js/fea/DmaCellOcta.js @@ -76,10 +76,6 @@ DMAFreeFormOctaCell.prototype._doMeshTransformations = function(mesh){ mesh.rotation.set(eulerRot.x, eulerRot.y, eulerRot.z); }; -DMAFreeFormOctaCell.prototype.getType = function(){ - return "octa"; -}; - DMAFreeFormOctaCell.prototype.calcHighlighterPosition = function(face){ var direction = face.normal.clone(); direction.applyQuaternion(this.cellMesh.quaternion); @@ -93,6 +89,10 @@ DMAFreeFormOctaCell.prototype.calcHighlighterPosition = function(face){ return {index: _.clone(this.indices), direction:direction, position:position}; }; +DMAFreeFormOctaCell.prototype.getType = function(){ + return "octa"; +}; + DMAFreeFormOctaCell.prototype.zScale = function(scale){ if (!scale) scale = dmaGlobals.lattice.get("scale"); return 2*scale/Math.sqrt(6); diff --git a/js/fea/DmaCellTetra.js b/js/fea/DmaCellTetra.js index 16d830f4..3d18272c 100644 --- a/js/fea/DmaCellTetra.js +++ b/js/fea/DmaCellTetra.js @@ -43,21 +43,6 @@ DMATetraEdgeCell.prototype = Object.create(DMATetraFaceCell.prototype); DMATetraEdgeCell.prototype._doMeshTransformations = function(){}; -DMATetraEdgeCell.prototype.calcHighlighterPosition = function(face){ - - //todo finish this - var direction = face.normal; - if (face.normal.z<0.99) direction = null;//only highlight horizontal faces - var index = _.clone(this.indices); - index.z = Math.floor(index.z/2); - index.x = Math.floor(index.x/3); - index.y = Math.floor(index.y/2); - var position = dmaGlobals.lattice.getInvCellPositionForIndex(index); - position.z += dmaGlobals.lattice.zScale(); - return {index: _.clone(this.indices), direction:direction, position:position}; -}; - - /////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////FREEFORM CONNECTED///////////////////////////////////////////////////// @@ -77,10 +62,6 @@ DMAFreeFormTetraCell.prototype._buildCellMesh = function(){//abstract mesh repre return this._superBuildCellMesh(unitCellGeo2); }; -DMAFreeFormTetraCell.prototype.getType = function(){ - return "tetra"; -}; - DMAFreeFormTetraCell.prototype._doMeshTransformations = function(mesh){ var direction = this.parentDirection.clone(); var zAxis = new THREE.Vector3(0,0,1); @@ -112,6 +93,10 @@ DMAFreeFormTetraCell.prototype.calcHighlighterPosition = function(face){ return {index: _.clone(this.indices), direction:direction, position:position}; }; +DMAFreeFormTetraCell.prototype.getType = function(){ + return "tetra"; +}; + DMAFreeFormTetraCell.prototype.zScale = function(scale){ if (!scale) scale = dmaGlobals.lattice.get("scale"); return 2*scale/Math.sqrt(24); -- GitLab