mirror of
https://github.com/jhasse/poly2tri.git
synced 2024-11-30 01:03:30 +01:00
fixed none memory leaks...
This commit is contained in:
parent
8b0b7e3c79
commit
1bdb0893cd
@ -32,6 +32,7 @@
|
|||||||
#include "sweep_context.h"
|
#include "sweep_context.h"
|
||||||
#include "advancing_front.h"
|
#include "advancing_front.h"
|
||||||
#include "../common/utils.h"
|
#include "../common/utils.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace p2t {
|
namespace p2t {
|
||||||
|
|
||||||
@ -527,7 +528,8 @@ void Sweep::FillBasinReq(SweepContext& tcx, Node* node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Fill(tcx, *node);
|
Fill(tcx, *node);
|
||||||
|
Node *temp = node;
|
||||||
|
|
||||||
if (node->prev == tcx.basin.left_node && node->next == tcx.basin.right_node) {
|
if (node->prev == tcx.basin.left_node && node->next == tcx.basin.right_node) {
|
||||||
delete node;
|
delete node;
|
||||||
return;
|
return;
|
||||||
@ -537,31 +539,24 @@ void Sweep::FillBasinReq(SweepContext& tcx, Node* node)
|
|||||||
delete node;
|
delete node;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Node *temp = node;
|
|
||||||
node = node->next;
|
node = node->next;
|
||||||
delete temp;
|
|
||||||
} else if (node->next == tcx.basin.right_node) {
|
} else if (node->next == tcx.basin.right_node) {
|
||||||
Orientation o = Orient2d(*node->point, *node->prev->point, *node->prev->prev->point);
|
Orientation o = Orient2d(*node->point, *node->prev->point, *node->prev->prev->point);
|
||||||
if (o == CCW) {
|
if (o == CCW) {
|
||||||
delete node;
|
delete node;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Node *temp = node;
|
|
||||||
node = node->prev;
|
node = node->prev;
|
||||||
delete temp;
|
|
||||||
} else {
|
} else {
|
||||||
// Continue with the neighbor node with lowest Y value
|
// Continue with the neighbor node with lowest Y value
|
||||||
if (node->prev->point->y < node->next->point->y) {
|
if (node->prev->point->y < node->next->point->y) {
|
||||||
Node *temp = node;
|
|
||||||
node = node->prev;
|
node = node->prev;
|
||||||
delete temp;
|
|
||||||
} else {
|
} else {
|
||||||
Node *temp = node;
|
|
||||||
node = node->next;
|
node = node->next;
|
||||||
delete temp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete temp;
|
||||||
FillBasinReq(tcx, node);
|
FillBasinReq(tcx, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,6 +628,9 @@ void Sweep::FillRightConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete &node.next;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sweep::FillRightConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
|
void Sweep::FillRightConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
|
||||||
@ -714,6 +712,8 @@ void Sweep::FillLeftConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete &node.prev;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& p)
|
void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& p)
|
||||||
|
Loading…
Reference in New Issue
Block a user