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
OrigamiSimulator
Commits
5ae53665
Commit
5ae53665
authored
Jun 01, 2017
by
amandaghassaei
Browse files
setting up
parent
053bccbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
js/dynamic/dynamicSolver.js
View file @
5ae53665
...
...
@@ -228,7 +228,7 @@ function initDynamicSolver(globals){
}
function
setSolveParams
(){
var
dt
=
calcDt
()
/
2
;
//todo factor of
ten
?
var
dt
=
calcDt
()
/
2
;
//todo factor of
2
?
$
(
"
#deltaT
"
).
html
(
dt
);
globals
.
gpuMath
.
setProgram
(
"
thetaCalc
"
);
globals
.
gpuMath
.
setUniformForProgram
(
"
thetaCalc
"
,
"
u_dt
"
,
dt
,
"
1f
"
);
...
...
@@ -514,11 +514,22 @@ function initDynamicSolver(globals){
faceVertexIndices
[
4
*
i
+
1
]
=
face
[
1
];
faceVertexIndices
[
4
*
i
+
2
]
=
face
[
2
];
nominalTriangles
[
4
*
i
]
=
1
;
//todo update this
nominalTriangles
[
4
*
i
+
1
]
=
1
;
nominalTriangles
[
4
*
i
+
2
]
=
1
;
var
a
=
nodes
[
face
[
0
]].
getOriginalPosition
();
var
b
=
nodes
[
face
[
1
]].
getOriginalPosition
();
var
c
=
nodes
[
face
[
2
]].
getOriginalPosition
();
var
ab
=
(
b
.
clone
().
sub
(
a
)).
normalize
();
var
ac
=
(
c
.
clone
().
sub
(
a
)).
normalize
();
var
bc
=
(
c
.
clone
().
sub
(
b
)).
normalize
();
nominalTriangles
[
4
*
i
]
=
Math
.
acos
(
ab
.
dot
(
ac
));
nominalTriangles
[
4
*
i
+
1
]
=
Math
.
acos
(
-
1
*
ab
.
dot
(
bc
));
nominalTriangles
[
4
*
i
+
2
]
=
Math
.
acos
(
ac
.
dot
(
bc
));
if
(
Math
.
abs
(
nominalTriangles
[
4
*
i
]
+
nominalTriangles
[
4
*
i
+
1
]
+
nominalTriangles
[
4
*
i
+
2
]
-
Math
.
PI
)
>
0.1
){
console
.
warn
(
"
bad angles
"
);
}
}
for
(
var
i
=
0
;
i
<
textureDim
*
textureDim
;
i
++
){
mass
[
4
*
i
+
1
]
=
1
;
//set all fixed by default
}
...
...
@@ -541,7 +552,7 @@ function initDynamicSolver(globals){
for
(
var
j
=
0
;
j
<
num
;
j
++
){
var
_index
=
(
index
+
j
)
*
4
;
var
face
=
faces
[
nodeFaces
[
i
][
j
]];
nodeFaceMeta
[
_index
]
=
nodeFaces
[
j
];
nodeFaceMeta
[
_index
]
=
nodeFaces
[
i
][
j
];
nodeFaceMeta
[
_index
+
1
]
=
face
[
0
];
nodeFaceMeta
[
_index
+
2
]
=
face
[
1
];
nodeFaceMeta
[
_index
+
3
]
=
face
[
2
];
...
...
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