-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
26 lines (23 loc) · 1.13 KB
/
main.cpp
File metadata and controls
26 lines (23 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include "src/kdtree.hpp"
int main () {
KDTree *tree = new KDTree(AABB(Point(0, 0, 0), Point(10, 10, 10)));
std::cout << *tree << std::endl;
tree->insert(new Point(5, 5, 5));
std::cout << *tree << std::endl;
tree->insert(new Point(2, 5, 5));
std::cout << *tree << std::endl;
tree->insert(new Point(8, 5, 5));
tree->insert(new Point(1, 0, 5));
tree->insert(new Point(1, 10, 5));
std::cout << *tree << std::endl;
std::cout << *tree->upper_child << std::endl;
std::cout << *tree->lower_child << std::endl;
std::cout << *tree->lower_child->lower_child << std::endl;
std::cout << *tree->lower_child->upper_child << std::endl;
std::cout << *tree->lower_child->upper_child << std::endl;
std::cout << "Found point :" << (tree->find_point(new Point(5, 5, 5))!=nullptr) << std::endl;
std::cout << "Found point :" << (tree->find_point(new Point(-1, 5, 5))!=NULL) << std::endl;
std::cout << "Found point :" << (tree->find_point(new Point(1, 10, 5))!=NULL) << std::endl;
std::cout << "Found point :" << (tree->find_point(new Point(1, 10, 5.001))!=NULL) << std::endl;
}