equal
deleted
inserted
replaced
1 #include <algorithm> |
1 #include <algorithm> |
2 #include <stack> |
2 #include <stack> |
3 |
3 |
|
4 #include "common.h" |
4 #include "kdtree.h" |
5 #include "kdtree.h" |
5 |
6 |
6 class SortableShape |
7 class SortableShape |
7 { |
8 { |
8 public: |
9 public: |
298 children[1].subdivide(rbb, depth+1); |
299 children[1].subdivide(rbb, depth+1); |
299 } |
300 } |
300 |
301 |
301 void KdTree::build() |
302 void KdTree::build() |
302 { |
303 { |
|
304 infomsg("* building kd-tree\n"); |
303 root = new KdNode(); |
305 root = new KdNode(); |
304 ShapeList::iterator shape; |
306 ShapeList::iterator shape; |
305 for (shape = shapes.begin(); shape != shapes.end(); shape++) |
307 for (shape = shapes.begin(); shape != shapes.end(); shape++) |
306 root->addShape(*shape); |
308 root->addShape(*shape); |
307 root->subdivide(bbox, 0); |
309 root->subdivide(bbox, 0); |