프로젝트
GitHub에서 보기
vanruesc/sparse-octree
소개
A sparse octree data structure.
디자인 및 미디어What you can do
- Handles octant splitting
- Supports cubic octrees for reduced memory usage
- Adheres to a common octant layout
- Supports raycasting
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalSparse Octree
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 { Raycaster, 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
const raycaster = new Raycaster(new Vector3(0, 0, 2), new Vector3(0, 0, -1));
raycaster.params.Points.threshold = 0.1;
const hit = octree.raycastClosest(raycaster);
hit?.data; // => myData
octree.remove(p2);
octree.get(p2); // => null
raycastClosest() returns null if there is no hit. Use raycast() to get all hits, nearest first.
Custom Octrees
import { Octree, CubicOctant } from "sparse-octree";
export class CubicOctree extends Octree {
constructor(min, size) {
super(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.
관련 프로젝트 살펴보기
불러오는 중…