diff --git a/js/cam/assemblers/AssemblerPost.js b/js/cam/assemblers/AssemblerPost.js index 13757e2ebb540c1c0c6b7d6858b48b9241067e2c..909853d11289f6da50ea7dfc6134e16184839049 100644 --- a/js/cam/assemblers/AssemblerPost.js +++ b/js/cam/assemblers/AssemblerPost.js @@ -125,7 +125,7 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti //offset for rotation var offset = self.components.substrate.centerOfRotation.clone().multiplyScalar(settings.scale);//offset in lattice pitch 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 { position.y -= 1; position.x -= settings.scale; @@ -217,6 +217,7 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti if (!cell) return; var cellPosition = cell.getAbsolutePosition().multiplyScalar(settings.scale); + if (cell.getMinPosition) cellPosition = cell.getMinPosition().multiplyScalar(settings.scale); var cellIndex = cell.getAbsoluteIndex(); if (!self.shouldPickUpStock){ diff --git a/js/cam/assemblers/Component.js b/js/cam/assemblers/Component.js index 0073567d746f002dc10c8f421b156ff9e4c1e5a4..e67e7b0fc9e9f37595079075e2964f2380c232fe 100644 --- a/js/cam/assemblers/Component.js +++ b/js/cam/assemblers/Component.js @@ -135,7 +135,7 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){ }; Component.prototype.applyRotation = function(vector){//todo local rotation? - vector.applyQuaternion(this.getAbsoluteOrientation()); + vector.applyQuaternion(this.getOrientation()); return vector; }; diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index cd23094060b757f994072a788fd3448dcae4f69e..8400570a43ebc01bbc918a5de7811dc80ea8056b 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -126,7 +126,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' }; DMACell.prototype.applyRotation = function(vector){//todo local rotation? - vector.applyQuaternion(this.getAbsoluteOrientation()); + vector.applyQuaternion(this.getOrientation()); return vector; }; diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js index 6161eeffe41fc71a5e5ef713014294c84b81718a..3738fc66094deec03147c4404c25458ea05b02a7 100644 --- a/js/cells/supercells/GIKSuperCell.js +++ b/js/cells/supercells/GIKSuperCell.js @@ -49,6 +49,15 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', 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){ var wireframe = new THREE.BoxHelper(mesh); wireframe.material.color.set(0x000000);