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
15f67df1
Commit
15f67df1
authored
Apr 26, 2017
by
amandaghassaei
Browse files
simple case working
parent
07d813db
Changes
2
Hide whitespace changes
Inline
Side-by-side
js/crease.js
View file @
15f67df1
...
...
@@ -42,7 +42,7 @@ Crease.prototype.getTargetTheta = function(){
};
Crease
.
prototype
.
getK
=
function
(){
var
length
=
this
.
getLength
();
//todo *length?
var
length
=
this
.
getLength
();
if
(
this
.
type
==
0
)
return
globals
.
panelStiffness
*
length
;
return
globals
.
creaseStiffness
*
length
;
};
...
...
js/staticSolver.js
View file @
15f67df1
...
...
@@ -207,8 +207,8 @@ function initStaticSolver(){
var
normal1
=
geometry
.
faces
[
crease
.
face1Index
].
normal
;
var
normal2
=
geometry
.
faces
[
crease
.
face2Index
].
normal
;
var
dotNormals
=
normal1
.
dot
(
normal2
);
if
(
dotNormals
<
-
0.999
)
dotNormals
=
-
0.999
;
else
if
(
dotNormals
>
0.999
)
dotNormals
=
0.999
;
if
(
dotNormals
<
-
1.0
)
dotNormals
=
-
1.0
;
else
if
(
dotNormals
>
1.0
)
dotNormals
=
1.0
;
var
theta
=
Math
.
acos
(
dotNormals
);
var
creaseVector
=
crease
.
getVector
();
...
...
@@ -222,6 +222,7 @@ function initStaticSolver(){
if
(
!
crease
.
node1
.
fixed
){
var
i
=
indicesMapping
.
indexOf
(
crease
.
node1
.
getIndex
());
var
dist
=
crease
.
getLengthToNode1
();
// dist = 1.0;
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
;
...
...
@@ -234,6 +235,7 @@ function initStaticSolver(){
var
i
=
indicesMapping
.
indexOf
(
crease
.
node2
.
getIndex
());
// console.log(normal);
var
dist
=
crease
.
getLengthToNode2
();
// dist = 1.0;
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
;
...
...
@@ -242,6 +244,9 @@ function initStaticSolver(){
F_rxn
[
3
*
i
+
1
]
+=
normal2
.
y
*
rxnForceScale
;
F_rxn
[
3
*
i
+
2
]
+=
normal2
.
z
*
rxnForceScale
;
}
// var invCreaseDirection = normal1.clone().add(normal2).normalize();
// if (!crease.edge.nodes[0].fixed){
// }
}
}
...
...
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