Commit 3af33784 authored by Jan Möbius's avatar Jan Möbius
Browse files

Fixed memory leak

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9838 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0b004e2c
...@@ -117,7 +117,7 @@ public: ...@@ -117,7 +117,7 @@ public:
Point p0, p1, p2, bb_min, bb_max; Point p0, p1, p2, bb_min, bb_max;
bb_min.vectorize(FLT_MAX); bb_min.vectorize(FLT_MAX);
bb_max.vectorize(-FLT_MAX); bb_max.vectorize(-FLT_MAX);
std::list<Point>* vertices = new std::list<Point>; std::list<Point> vertices;
for (it_h=_node->begin(); it_h!=_node->end(); ++it_h) for (it_h=_node->begin(); it_h!=_node->end(); ++it_h)
...@@ -131,9 +131,9 @@ public: ...@@ -131,9 +131,9 @@ public:
bb_max.maximize(p1); bb_max.maximize(p1);
bb_max.maximize(p2);*/ bb_max.maximize(p2);*/
vertices->push_back (p0); vertices.push_back (p0);
vertices->push_back (p1); vertices.push_back (p1);
vertices->push_back (p2); vertices.push_back (p2);
} }
bb_min = _node->bb_min; bb_min = _node->bb_min;
bb_max = _node->bb_max; bb_max = _node->bb_max;
...@@ -147,16 +147,17 @@ public: ...@@ -147,16 +147,17 @@ public:
//calculate the median value in axis-direction //calculate the median value in axis-direction
switch (axis) { switch (axis) {
case 0: vertices->sort (x_sort() ); break; case 0: vertices.sort (x_sort() ); break;
case 1: vertices->sort (y_sort() ); break; case 1: vertices.sort (y_sort() ); break;
case 2: vertices->sort (z_sort() ); break; } case 2: vertices.sort (z_sort() ); break; }
vertices->unique(); ///todo: does this work with Points?! vertices.unique(); ///todo: does this work with Points?!
int size = vertices->size(); int size = vertices.size();
typename std::list<Point>::iterator it_v; typename std::list<Point>::iterator it_v;
it_v = vertices->begin(); it_v = vertices.begin();
std::advance(it_v, size/2); std::advance(it_v, size/2);
median = *it_v; median = *it_v;
} }
void calculateBoundingBoxRoot( void calculateBoundingBoxRoot(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment