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
07d813db
Commit
07d813db
authored
Apr 19, 2017
by
amandaghassaei
Browse files
eod
parent
04b418ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
js/crease.js
View file @
07d813db
...
...
@@ -42,9 +42,9 @@ Crease.prototype.getTargetTheta = function(){
};
Crease
.
prototype
.
getK
=
function
(){
//
var length = this.getLength(); //todo *length?
if
(
this
.
type
==
0
)
return
globals
.
panelStiffness
;
return
globals
.
creaseStiffness
;
var
length
=
this
.
getLength
();
//todo *length?
if
(
this
.
type
==
0
)
return
globals
.
panelStiffness
*
length
;
return
globals
.
creaseStiffness
*
length
;
};
Crease
.
prototype
.
getD
=
function
(){
...
...
js/model.js
View file @
07d813db
...
...
@@ -58,7 +58,6 @@ function initModel(globals){
var
_creases
=
[];
for
(
var
i
=
0
;
i
<
allCreaseParams
.
length
;
i
++
)
{
//allCreaseParams.length
var
creaseParams
=
allCreaseParams
[
i
];
//face1Ind, vertInd, face2Ind, ver2Ind, edgeInd, angle
_edges
[
creaseParams
[
4
]].
highlight
();
_creases
.
push
(
new
Crease
(
_edges
[
creaseParams
[
4
]],
creaseParams
[
0
],
creaseParams
[
2
],
creaseParams
[
5
],
1
,
_nodes
[
creaseParams
[
1
]],
_nodes
[
creaseParams
[
3
]],
_creases
.
length
));
}
...
...
js/staticSolver.js
View file @
07d813db
...
...
@@ -177,7 +177,7 @@ function initStaticSolver(){
var
length
=
edge
.
getOriginalLength
();
var
diff
=
edgeVector0
.
length
()
-
length
;
var
rxnForceScale
=
globals
.
axialStiffness
*
diff
;
var
rxnForceScale
=
globals
.
axialStiffness
*
diff
/
length
;
edgeVector0
.
normalize
();
if
(
!
_nodes
[
0
].
fixed
)
{
...
...
@@ -222,10 +222,10 @@ function initStaticSolver(){
if
(
!
crease
.
node1
.
fixed
){
var
i
=
indicesMapping
.
indexOf
(
crease
.
node1
.
getIndex
());
var
dist
=
crease
.
getLengthToNode1
();
C
[
j
+
numFreeEdges
][
3
*
i
]
=
-
normal1
.
x
;
//todo not sure about sign
C
[
j
+
numFreeEdges
][
3
*
i
+
1
]
=
-
normal1
.
y
;
C
[
j
+
numFreeEdges
][
3
*
i
+
2
]
=
-
normal1
.
z
;
rxnForceScale
=
crease
.
getK
()
*
diff
;
C
[
j
+
numFreeEdges
][
3
*
i
]
=
-
normal1
.
x
/
dist
;
//todo not sure about sign
C
[
j
+
numFreeEdges
][
3
*
i
+
1
]
=
-
normal1
.
y
/
dist
;
C
[
j
+
numFreeEdges
][
3
*
i
+
2
]
=
-
normal1
.
z
/
dist
;
rxnForceScale
=
crease
.
getK
()
*
diff
/
dist
;
F_rxn
[
3
*
i
]
+=
normal1
.
x
*
rxnForceScale
;
F_rxn
[
3
*
i
+
1
]
+=
normal1
.
y
*
rxnForceScale
;
F_rxn
[
3
*
i
+
2
]
+=
normal1
.
z
*
rxnForceScale
;
...
...
@@ -234,10 +234,10 @@ function initStaticSolver(){
var
i
=
indicesMapping
.
indexOf
(
crease
.
node2
.
getIndex
());
// console.log(normal);
var
dist
=
crease
.
getLengthToNode2
();
C
[
j
+
numFreeEdges
][
3
*
i
]
=
-
normal2
.
x
;
//
/dist;
C
[
j
+
numFreeEdges
][
3
*
i
+
1
]
=
-
normal2
.
y
;
//
/dist;
C
[
j
+
numFreeEdges
][
3
*
i
+
2
]
=
-
normal2
.
z
;
//
/dist;
rxnForceScale
=
crease
.
getK
()
*
diff
;
//
/dist;
C
[
j
+
numFreeEdges
][
3
*
i
]
=
-
normal2
.
x
/
dist
;
C
[
j
+
numFreeEdges
][
3
*
i
+
1
]
=
-
normal2
.
y
/
dist
;
C
[
j
+
numFreeEdges
][
3
*
i
+
2
]
=
-
normal2
.
z
/
dist
;
rxnForceScale
=
crease
.
getK
()
*
diff
/
dist
;
F_rxn
[
3
*
i
]
+=
normal2
.
x
*
rxnForceScale
;
F_rxn
[
3
*
i
+
1
]
+=
normal2
.
y
*
rxnForceScale
;
F_rxn
[
3
*
i
+
2
]
+=
normal2
.
z
*
rxnForceScale
;
...
...
@@ -248,7 +248,7 @@ function initStaticSolver(){
function
calcQ
()
{
var
axialStiffness
=
globals
.
axialStiffness
;
for
(
var
i
=
0
;
i
<
numFreeEdges
;
i
++
)
{
Q
[
i
][
i
]
=
axialStiffness
;
Q
[
i
][
i
]
=
axialStiffness
/
edges
[
freeEdgesMapping
[
i
]].
getOriginalLength
()
;
}
for
(
var
i
=
0
;
i
<
numFreeCreases
;
i
++
)
{
var
crease
=
creases
[
freeCreasesMapping
[
i
]];
...
...
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