Commit 2cc38209 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

gik rotations all in one place

parent bc60d28d
......@@ -19,9 +19,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell',
};
CompositeCell.prototype._rotateCell = function(object3D){
if (lattice.get("connectionType") == "gik") {
if (this.index.z %2 != 0) return object3D.rotateZ(Math.PI/2);
return object3D;
if (lattice._zIndexRotation) {
return object3D.rotateZ(lattice._zIndexRotation(this.index));
}
return DMASuperCell.prototype._rotateCell.call(this, object3D);
};
......
......@@ -35,7 +35,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell',
GIKSuperCell.prototype._rotateCell = function(object3D){
if (!this.index) return object3D;
if (this.index.z%2 != 0) object3D.rotateZ(Math.PI/2);
object3D.rotateZ(lattice._zIndexRotation(this.index));
return object3D;
};
......
......@@ -39,13 +39,12 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', '
_setRotation: function(direction){
if (lattice.get("connectionType") == "gik"){
if (lattice._zIndexRotation){
if (!this.highlightedObject) return;
var index = this.highlightedObject.getAbsoluteIndex();
if ((index.z%2 == 0 && Math.abs(direction.z) > 0.9) || (index.z%2 != 0 && Math.abs(direction.z) < 0.1))
this.mesh.rotation.set(0, 0, Math.PI/2);
else this.mesh.rotation.set(0,0,0);
if (Math.abs(direction.z) > 0.9) index.z+=1;
else if (Math.abs(direction.z) < 0.1) index.z -=1;
this.mesh.rotation.set(0,0, lattice._zIndexRotation(index));
}
var superCellIndex = appState.get("superCellIndex");
......
......@@ -43,6 +43,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
return 1.28*(1+2*cellSeparation);
},
_zIndexRotation: function(index){
if (index.z%2 != 0) return Math.PI/2;
return 0;
},
getCellSubclassFile: function(){
return "gikSuperCell";
},
......
......@@ -35,37 +35,34 @@ define(['three'], function(THREE){
camProcesses: ["gcode"],
numMaterials: 2,
translation: {x:-4.0757,y: -4.3432,z: -6.2154},
rotation: {x:Math.PI/2,y:0,z:0},
rotation: {x:Math.PI/2,y:0,z:0},//Math.PI/2
scale: 20,
components: {
xAxis: {
name: "X Axis",
name: "Y Axis",
rotary: false,
axisOfMotion: null,
//minBound
//maxBound
parent: "yAxis",
motionVector: {x:1, y:0, z:0},
motionVector: {x:0, y:1, z:0},
stl: {
filename: "assets/stls/stapler/xAxis.stl",
offset: {x:0,y:0,z:0},
scale: 1.0,
rotation: {x:0,y:0,z:0}
filename: "assets/stls/stapler/xAxis.stl"
// offset: {x:0,y:0,z:0},
// scale: 1.0,
// rotation: {x:0,y:0,z:0}
}
},
frame: {
name: "Y Axis",
name: "X Axis",
rotary: false,
axisOfMotion: null,
//minBound
//maxBound
parent: "substrate",
motionVector: {x:0, y:1, z:0},
motionVector: {x:1, y:0, z:0},
stl: {
filename: "assets/stls/stapler/yAxis.stl",
offset: {x:0,y:0,z:0},
scale: 1.0,
rotation: {x:0,y:0,z:0}
filename: "assets/stls/stapler/yAxis.stl"
}
},
zAxis: {
......@@ -77,10 +74,7 @@ define(['three'], function(THREE){
parent: "xAxis",
motionVector: {x:0, y:0, z:1},
stl: {
filename: "assets/stls/stapler/zAxis.stl",
offset: {x:0,y:0,z:0},
scale: 1.0,
rotation: {x:0,y:0,z:0}
filename: "assets/stls/stapler/zAxis.stl"
}
},
yAxis: {
......@@ -92,26 +86,20 @@ define(['three'], function(THREE){
parent: "frame",
isStatic: true,
stl: {
filename: "assets/stls/stapler/frame.stl",
offset: {x:0,y:0,z:0},
scale: 1.0,
rotation: {x:0,y:0,z:0}
filename: "assets/stls/stapler/frame.stl"
}
},
substrate: {
name: "Substrate",
rotary: true,
axisOfMotion: null,
centerOfRotation: {x:10,y:10,z:0},
centerOfRotation: {x:10,y:10,z:0},//(5.08mm, 5.715mm)
//minBound
//maxBound
parent: null,
motionVector: {x:0, y:0, z:1},
stl: {
filename: "assets/stls/stapler/substrate.stl",
offset: {x:0,y:0,z:0},
scale: 1.0,
rotation: {x:0,y:0,z:0}
filename: "assets/stls/stapler/substrate.stl"
}
}
},
......
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