Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Amanda Ghassaei
AMOEBA
Commits
6495bba7
Commit
6495bba7
authored
Jul 09, 2016
by
amandaghassaei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sim is stabilizing, debugging
parent
e7fd44b6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
107 deletions
+119
-107
js/plists/MaterialsPlist.js
js/plists/MaterialsPlist.js
+68
-68
js/simulation/function/EM/emSimLattice.js
js/simulation/function/EM/emSimLattice.js
+51
-39
No files found.
js/plists/MaterialsPlist.js
View file @
6495bba7
...
...
@@ -31,10 +31,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
bending1DOF
:
{
...
...
@@ -46,10 +46,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
30
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
1
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
bending2DOF
:
{
...
...
@@ -61,10 +61,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
30
,
z
:
30
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
1
,
z
:
1
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
torsion1DOF
:
{
...
...
@@ -76,10 +76,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
30
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
1
}
}
},
shear1DOF
:
{
...
...
@@ -90,10 +90,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
3500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
1
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
1
50
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
80
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
1
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
isoFlex
:
{
...
...
@@ -118,10 +118,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
conductiveBend
:{
...
...
@@ -132,10 +132,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
conductiveJunction1
:{
...
...
@@ -146,10 +146,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
conductiveJunction2
:{
...
...
@@ -160,10 +160,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
flexureCond
:
{
...
...
@@ -205,10 +205,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
flexureCondJunction2
:{
...
...
@@ -220,10 +220,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
8500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
actuatorLinear1DOF
:
{
...
...
@@ -234,10 +234,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
actuatorBending1DOF
:
{
...
...
@@ -248,10 +248,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
actuatorTorsion1DOF
:
{
...
...
@@ -262,10 +262,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
actuatorShear
:
{
...
...
@@ -276,10 +276,10 @@ define([], function(){
properties
:{
conductive
:
false
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
signal
:
{
...
...
@@ -290,10 +290,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
},
script
:
{
...
...
@@ -304,10 +304,10 @@ define([], function(){
properties
:{
conductive
:
true
,
density
:
6500
,
//kg/m^3
longitudalK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
shearK
:{
xy
:
15
0
,
xz
:
15
0
,
yx
:
15
0
,
yz
:
15
0
,
zx
:
15
0
,
zy
:
15
0
},
bendingK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
},
torsionK
:{
x
:
15
0
,
y
:
15
0
,
z
:
15
0
}
longitudalK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
shearK
:{
xy
:
8
0
,
xz
:
8
0
,
yx
:
8
0
,
yz
:
8
0
,
zx
:
8
0
,
zy
:
8
0
},
bendingK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
},
torsionK
:{
x
:
8
0
,
y
:
8
0
,
z
:
8
0
}
}
}
},
...
...
js/simulation/function/EM/emSimLattice.js
View file @
6495bba7
...
...
@@ -221,7 +221,7 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G
_getRotatedAxis
:
function
(
_axis
,
_cell
){
var
vector
=
new
THREE
.
Vector3
();
vector
[
_axis
]
=
1
;
vector
.
applyQuaternion
(
_cell
.
getOrientation
());
vector
.
applyQuaternion
(
_cell
.
getOrientation
()
.
inverse
()
);
if
(
Math
.
abs
(
vector
.
x
)
>
0.9
)
return
"
x
"
;
if
(
Math
.
abs
(
vector
.
y
)
>
0.9
)
return
"
y
"
;
if
(
Math
.
abs
(
vector
.
z
)
>
0.9
)
return
"
z
"
;
...
...
@@ -615,24 +615,24 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G
var
wiring
=
[
this
.
wires
[
rgbaIndex
],
this
.
wires
[
rgbaIndex
+
1
],
this
.
wires
[
rgbaIndex
+
2
],
this
.
wires
[
rgbaIndex
+
3
]];
var
isActuator
=
wiring
[
0
]
==
-
1
;
for
(
var
j
=
0
;
j
<
6
;
j
++
){
for
(
var
j
=
0
;
j
<
6
;
j
++
)
{
var
_force
=
[
0
,
0
,
0
];
var
_force
=
[
0
,
0
,
0
];
var
neighborsIndex
=
i
*
8
;
if
(
j
>
2
)
neighborsIndex
+=
4
;
if
(
this
.
neighborsXMapping
[
neighborsIndex
+
j
%
3
]
<
0
)
continue
;
var
neighborsIndex
=
i
*
8
;
if
(
j
>
2
)
neighborsIndex
+=
4
;
if
(
this
.
neighborsXMapping
[
neighborsIndex
+
j
%
3
]
<
0
)
continue
;
var
neighborIndex
=
4
*
(
this
.
neighborsXMapping
[
neighborsIndex
+
j
%
3
]
+
this
.
textureSize
[
0
]
*
this
.
neighborsYMapping
[
neighborsIndex
+
j
%
3
]);
var
neighborTranslation
=
[
this
.
lastTranslation
[
neighborIndex
],
this
.
lastTranslation
[
neighborIndex
+
1
],
this
.
lastTranslation
[
neighborIndex
+
2
]];
var
neighborVelocity
=
[
this
.
lastVelocity
[
neighborIndex
],
this
.
lastVelocity
[
neighborIndex
+
1
],
this
.
lastVelocity
[
neighborIndex
+
2
]];
var
neighborQuaternion
=
[
this
.
lastQuaternion
[
neighborIndex
],
this
.
lastQuaternion
[
neighborIndex
+
1
],
this
.
lastQuaternion
[
neighborIndex
+
2
],
this
.
lastQuaternion
[
neighborIndex
+
3
]];
var
neighborRotation
=
[
this
.
lastTranslation
[
neighborIndex
+
4
*
textureSize
],
this
.
lastTranslation
[
neighborIndex
+
1
+
4
*
textureSize
],
this
.
lastTranslation
[
neighborIndex
+
2
+
4
*
textureSize
]];
var
neighborAngVelocity
=
[
this
.
lastVelocity
[
neighborIndex
+
4
*
textureSize
],
this
.
lastVelocity
[
neighborIndex
+
1
+
4
*
textureSize
],
this
.
lastVelocity
[
neighborIndex
+
2
+
4
*
textureSize
]];
var
neighborIndex
=
4
*
(
this
.
neighborsXMapping
[
neighborsIndex
+
j
%
3
]
+
this
.
textureSize
[
0
]
*
this
.
neighborsYMapping
[
neighborsIndex
+
j
%
3
]);
var
neighborTranslation
=
[
this
.
lastTranslation
[
neighborIndex
],
this
.
lastTranslation
[
neighborIndex
+
1
],
this
.
lastTranslation
[
neighborIndex
+
2
]];
var
neighborVelocity
=
[
this
.
lastVelocity
[
neighborIndex
],
this
.
lastVelocity
[
neighborIndex
+
1
],
this
.
lastVelocity
[
neighborIndex
+
2
]];
var
neighborQuaternion
=
[
this
.
lastQuaternion
[
neighborIndex
],
this
.
lastQuaternion
[
neighborIndex
+
1
],
this
.
lastQuaternion
[
neighborIndex
+
2
],
this
.
lastQuaternion
[
neighborIndex
+
3
]];
var
neighborRotation
=
[
this
.
lastTranslation
[
neighborIndex
+
4
*
textureSize
],
this
.
lastTranslation
[
neighborIndex
+
1
+
4
*
textureSize
],
this
.
lastTranslation
[
neighborIndex
+
2
+
4
*
textureSize
]];
var
neighborAngVelocity
=
[
this
.
lastVelocity
[
neighborIndex
+
4
*
textureSize
],
this
.
lastVelocity
[
neighborIndex
+
1
+
4
*
textureSize
],
this
.
lastVelocity
[
neighborIndex
+
2
+
4
*
textureSize
]];
//var nominalD = this._neighborOffset(j, latticePitch);
//var actuatedD = [nominalD[0], nominalD[1], nominalD[2]];
var
neighborAxis
=
Math
.
floor
(
j
/
2
);
var
neighborAxis
=
Math
.
floor
(
j
/
2
);
//var actuation = 0;
//if (isActuator && wiring[neighborAxis+1]>0) {
// actuation += 0.3*this._getActuatorVoltage(wiring[neighborAxis+1]-1, time);
...
...
@@ -644,16 +644,16 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G
//actuatedD[neighborAxis] *= 1+actuation;
//todo don't need all these at once
var
longitudalK
=
[
this
.
compositeKs
[
neighborsIndex
+
j
%
3
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
2
*
textureSize
*
8
]];
var
bendingK
=
[
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
3
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
4
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
5
*
textureSize
*
8
]];
var
torsionK
=
[
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
6
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
7
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
8
*
textureSize
*
8
]];
var
shearK
=
[
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
9
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
10
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
11
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
12
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
13
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
14
*
textureSize
*
8
]];
var
longitudalD
=
[
this
.
compositeDs
[
neighborsIndex
+
j
%
3
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
2
*
textureSize
*
8
]];
var
bendingD
=
[
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
3
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
4
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
5
*
textureSize
*
8
]];
var
torsionD
=
[
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
6
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
7
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
8
*
textureSize
*
8
]];
var
shearD
=
[
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
9
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
10
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
11
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
12
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
13
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
14
*
textureSize
*
8
]];
var
longitudalK
=
[
this
.
compositeKs
[
neighborsIndex
+
j
%
3
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
2
*
textureSize
*
8
]];
var
bendingK
=
[
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
3
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
4
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
5
*
textureSize
*
8
]];
var
torsionK
=
[
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
6
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
7
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
8
*
textureSize
*
8
]];
var
shearK
=
[
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
9
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
10
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
11
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
12
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
13
*
textureSize
*
8
],
this
.
compositeKs
[
neighborsIndex
+
j
%
3
+
14
*
textureSize
*
8
]];
var
longitudalD
=
[
this
.
compositeDs
[
neighborsIndex
+
j
%
3
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
2
*
textureSize
*
8
]];
var
bendingD
=
[
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
3
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
4
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
5
*
textureSize
*
8
]];
var
torsionD
=
[
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
6
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
7
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
8
*
textureSize
*
8
]];
var
shearD
=
[
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
9
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
10
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
11
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
12
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
13
*
textureSize
*
8
],
this
.
compositeDs
[
neighborsIndex
+
j
%
3
+
14
*
textureSize
*
8
]];
//convert translational offsets to correct reference frame
var
nominalD
=
this
.
_neighborOffset
(
j
,
latticePitch
);
...
...
@@ -664,21 +664,21 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G
var
averageQuaternion
=
this
.
_averageQuaternions
(
quaternion
,
neighborQuaternion
);
var
averageQuaternionInverse
=
this
.
_invertQuaternion
(
averageQuaternion
);
var
translationalDelta
=
[
neighborTranslation
[
0
]
-
translation
[
0
]
+
nominalD
[
0
]
-
cellHalfNominalD
[
0
]
-
neighborHalfNominalD
[
0
],
neighborTranslation
[
1
]
-
translation
[
1
]
+
nominalD
[
1
]
-
cellHalfNominalD
[
1
]
-
neighborHalfNominalD
[
1
],
neighborTranslation
[
2
]
-
translation
[
2
]
+
nominalD
[
2
]
-
cellHalfNominalD
[
2
]
-
neighborHalfNominalD
[
2
]
neighborTranslation
[
0
]
-
translation
[
0
]
+
nominalD
[
0
]
-
cellHalfNominalD
[
0
]
-
neighborHalfNominalD
[
0
],
neighborTranslation
[
1
]
-
translation
[
1
]
+
nominalD
[
1
]
-
cellHalfNominalD
[
1
]
-
neighborHalfNominalD
[
1
],
neighborTranslation
[
2
]
-
translation
[
2
]
+
nominalD
[
2
]
-
cellHalfNominalD
[
2
]
-
neighborHalfNominalD
[
2
]
];
var
translationalDeltaXYZ
=
this
.
_applyQuaternion
(
translationalDelta
,
averageQuaternionInverse
);
var
velocityDelta
=
[
neighborVelocity
[
0
]
-
velocity
[
0
],
neighborVelocity
[
1
]
-
velocity
[
1
],
neighborVelocity
[
2
]
-
velocity
[
2
]];
var
velocityDelta
=
[
neighborVelocity
[
0
]
-
velocity
[
0
],
neighborVelocity
[
1
]
-
velocity
[
1
],
neighborVelocity
[
2
]
-
velocity
[
2
]];
var
velocityDeltaXYZ
=
this
.
_applyQuaternion
(
velocityDelta
,
averageQuaternionInverse
);
//longitudal and shear
for
(
var
_axis
=
0
;
_axis
<
3
;
_axis
++
){
if
(
_axis
==
neighborAxis
){
_force
[
_axis
]
+=
longitudalK
[
_axis
]
*
translationalDeltaXYZ
[
_axis
]
+
longitudalD
[
_axis
]
*
velocityDeltaXYZ
[
_axis
];
for
(
var
_axis
=
0
;
_axis
<
3
;
_axis
++
)
{
if
(
_axis
==
neighborAxis
)
{
_force
[
_axis
]
+=
longitudalK
[
_axis
]
*
translationalDeltaXYZ
[
_axis
]
+
longitudalD
[
_axis
]
*
velocityDeltaXYZ
[
_axis
];
}
else
{
var
shearIndex
=
this
.
_shearIndex
(
neighborAxis
,
_axis
);
_force
[
_axis
]
+=
shearK
[
shearIndex
]
*
translationalDeltaXYZ
[
_axis
]
+
shearD
[
shearIndex
]
*
velocityDeltaXYZ
[
_axis
];
_force
[
_axis
]
+=
shearK
[
shearIndex
]
*
translationalDeltaXYZ
[
_axis
]
+
shearD
[
shearIndex
]
*
velocityDeltaXYZ
[
_axis
];
}
}
//convert _force vector back into world reference frame
...
...
@@ -695,11 +695,11 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G
//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]);
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]);
rForce
[
_axis
]
+=
0.00001
*
bendingK
[
_axis
]
*
(
diffEuler
[
_axis
]);
// + bendingD[_axis]*(neighborAngVelocity[_axis]-angVelocity[_axis]);
}
}
}
...
...
@@ -747,6 +747,7 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G
this
.
velocity
[
rgbaIndex
+
1
+
4
*
textureSize
]
=
angVelocity
[
1
];
this
.
velocity
[
rgbaIndex
+
2
+
4
*
textureSize
]
=
angVelocity
[
2
];
nextQuaternion
=
this
.
_normalize4D
(
nextQuaternion
);
this
.
quaternion
[
rgbaIndex
]
=
nextQuaternion
[
0
];
this
.
quaternion
[
rgbaIndex
+
1
]
=
nextQuaternion
[
1
];
this
.
quaternion
[
rgbaIndex
+
2
]
=
nextQuaternion
[
2
];
...
...
@@ -858,13 +859,24 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G
},
_invertQuaternion
:
function
(
quaternion
){
return
[
quaternion
[
0
]
*-
1
,
quaternion
[
1
]
*-
1
,
quaternion
[
2
]
*-
1
,
quaternion
[
3
]];
return
this
.
_normalize4D
(
[
quaternion
[
0
]
*-
1
,
quaternion
[
1
]
*-
1
,
quaternion
[
2
]
*-
1
,
quaternion
[
3
]]
)
;
},
_shearIndex
:
function
(
neighborAxis
,
axis
){
var
index
=
neighborAxis
*
3
+
axis
-
1
;
if
(
index
<
3
)
return
index
;
return
index
-
1
;
if
(
neighborAxis
==
0
){
if
(
axis
==
1
)
return
0
;
if
(
axis
==
2
)
return
1
;
else
console
.
warn
(
"
problem
"
);
}
else
if
(
neighborAxis
==
1
){
if
(
axis
==
0
)
return
2
;
if
(
axis
==
2
)
return
3
;
else
console
.
warn
(
"
problem
"
);
}
else
if
(
neighborAxis
==
2
){
if
(
axis
==
0
)
return
4
;
if
(
axis
==
1
)
return
5
;
else
console
.
warn
(
"
problem
"
);
}
else
console
.
warn
(
"
problem
"
);
return
0
;
},
_torqueAxis
:
function
(
neighbAxis
,
axis
){
...
...
Write
Preview
Markdown
is supported
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