X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fquadtree.cpp;h=623bd3893c1b973d5e21d1daf2d073730820c6bc;hp=3d5dbeedb954a0d656d225e5b4124ca7d043bbae;hb=b716ae547424e4e4bbda86781a151c31e3a64e67;hpb=ef0af5fd0129161a9e079bd3cd1298b53f1fe11a diff --git a/src/quadtree.cpp b/src/quadtree.cpp index 3d5dbee..623bd38 100644 --- a/src/quadtree.cpp +++ b/src/quadtree.cpp @@ -70,6 +70,12 @@ QuadTreeIndex QuadTree::GetNeighbour(QuadTreeIndex start, int xdir, int ydir, Do { if (!xdir && !ydir) return start; + if (addTo && (nodes[start].parent == -1) && nodes[start].child_type != QTC_UNKNOWN) + { + Debug("Adding parent of node %d...", start); + addTo->GenQuadParent(start, nodes[start].child_type); + } + QuadTreeIndex newNode; // Try moving to the right if that's easy. if (xdir > 0) @@ -291,6 +297,15 @@ QuadTreeIndex QuadTree::GetNeighbour(QuadTreeIndex start, int xdir, int ydir, Do return -1; } +void QuadTree::GetCanonicalCoords(QuadTreeIndex& start, Real& x, Real& y, Document *doc) +{ + int _x = (int)x; + int _y = (int)y; + start = GetNeighbour(start, _x, _y, doc); + x -= _x; + y -= _y; +} + } #endif