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
276350b4
Commit
276350b4
authored
Feb 26, 2017
by
amandaghassaei
Browse files
fixed polydetection
parent
b5af1ad0
Changes
1
Show whitespace changes
Inline
Side-by-side
js/pattern.js
View file @
276350b4
...
...
@@ -283,6 +283,7 @@ function initPattern(globals){
edgesDir2
.
push
(
false
);
}
var
polygons
=
[];
var
polygonEdges
=
[];
for
(
var
i
=
0
;
i
<
vertices
.
length
;
i
++
){
var
edges
=
vertEdges
[
i
];
for
(
var
j
=
0
;
j
<
edges
.
length
;
j
++
){
...
...
@@ -311,6 +312,7 @@ function initPattern(globals){
}
}
polygons
.
push
(
_poly
);
polygonEdges
.
push
(
_polyEdges
);
}
}
}
else
{
...
...
@@ -329,19 +331,26 @@ function initPattern(globals){
}
}
polygons
.
push
(
_poly
);
polygonEdges
.
push
(
_polyEdges
);
}
}
}
}
}
// for (var index=0;index<polygons.length;index++) {
// for (var i = 0; i < polygons[index].length; i++) {
// var vertex = vertices[polygons[index][i]];
// var sphere = new THREE.Mesh(new THREE.SphereGeometry(10));
// sphere.position.set(vertex.x, vertex.y, vertex.z);
// intersections.add(sphere);
// }
// }
//remove boundary
for
(
var
i
=
polygonEdges
.
length
-
1
;
i
>=
0
;
i
--
){
var
containsInnerCrease
=
false
;
for
(
var
j
=
0
;
j
<
polygonEdges
[
i
].
length
;
j
++
){
if
(
polygonEdges
[
i
][
j
]
>=
outlines
.
length
){
containsInnerCrease
=
true
;
break
;
}
}
if
(
!
containsInnerCrease
)
{
polygons
.
splice
(
i
,
1
);
}
}
return
polygons
;
}
...
...
@@ -372,7 +381,7 @@ function initPattern(globals){
_poly
.
push
(
otherVertex
);
_polyEdges
.
push
(
-
edgeIndex
-
1
);
if
(
otherVertex
==
_poly
[
0
])
return
_poly
;
else
findNextPolyVert
(
_poly
,
_polyEdges
,
edgeIndex
,
otherVertex
,
vertEdges
,
allEdges
,
edgesDir1
,
edgesDir2
);
else
return
findNextPolyVert
(
_poly
,
_polyEdges
,
edgeIndex
,
otherVertex
,
vertEdges
,
allEdges
,
edgesDir1
,
edgesDir2
);
}
return
null
;
}
...
...
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