7.1.8 • Published 11 months ago

sparse-octree v7.1.8

Weekly downloads
108
License
Zlib
Repository
github
Last release
11 months ago

Sparse Octree

CI Version

A sparse, pointer-based octree data structure. For a linear implementation see linear-octree.

Demo·Sandbox·Documentation

Installation

This library requires the peer dependency three.

npm install three sparse-octree

Usage

Points
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 = {};
const p1 = new Vector3(0, 0, 0);
const p2 = new Vector3(0, 0, 0.5);

octree.set(p1, myData);
octree.move(p1, p2);
octree.get(p2); // => myData

octree.remove(p2);
octree.get(p2); // => null
Custom Octrees
import { Octree, CubicOctant } from "sparse-octree";

export class CubicOctree extends Octree {

	constructor(min, size) {

		this.root = new CubicOctant(min, size);

	}

}

Features

  • Pointer-based structure
    • Handles octant splitting
    • Supports cubic octrees for reduced memory usage
    • Dynamic depth
  • Adheres to a common octant layout
  • Supports raycasting
  • Supports culling
  • Can be extended to manage any data
  • Provides a point management implementation

Contributing

Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

7.1.7

11 months ago

7.1.8

11 months ago

7.1.6

2 years ago

7.1.5

2 years ago

7.1.4

2 years ago

7.1.3

3 years ago

7.1.2

3 years ago

7.1.1

3 years ago

7.1.0

3 years ago

7.0.7

3 years ago

7.0.6

3 years ago

7.0.5

3 years ago

7.0.4

3 years ago

7.0.3

3 years ago

7.0.2

3 years ago

7.0.1

3 years ago

7.0.0

3 years ago

6.1.0

4 years ago

6.0.2

4 years ago

6.0.1

5 years ago

6.0.0

5 years ago

5.2.1

5 years ago

5.2.0

5 years ago

5.1.1

5 years ago

5.1.0

5 years ago

5.0.2

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.3.0

6 years ago

4.2.2

6 years ago

4.2.1

6 years ago

4.1.1

7 years ago

4.1.0

7 years ago

4.0.3

7 years ago

4.0.2

7 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.0.0

7 years ago

2.6.2

7 years ago

2.6.1

7 years ago

2.6.0

7 years ago

2.5.2

7 years ago

2.5.1

7 years ago

2.5.0

7 years ago

2.4.2

8 years ago

2.4.1

8 years ago

2.4.0

8 years ago

2.3.2

8 years ago

2.3.1

8 years ago

2.3.0

8 years ago

2.2.0

8 years ago

2.1.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.0

8 years ago

0.2.0

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.0

8 years ago