diff --git a/js/fea/DmaCell.js b/js/fea/DmaCell.js index c894dd78b0169d44c70a3b574ff6215f9e4eef1b..a725a9a29a2c91008969d02a5bcbef3717b21215 100644 --- a/js/fea/DmaCell.js +++ b/js/fea/DmaCell.js @@ -76,6 +76,10 @@ DMACell.prototype.getOrientation = function(){ return this.cellMesh.quaternion.clone(); }; +DMACell.prototype.getEulerRotation = function(){ + return this.cellMesh.rotation.clone(); +}; + DMACell.prototype._calcPosition = function(){//need for part relay if (this.isInverse) return dmaGlobals.lattice.getInvCellPositionForIndex(this.indices); return dmaGlobals.lattice.getPositionForIndex(this.indices); @@ -147,7 +151,7 @@ DMACell.prototype.toJSON = function(){ DMAFaceOctaCell.prototype._initParts = function(){ var parts = []; for (var i=0;i<3;i++){ - parts.push(new DMATrianglePart(i, this.indices.z%2==1, this)); + parts.push(new DMATrianglePart(i, this)); } return parts; }; diff --git a/js/fea/DmaPart.js b/js/fea/DmaPart.js index 36b436533852eb7f6caf829a38ba2c3cbc4abcf2..6f4971237af73cc8f15f3ee216c1fed87d89f823 100644 --- a/js/fea/DmaPart.js +++ b/js/fea/DmaPart.js @@ -5,9 +5,8 @@ //a part, element with a single material, handled by assembler - function DMAPart(type, oddZFlag, parent) { + function DMAPart(type, parent) { this.parentCell = parent;//use this reference to get position and scale - this.oddZFlag = oddZFlag;//this tells me if cell is at an odd z height in lattice, everything needs to rotate 180 this.type = type; } @@ -71,7 +70,6 @@ this.mesh = null; } this.parentCell = null; - this.oddZFlag = null; this.type = null; }; @@ -122,8 +120,8 @@ var partMaterial = new THREE.MeshLambertMaterial({ color:0xffffff, shading: THREE.FlatShading }); partMaterial.color.setRGB( 0.9619657144369509, 0.6625466032079207, 0.20799727886007258 ); - function DMATrianglePart(type, oddZFlag, parent){ - DMAPart.call(this, type, oddZFlag, parent); + function DMATrianglePart(type, parent){ + DMAPart.call(this, type, parent); } DMATrianglePart.prototype = Object.create(DMAPart.prototype); @@ -131,19 +129,21 @@ var mesh; switch(type){ case 0: - if (this.oddZFlag) mesh = new THREE.Mesh(unitPartGeo4, partMaterial.clone()); - else mesh = new THREE.Mesh(unitPartGeo1, partMaterial.clone()); +// if (this.oddZFlag) mesh = new THREE.Mesh(unitPartGeo4, partMaterial.clone()); + mesh = new THREE.Mesh(unitPartGeo1, partMaterial.clone()); break; case 1: - if (this.oddZFlag) mesh = new THREE.Mesh(unitPartGeo5, partMaterial.clone()); - else mesh = new THREE.Mesh(unitPartGeo2, partMaterial.clone()); +// if (this.oddZFlag) mesh = new THREE.Mesh(unitPartGeo5, partMaterial.clone()); + mesh = new THREE.Mesh(unitPartGeo2, partMaterial.clone()); break; case 2: - if (this.oddZFlag) mesh = new THREE.Mesh(unitPartGeo6, partMaterial.clone()); - else mesh = new THREE.Mesh(unitPartGeo3, partMaterial.clone()); +// if (this.oddZFlag) mesh = new THREE.Mesh(unitPartGeo6, partMaterial.clone()); + mesh = new THREE.Mesh(unitPartGeo3, partMaterial.clone()); break; } mesh.myPart = this;//need a ref back to this part + var rotation = this.parentCell.getEulerRotation(); + mesh.rotation.set(rotation.x, rotation.y, rotation.z); return mesh; };