A simple Octree structure that can build up on the Point Clouds
mkdir build
cd build
cmake -DBUILD_EXAMPLE=ON ..
cmake --build .
There are only 2 parameters for CMake at the moment:
BUILD_EXAMPLE
SILENCE_DEBUG_OUTPUT
This repo can only load .ply files at the moment (open for all improvements!) and you can use PointCloud class for that.
PointCloud pcl;
after creating it just call LoadPly function.
pcl.LoadPly("PointClouds/dragon.ply");
now you loaded your Point Cloud. To built an octree, first create one.
Octree octree;
here note that Point is a struct defined in PointCloud.h
struct Point {
Vec3 coords;
int idx;
Point(int i, Vec3 c) : idx(i), coords(c) {};
};
You can call following functions:
Vec3 GetClosestNodePosFromPoint(Vec3 point);
Vec3 GetClosestObject(Vec3 point);
First one returns the closest Node's pos, whether it is empty or not, independent from size. Second one returns the position of the closest non empty node. This function can be improved by returning the properties of the objects in that particular node.