A sparse octree data structure.
Extensive Demo ∴ API Reference
npm install sparse-octree
import { Octree, CubicOctant } from "sparse-octree";
export class CubicOctree extends Octree {
constructor(min, size) {
this.root = new CubicOctant(min, size);
}
}
import { Vector3 } from "three";
import { PointOctree } from "sparse-octree";
const min = new Vector3(-1, -1, -1);
const max = new Vector3(1, 1, 1);
const octree = new PointOctree(min, max);
const myData = {};
octree.put(new Vector3(0, 0, 0), myData);
octree.fetch(new Vector3(0, 0, 0)); // => myData
A full point octree example can be found here.
- Base Functionality
- Pointer-based structure
- Handles octant splitting
- Adheres to a common octant layout
- Supports raycasting
- Supports culling
- Supports cubic octrees
- Can be extended to manage any data
- Provides a point management implementation
The octree-helper module provides an octree visualisation tool for three.js.
Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.