|See what's going on with flipcode!|
Question submitted by (24 July 2000)
|Return to The Archives|
I'm looking for code that implements an Octree. Do you know of any such
code, commercial or non-commercial? The implementation needs to provide
the following capabilities.
I have a set of 3D points (x,y,z, n). 'n' is an unsigned integer identifier for each 3D point. I would like to insert 3D points into an Octree data structure in such a way that duplicates are not inserted and I can query the existence/absence of a 3D point in the Octree.
I'm not aware of any octree code out there (but that doesn't mean there
isn't any.) However, your needs are rather simple, so I've crafted some code
The code is somewhat incomplete, and hence, completely untested. There's no error correction and it's lacking in other areas, but it should provide you with lots of helpful implementation tips.
So, the rest of this Ask MidNight response can be found in the comments of the following code: Code Of The Day: Octree Implementation.
Response provided by Paul Nettle
This article was originally an entry in flipCode's Ask Midnight, a Question and Answer column with Paul Nettle that's no longer active.