summaryrefslogtreecommitdiff
path: root/src/3rdparty/poly2tri/sweep/sweep_context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/poly2tri/sweep/sweep_context.cpp')
-rw-r--r--src/3rdparty/poly2tri/sweep/sweep_context.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/3rdparty/poly2tri/sweep/sweep_context.cpp b/src/3rdparty/poly2tri/sweep/sweep_context.cpp
index 85c5b5dc..e9791caf 100644
--- a/src/3rdparty/poly2tri/sweep/sweep_context.cpp
+++ b/src/3rdparty/poly2tri/sweep/sweep_context.cpp
@@ -34,7 +34,13 @@
namespace p2t {
-SweepContext::SweepContext(std::vector<Point*> polyline)
+SweepContext::SweepContext(std::vector<Point*> polyline) :
+ front_(0),
+ head_(0),
+ tail_(0),
+ af_head_(0),
+ af_middle_(0),
+ af_tail_(0)
{
basin = Basin();
edge_event = EdgeEvent();
@@ -164,12 +170,20 @@ void SweepContext::RemoveFromMap(Triangle* triangle)
void SweepContext::MeshClean(Triangle& triangle)
{
- if (&triangle != NULL && !triangle.IsInterior()) {
- triangle.IsInterior(true);
- triangles_.push_back(&triangle);
- for (int i = 0; i < 3; i++) {
- if (!triangle.constrained_edge[i])
- MeshClean(*triangle.GetNeighbor(i));
+ std::vector<Triangle *> triangles;
+ triangles.push_back(&triangle);
+
+ while(!triangles.empty()){
+ Triangle *t = triangles.back();
+ triangles.pop_back();
+
+ if (t != NULL && !t->IsInterior()) {
+ t->IsInterior(true);
+ triangles_.push_back(t);
+ for (int i = 0; i < 3; i++) {
+ if (!t->constrained_edge[i])
+ triangles.push_back(t->GetNeighbor(i));
+ }
}
}
}