Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
AMOEBA
Commits
c031e835
Commit
c031e835
authored
Jul 06, 2016
by
amandaghassaei
Browse files
mechanical sim is relatively happy
parent
ac2e1171
Changes
2
Hide whitespace changes
Inline
Side-by-side
js/plists/MaterialsPlist.js
View file @
c031e835
...
...
@@ -31,10 +31,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
bending1DOF
:
{
...
...
@@ -46,10 +46,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
5
0
0
,
z
:
30
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
30
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
bending2DOF
:
{
...
...
@@ -61,10 +61,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
30
,
z
:
30
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
30
,
z
:
30
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
torsion1DOF
:
{
...
...
@@ -76,10 +76,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
5
0
0
,
z
:
30
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
30
}
}
},
shear1DOF
:
{
...
...
@@ -90,10 +90,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
10
,
xz
:
5
0
0
,
yx
:
50
0
,
yz
:
50
0
,
zx
:
5
0
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
10
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
isoFlex
:
{
...
...
@@ -103,7 +103,7 @@ define([], function(){
texture
:
"
stripes
"
,
properties
:{
conductive
:
false
,
density
:
8
500
,
//kg/m^3
density
:
3
500
,
//kg/m^3
longitudalK
:{
x
:
10
,
y
:
10
,
z
:
10
},
shearK
:{
xy
:
10
,
xz
:
10
,
yx
:
10
,
yz
:
10
,
zx
:
10
,
zy
:
10
},
bendingK
:{
x
:
10
,
y
:
10
,
z
:
10
},
...
...
@@ -118,10 +118,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
conductiveBend
:{
...
...
@@ -132,10 +132,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
conductiveJunction1
:{
...
...
@@ -146,10 +146,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
conductiveJunction2
:{
...
...
@@ -160,10 +160,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
flexureCond
:
{
...
...
@@ -205,10 +205,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
flexureCondJunction2
:{
...
...
@@ -220,10 +220,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
actuatorLinear1DOF
:
{
...
...
@@ -234,10 +234,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
actuatorBending1DOF
:
{
...
...
@@ -248,10 +248,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
actuatorTorsion1DOF
:
{
...
...
@@ -262,10 +262,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
actuatorShear
:
{
...
...
@@ -276,10 +276,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
signal
:
{
...
...
@@ -290,10 +290,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
},
script
:
{
...
...
@@ -304,10 +304,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
shearK
:{
xy
:
5
0
0
,
xz
:
50
0
,
yx
:
5
0
0
,
yz
:
5
0
0
,
zx
:
50
0
,
zy
:
5
0
0
},
bendingK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
},
torsionK
:{
x
:
5
0
0
,
y
:
50
0
,
z
:
5
0
0
}
longitudalK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
shearK
:{
xy
:
1
50
,
xz
:
1
50
,
yx
:
1
50
,
yz
:
1
50
,
zx
:
1
50
,
zy
:
1
50
},
bendingK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
},
torsionK
:{
x
:
1
50
,
y
:
1
50
,
z
:
1
50
}
}
}
},
...
...
js/simulation/function/EM/emSimLattice.js
View file @
c031e835
...
...
@@ -674,39 +674,31 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G
//todo this is causing instability
//bending and torsion
//var quaternionDiff = this._multiplyQuaternions(this._invertQuaternion(quaternion), neighborQuaternion);
//var diffEuler = this._eulerFromQuaternion(quaternionDiff);
//for (var _axis=0;_axis<3;_axis++) {
// if (_axis == neighborAxis){
// rForce[_axis] += 0.00001*torsionK[_axis]*(diffEuler[_axis]);// + torsionD[_axis]*(neighborAngVelocity[_axis]-angVelocity[_axis]);
// } else {
// rForce[_axis] += 0.00001*bendingK[_axis]*(diffEuler[_axis]);// + bendingD[_axis]*(neighborAngVelocity[_axis]-angVelocity[_axis]);
// }
//}
//console.log(rotation);
//console.log(neighborRotation);
//console.log(angVelocity);
//console.log(neighborAngVelocity);
//console.log(quaternion);
//console.log(rForce);
//console.log("");
var
quaternionDiff
=
this
.
_multiplyQuaternions
(
this
.
_invertQuaternion
(
quaternion
),
neighborQuaternion
);
var
diffEuler
=
this
.
_eulerFromQuaternion
(
quaternionDiff
);
for
(
var
_axis
=
0
;
_axis
<
3
;
_axis
++
)
{
if
(
_axis
==
neighborAxis
){
rForce
[
_axis
]
+=
0.00001
*
torsionK
[
_axis
]
*
(
diffEuler
[
_axis
]);
// + torsionD[_axis]*(neighborAngVelocity[_axis]-angVelocity[_axis]);
}
else
{
rForce
[
_axis
]
+=
0.00001
*
bendingK
[
_axis
]
*
(
diffEuler
[
_axis
]);
// + bendingD[_axis]*(neighborAngVelocity[_axis]-angVelocity[_axis]);
}
}
}
//
//simple collision detection
//
var zPosition = this.originalPosition[rgbaIndex+2]+translation[2]*multiplier-groundHeight;
//
var collisionK = 1;
//
if (zPosition<0) {
//
var normalForce = -zPosition*collisionK-velocity[2]*collisionK/10;
//
force[2] += normalForce;
//
if (friction) {
//
var mu = 10;
//
if (velocity[0] > 0) force[0] -= mu * normalForce;
//
else if (velocity[0] < 0) force[0] += mu * normalForce;
//
if (velocity[1] > 0) force[1] -= mu * normalForce;
//
else if (velocity[1] < 0) force[1] += mu * normalForce;
//
}
//
}
//simple collision detection
var
zPosition
=
this
.
originalPosition
[
rgbaIndex
+
2
]
+
translation
[
2
]
*
multiplier
-
groundHeight
;
var
collisionK
=
1
;
if
(
zPosition
<
0
)
{
var
normalForce
=
-
zPosition
*
collisionK
-
velocity
[
2
]
*
collisionK
/
10
;
force
[
2
]
+=
normalForce
;
if
(
friction
)
{
var
mu
=
10
;
if
(
velocity
[
0
]
>
0
)
force
[
0
]
-=
mu
*
normalForce
;
else
if
(
velocity
[
0
]
<
0
)
force
[
0
]
+=
mu
*
normalForce
;
if
(
velocity
[
1
]
>
0
)
force
[
1
]
-=
mu
*
normalForce
;
else
if
(
velocity
[
1
]
<
0
)
force
[
1
]
+=
mu
*
normalForce
;
}
}
var
acceleration
=
[
force
[
0
]
/
mass
,
force
[
1
]
/
mass
,
force
[
2
]
/
mass
];
velocity
=
[
velocity
[
0
]
+
acceleration
[
0
]
*
dt
,
velocity
[
1
]
+
acceleration
[
1
]
*
dt
,
velocity
[
2
]
+
acceleration
[
2
]
*
dt
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment