From 71fb33927ed70360073e7063c447b5ac46ee7c60 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 4 Jan 2012 19:17:44 +0100 Subject: update 2geom to r2049. fixes bugs! (bzr r10837) --- src/2geom/quadtree.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/2geom/quadtree.cpp') diff --git a/src/2geom/quadtree.cpp b/src/2geom/quadtree.cpp index 08e6dd7e2..f30475415 100644 --- a/src/2geom/quadtree.cpp +++ b/src/2geom/quadtree.cpp @@ -131,7 +131,7 @@ void QuadTree::insert(double x0, double y0, double x1, double y1, int shape) { // loop until a quad would break the box. // empty root => empty QuadTree. Create initial bounding box (0,0), (1,1) - if(root == 0) { + if(root == NULL) { root = new Quad; bx0 = 0; @@ -179,7 +179,7 @@ void QuadTree::insert(double x0, double y0, double x1, double y1, int shape) { by1 = byy1; } - while(q) { + while(true) { // Find the center of the temp bounding box double cx = (bxx0 + bxx1)/2; double cy = (byy0 + byy1)/2; @@ -225,7 +225,7 @@ void QuadTree::insert(double x0, double y0, double x1, double y1, int shape) { */ assert(i < 4); Quad *qq = q->children[i]; - if(qq == 0) { + if(qq == NULL) { qq = new Quad; q->children[i] = qq; } @@ -233,6 +233,8 @@ void QuadTree::insert(double x0, double y0, double x1, double y1, int shape) { } q->data.push_back(shape); } + + void QuadTree::erase(Quad *q, int shape) { for(Quad::iterator i = q->data.begin(); i != q->data.end(); i++) { if(*i == shape) { -- cgit v1.2.3