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
84201966
Commit
84201966
authored
May 06, 2017
by
amandaghassaei
Browse files
set crease percent on import
parent
5023423e
Changes
2
Hide whitespace changes
Inline
Side-by-side
js/controls.js
View file @
84201966
...
...
@@ -108,6 +108,7 @@ function initControls(globals){
var
name
=
extension
[
extension
.
length
-
2
].
split
(
"
/
"
);
name
=
name
[
name
.
length
-
1
];
extension
=
extension
[
extension
.
length
-
1
];
// globals.setCreasePercent(0);
if
(
extension
==
"
txt
"
){
$
.
getJSON
(
"
assets/
"
+
url
,
function
(
json
)
{
globals
.
filename
=
name
;
...
...
@@ -148,6 +149,7 @@ function initControls(globals){
}
globals
.
filename
=
name
;
globals
.
extension
=
extension
;
// globals.setCreasePercent(0);
parseTXTjson
(
JSON
.
parse
(
reader
.
result
));
}
}(
file
);
...
...
@@ -161,6 +163,7 @@ function initControls(globals){
}
globals
.
filename
=
name
;
globals
.
extension
=
extension
;
// globals.setCreasePercent(0);
globals
.
pattern
.
loadSVG
(
reader
.
result
);
}
}(
file
);
...
...
@@ -180,6 +183,7 @@ function initControls(globals){
}
$
(
"
#importFoldModal
"
).
modal
(
"
show
"
);
$
(
'
#importFoldModal
'
).
on
(
'
hidden.bs.modal
'
,
function
()
{
if
(
globals
.
foldUseAngles
)
globals
.
setCreasePercent
(
1
);
parseFoldJSON
(
JSON
.
parse
(
reader
.
result
));
});
...
...
@@ -276,6 +280,8 @@ function initControls(globals){
var
x
=
normal1
.
dot
(
normal2
);
var
y
=
normal1
.
cross
((
json
.
vertices_coords
[
v2
].
clone
().
sub
(
json
.
vertices_coords
[
v1
])).
normalize
()).
dot
(
normal2
);
var
angle
=
Math
.
atan2
(
y
,
x
);
if
(
angle
>
0
)
console
.
log
(
json
.
edges_assignment
[
i
]);
else
console
.
log
(
json
.
edges_assignment
[
i
]);
if
(
Math
.
abs
(
Math
.
PI
-
Math
.
abs
(
angle
))
<
0.2
){
angle
=
Math
.
PI
*
foldSign
;
}
...
...
js/globals.js
View file @
84201966
...
...
@@ -35,7 +35,7 @@ function initGlobals(){
simType
:
"
dynamic
"
,
//sim settings
creasePercent
:
0
,
creasePercent
:
0
.5
,
axialStiffness
:
2000
,
creaseStiffness
:
70
,
panelStiffness
:
70
,
...
...
@@ -60,6 +60,13 @@ function initGlobals(){
};
function
setCreasePercent
(
percent
){
_globals
.
creasePercent
=
percent
;
$
(
"
#creasePercent>div
"
).
slider
({
value
:
percent
});
$
(
"
#creasePercent>input
"
).
val
(
percent
);
}
_globals
.
setCreasePercent
=
setCreasePercent
;
function
warn
(
msg
){
$
(
"
#warningMessage
"
).
html
(
msg
);
$
(
"
#warningModal
"
).
modal
(
"
show
"
);
...
...
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