mirror of
https://github.com/jhasse/poly2tri.git
synced 2024-11-30 01:03:30 +01:00
fixed more memory leaks
This commit is contained in:
parent
15db727895
commit
75f8496e22
@ -88,7 +88,7 @@ Node& Sweep::PointEvent(SweepContext& tcx, Point& point)
|
||||
// x value than node due to how we fetch nodes from the front
|
||||
if (point.x <= node.point->x + EPSILON) {
|
||||
Fill(tcx, node);
|
||||
tcx.RemoveNode(&node);
|
||||
delete &node;
|
||||
}
|
||||
|
||||
//tcx.AddNode(new_node);
|
||||
@ -535,19 +535,27 @@ void Sweep::FillBasinReq(SweepContext& tcx, Node* node)
|
||||
if (o == CW) {
|
||||
return;
|
||||
}
|
||||
Node *temp = node;
|
||||
node = node->next;
|
||||
delete temp;
|
||||
} else if (node->next == tcx.basin.right_node) {
|
||||
Orientation o = Orient2d(*node->point, *node->prev->point, *node->prev->prev->point);
|
||||
if (o == CCW) {
|
||||
return;
|
||||
}
|
||||
Node *temp = node;
|
||||
node = node->prev;
|
||||
delete temp;
|
||||
} else {
|
||||
// Continue with the neighbor node with lowest Y value
|
||||
if (node->prev->point->y < node->next->point->y) {
|
||||
Node *temp = node;
|
||||
node = node->prev;
|
||||
delete temp;
|
||||
} else {
|
||||
Node *temp = node;
|
||||
node = node->next;
|
||||
delete temp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -702,6 +710,7 @@ void Sweep::FillLeftConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& p)
|
||||
|
@ -130,7 +130,6 @@ void SweepContext::CreateAdvancingFront()
|
||||
head = new Node(*triangle->GetPoint(1), *triangle);
|
||||
middle = new Node(*triangle->GetPoint(0), *triangle);
|
||||
tail = new Node(*triangle->GetPoint(2));
|
||||
|
||||
front_ = new AdvancingFront(*head, *tail);
|
||||
|
||||
// TODO: More intuitive if head is middles next and not previous?
|
||||
|
Loading…
Reference in New Issue
Block a user