Skip to content
/ Octree Public

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

Notifications You must be signed in to change notification settings

bertaye/Octree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OctreeForPointClouds

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

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 = new PointCloud();

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<Point>* octree = new Octree<Point>();

here note that Point is a struct defined in PointCloud.h

struct Point {
	float* coords;
	int idx;
	Point(int i, float* c) : idx(i), coords(c) {};
};

PS: I created Octree class as a template to easy further developments. Then call

  BuiltOctreeFromPointCloud(PointCloud*, float minSize, vect<T*> objects)

function. minSize determines minimum node size of octree.

  octree->BuiltOctreeFromPointCloud(pcl, 0.2f, pcl->points);

Now you have your octree for the point cloud.

Notes on Octree Class

You can call following functions:

  float* GetClosestNodePosFromPoint(float* point);
  float* GetClosestObject(float* 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

These examples rendered with Coin3D library which is not included in this project.

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published