cgal/Orthtree/test/Orthtree/test_node_index.cpp

49 lines
1.4 KiB
C++

#define CGAL_TRACE_STREAM std::cerr
#include <CGAL/Octree.h>
#include <CGAL/Orthtree/Traversals.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Point_set_3.h>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point;
typedef CGAL::Point_set_3<Point> Point_set;
typedef CGAL::Octree<Kernel, Point_set, typename Point_set::Point_map>
Octree;
int main(void) {
Point_set points;
points.insert({-1, -1, -1});
points.insert({1, -1, -1});
points.insert({-1, 1, -1});
points.insert({1, 1, -1});
points.insert({-1, -1, 1});
points.insert({1, -1, 1});
points.insert({-1, 1, 1});
points.insert({1, 1, 1});
points.insert({-1, -1, -1.1});
points.insert({-1, -1, -1.2});
points.insert({-1, -1, -1.3});
points.insert({-1, -1, -1.4});
points.insert({-1, -1, -1.5});
points.insert({-1, -1, -1.6});
points.insert({-1, -1, -1.7});
points.insert({-1, -1, -1.8});
points.insert({-1, -1, -1.9});
Octree octree(points, points.point_map());
octree.refine(10, 1);
std::cout << "root: " << octree.root().local_coordinates() << std::endl;
std::cout << "first child: " << octree.root()[0].local_coordinates() << std::endl;
std::cout << "fifth child: " << octree.root()[4].local_coordinates() << std::endl;
std::cout << "fifth child of first child: " << octree.root()[0][4].local_coordinates() << std::endl;
// TODO
return 0;
}