bertaye / Octree

A simple Octree structure that can build up on the Point Clouds

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OctreeForPointClouds

A simple Octree structure that can build up on the Point Clouds

Build

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

How to use

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) {};
};

Notes on Octree Class

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.

Examples

Stanford Dragon Point Cloud

Dragon point cloud

Octree Built and only nodes with objects are shown

Complete Octree Shown

About

A simple Octree structure that can build up on the Point Clouds


Languages

Language:C++ 95.9%Language:CMake 4.1%