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
1dd6e504
Commit
1dd6e504
authored
Feb 26, 2017
by
amandaghassaei
Browse files
eod
parent
c5eae2cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
js/pattern.js
View file @
1dd6e504
...
...
@@ -32,7 +32,7 @@ function initPattern(globals){
});
}
loadSVG
(
"
/assets/Tessellations/miura-ori
-dashed
.svg
"
,
function
(
svg
){
loadSVG
(
"
/assets/Tessellations/miura-ori.svg
"
,
function
(
svg
){
var
_$svg
=
$
(
svg
);
//format all lines
...
...
@@ -150,7 +150,6 @@ function initPattern(globals){
cutsRaw
=
_cutsRaw
;
mergeVertices
();
drawPattern
();
}
function
mergeVertices
(){
...
...
@@ -160,23 +159,27 @@ function initPattern(globals){
var
tolSq
=
globals
.
vertTol
*
globals
.
vertTol
;
var
combined
=
[];
var
mergedVertices
=
[];
var
diff
=
1
;
var
weededVertices
=
vertices
.
slice
();
var
diff
=
0
;
for
(
var
i
=
vertices
.
length
-
1
;
i
>=
0
;
i
--
){
var
_combined
=
[];
for
(
var
j
=
i
-
diff
;
j
>=
0
;
j
--
){
if
((
v
ertices
[
i
].
clone
().
sub
(
vertices
[
j
])).
lengthSq
()
<
tolSq
){
for
(
var
j
=
i
-
1
+
diff
;
j
>=
0
;
j
--
){
if
((
weededV
ertices
[
i
].
clone
().
sub
(
vertices
[
j
])).
lengthSq
()
<
tolSq
){
_combined
.
push
(
j
);
}
}
var
numCombined
=
_combined
.
length
;
if
(
numCombined
>
0
){
_combined
.
push
(
i
);
mergedVertices
.
push
(
v
ertices
[
i
]);
_combined
.
push
(
i
+
diff
);
mergedVertices
.
push
(
weededV
ertices
[
i
]);
combined
.
push
(
_combined
);
for
(
var
k
=
0
;
k
<
numCombined
-
1
;
k
++
){
vertices
.
splice
(
_combined
[
k
],
1
);
console
.
log
(
_combined
);
weededVertices
.
splice
(
i
,
1
);
for
(
var
k
=
0
;
k
<
numCombined
;
k
++
){
weededVertices
.
splice
(
_combined
[
k
],
1
);
}
diff
-=
numCombined
diff
+=
numCombined
;
i
-=
numCombined
;
}
}
console
.
log
(
combined
.
length
);
...
...
@@ -191,7 +194,13 @@ function initPattern(globals){
removeCombinedFromSet
(
combined
,
valleys
);
removeCombinedFromSet
(
combined
,
cuts
);
console
.
log
(
outlines
);
vertices
=
mergedVertices
;
//find cycles
//triangulate
drawPattern
();
}
function
removeCombinedFromSet
(
combined
,
set
){
...
...
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