Commit 7d0b320f authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

fixed parsing bug

parent cd290954
...@@ -125,7 +125,7 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti ...@@ -125,7 +125,7 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti
//offset for rotation //offset for rotation
var offset = self.components.substrate.centerOfRotation.clone().multiplyScalar(settings.scale);//offset in lattice pitch var offset = self.components.substrate.centerOfRotation.clone().multiplyScalar(settings.scale);//offset in lattice pitch
var dist = position.clone().sub(offset); var dist = position.clone().sub(offset);
position = offset.add(new THREE.Vector3(-dist.y-3*settings.scale, dist.x-0.335, position.z)); position = offset.add(new THREE.Vector3(-dist.y, dist.x-0.335, position.z));
} else { } else {
position.y -= 1; position.y -= 1;
position.x -= settings.scale; position.x -= settings.scale;
...@@ -217,6 +217,7 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti ...@@ -217,6 +217,7 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti
if (!cell) return; if (!cell) return;
var cellPosition = cell.getAbsolutePosition().multiplyScalar(settings.scale); var cellPosition = cell.getAbsolutePosition().multiplyScalar(settings.scale);
if (cell.getMinPosition) cellPosition = cell.getMinPosition().multiplyScalar(settings.scale);
var cellIndex = cell.getAbsoluteIndex(); var cellIndex = cell.getAbsoluteIndex();
if (!self.shouldPickUpStock){ if (!self.shouldPickUpStock){
......
...@@ -135,7 +135,7 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){ ...@@ -135,7 +135,7 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){
}; };
Component.prototype.applyRotation = function(vector){//todo local rotation? Component.prototype.applyRotation = function(vector){//todo local rotation?
vector.applyQuaternion(this.getAbsoluteOrientation()); vector.applyQuaternion(this.getOrientation());
return vector; return vector;
}; };
......
...@@ -126,7 +126,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' ...@@ -126,7 +126,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', '
}; };
DMACell.prototype.applyRotation = function(vector){//todo local rotation? DMACell.prototype.applyRotation = function(vector){//todo local rotation?
vector.applyQuaternion(this.getAbsoluteOrientation()); vector.applyQuaternion(this.getOrientation());
return vector; return vector;
}; };
......
...@@ -49,6 +49,15 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', ...@@ -49,6 +49,15 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell',
return unitGeos[key]; return unitGeos[key];
}; };
GIKSuperCell.prototype.getMinPosition = function(){//for assembly
var position = this.getAbsolutePosition();
var oppPosition = this.applyAbsoluteRotation(new THREE.Vector3(3,0,0));
oppPosition.add(position);
position.x = Math.min(position.x, oppPosition.x);
position.y = Math.max(position.y, oppPosition.y);
return position;
};
GIKSuperCell.prototype._buildWireframe = function(mesh){ GIKSuperCell.prototype._buildWireframe = function(mesh){
var wireframe = new THREE.BoxHelper(mesh); var wireframe = new THREE.BoxHelper(mesh);
wireframe.material.color.set(0x000000); wireframe.material.color.set(0x000000);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment