From b5c90e7b7f0fa3a2e5752d56f2c40317d6e02b71 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 10 Mar 2015 17:16:50 -0400 Subject: [PATCH] cleanup, no rot edge conn --- js/fea/DmaCell.js | 8 ++++++++ js/fea/DmaCellOcta.js | 24 +----------------------- js/fea/DmaCellTetra.js | 14 -------------- js/models/AppState.js | 2 +- 4 files changed, 10 insertions(+), 38 deletions(-) diff --git a/js/fea/DmaCell.js b/js/fea/DmaCell.js index 0671a277..5e61bf1e 100644 --- a/js/fea/DmaCell.js +++ b/js/fea/DmaCell.js @@ -224,6 +224,14 @@ DMAFreeFormCell.prototype._calcPosition = function(){ return position; }; +DMAFreeFormCell.prototype.calcHighlighterPosition = function(face){ + var direction = face.normal.clone(); + direction.applyQuaternion(this.cellMesh.quaternion); + var position = this.getPosition(); + position.add(direction.clone().multiplyScalar(this.zScale()/2)); + return {index: _.clone(this.indices), direction:direction, position:position}; +}; + DMAFreeFormCell.prototype.toJSON = function(){ var json = DMACell.prototype.toJSON.call(this); _.extend(json, { diff --git a/js/fea/DmaCellOcta.js b/js/fea/DmaCellOcta.js index b11f60ac..39b78487 100644 --- a/js/fea/DmaCellOcta.js +++ b/js/fea/DmaCellOcta.js @@ -34,9 +34,7 @@ DMAFaceOctaCell.prototype._doMeshTransformations = function(mesh){ }; DMAFaceOctaCell.prototype.calcHighlighterPosition = function(face){ - if (face.normal.z<0.99) return {index: _.clone(this.indices)};//only highlight horizontal faces - var direction = face.normal; var position = this.getPosition(); position.z += face.normal.z*this.zScale()/2; @@ -76,19 +74,6 @@ DMAFreeFormOctaCell.prototype._doMeshTransformations = function(mesh){ mesh.rotation.set(eulerRot.x, eulerRot.y, eulerRot.z); }; -DMAFreeFormOctaCell.prototype.calcHighlighterPosition = function(face){ - var direction = face.normal.clone(); - direction.applyQuaternion(this.cellMesh.quaternion); - - var position = this.getPosition(); - var zScale = this.zScale(); - position.x += direction.x*zScale/2; - position.y += direction.y*zScale/2; - position.z += direction.z*zScale/2; - - return {index: _.clone(this.indices), direction:direction, position:position}; -}; - DMAFreeFormOctaCell.prototype._initParts = function(){ var parts = []; for (var i=0;i<3;i++){ @@ -123,13 +108,8 @@ DMAEdgeOctaCell.prototype._doMeshTransformations = function(){}; DMAEdgeOctaCell.prototype.calcHighlighterPosition = function(face){ var direction = face.normal.clone(); direction.applyQuaternion(this.cellMesh.quaternion); - var position = this.getPosition(); - var zScale = this.zScale(); - position.x += direction.x*zScale/2; - position.y += direction.y*zScale/2; - position.z += direction.z*zScale/2; - + position.add(direction.clone().multiplyScalar(this.zScale()/2)); return {index: _.clone(this.indices), direction:direction, position:position}; }; @@ -204,8 +184,6 @@ DMARotatedEdgeCell.prototype.calcHighlighterPosition = function(face, point){ if (point.y > position.y) direction.y = 1; else direction.y = -1; } - - position.x += direction.x*this.xScale()/2; position.y += direction.y*this.yScale()/2; } diff --git a/js/fea/DmaCellTetra.js b/js/fea/DmaCellTetra.js index 79a92dae..0ad033a9 100644 --- a/js/fea/DmaCellTetra.js +++ b/js/fea/DmaCellTetra.js @@ -79,20 +79,6 @@ DMAFreeFormTetraCell.prototype._doMeshTransformations = function(mesh){ mesh.rotation.set(eulerRot.x, eulerRot.y, eulerRot.z); }; -DMAFreeFormTetraCell.prototype.calcHighlighterPosition = function(face){ - - var direction = face.normal.clone(); - direction.applyQuaternion(this.cellMesh.quaternion); - - var position = this.getPosition(); - var zScale = this.zScale(); - position.x += direction.x*zScale/2; - position.y += direction.y*zScale/2; - position.z += direction.z*zScale/2; - - return {index: _.clone(this.indices), direction:direction, position:position}; -}; - DMAFreeFormTetraCell.prototype.getType = function(){ return "tetra"; }; diff --git a/js/models/AppState.js b/js/models/AppState.js index 347ed247..abb11d67 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -20,7 +20,7 @@ AppState = Backbone.Model.extend({ allCellTypes: {octa:"Octahedron", cube:"Cube", truncatedCube:"Truncated Cube", kelvin:"Kelvin (coming soon)"}, allConnectionTypes: { - octa: {face:"Face", freeformFace:"Freeform Face", edge:"Edge", edgeRot:"Rotated Edge", vertex:"Vertex"}, + octa: {face:"Face", freeformFace:"Freeform Face", edgeRot:"Edge", vertex:"Vertex"},//edge:"Edge", cube: {face:"Face"}, truncatedCube: {face:"Face"}, kelvin: {face: "Face"} -- GitLab