Skip to content
Snippets Groups Projects
Commit 917c99ad authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

done refactoring cell classes

parent 0d40549d
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment