Octree

About the Octree

An Octree is a tree data structure where each node has 8 children. This data structure is often used to partition a 3 dimensional space. Octrees are often used with 3D graphics and 3D game engines

This library allows you to easily use octrees with the Java programming language. Unlike many other libaries, this library allows you to store data at each point.

Example Usage

        Octree<String> tree = new Octree<>(0, 0, 0, 10, 10, 10);
    

In order to use the octree you must define the bounds. The first 3 numbers are position one, the latter 3 numbers are position two.

You can add, remove, get, and check for points.

        
            Octree<String> tree = new Octree<>(0, 0, 0, 10, 10, 10);
            tree.find(3, 3, 3); // Returns false.
    
            tree.add(3, 3, 3, "Example Point");
            tree.find(3, 3, 3); // Returns true.
    
            String example = tree.get(3, 3, 3);
            System.out.println(example); // Prints "Example Point";
    
            tree.remove(3, 3, 3);
            tree.find(3, 3, 3); // Returns false.
        
    

Maven / Gradle and Github

Maven


<repositories>
    <repository>
        <id>Ryandw11</id>
        <url>https://repo.ryandw11.com/repository/maven-releases/</url>
    </repository>
</repositories>


<dependency>
    <groupId>me.ryandw11</groupId>
    <artifactId>Octree</artifactId>
    <version>1.0</version>
</dependency>

    

Gradle

        
repositories {
    maven { url 'https://repo.ryandw11.com/repository/maven-releases/' }
}
dependencies {
    implementation 'me.ryandw11:Octree:1.0'
}
        
    

Github

Check out the github repository for this project!

Return to libraries page.