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

stacked octas

parent a673d24a
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'],
var unitGeo = new THREE.TetrahedronGeometry(Math.sqrt(3/8));
unitGeo.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI/4));
unitGeo.applyMatrix(new THREE.Matrix4().makeRotationX((Math.PI-Math.atan(2*Math.sqrt(2)))/2));
unitGeo.applyMatrix(new THREE.Matrix4().makeTranslation(0,0,Math.sqrt(3/8)-1/Math.sqrt(6)));
unitGeo.applyMatrix(new THREE.Matrix4().makeTranslation(0,0,Math.sqrt(3/8)-2/Math.sqrt(6)));
unitGeo.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI));
function TetraStackedCell(index, superCell){
DMACell.call(this, index, superCell);
......@@ -21,9 +22,22 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'],
};
TetraStackedCell.prototype._rotateCell = function(object3D){
if (this.index.z%2 != 0) object3D.rotateX(Math.PI);
var absIndex = this.getAbsoluteIndex();
if (absIndex.z%2 != 0) object3D.rotateX(Math.PI);
var mod4 = absIndex.z%4;
if (mod4 > 1 || (mod4 < 0 && mod4 > -3)) object3D.rotateZ(Math.PI);
return object3D;
};
TetraStackedCell.prototype.calcHighlighterParams = function(face){
var direction = face.normal;
if (direction.z<-0.95) direction = new THREE.Vector3(0,0,-1);
else direction = new THREE.Vector3(0,0,1);
direction.applyQuaternion(this.getAbsoluteOrientation());
var position = this.getAbsolutePosition();
position.z += direction.z*this.zScale()/2;
return {position:position, direction: direction};
};
return TetraStackedCell;
});
\ No newline at end of file
......@@ -16,14 +16,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th
});
},
// getIndexForPosition: function(absPosition){
// return this._indexForPosition(absPosition);
// },
//
// getPositionForIndex: function(index){
// return this._positionForIndex(index);
// },
getIndexForPosition: function(absPosition){
var yIndex = Math.floor(absPosition.y/this.yScale());
if (yIndex%2 != 0) absPosition.x += this.xScale()/2;
......
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