稀疏八度
一种基于指针的稀疏八叉树数据结构。 有关线性实现,请参见 。
··
安装
该库需要对等依赖关系 。
npm install math-ds sparse-octree
用法
点数
import { Vector3 } from "math-ds" ;
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 . insert ( p1 , myData ) ;
octree . move ( p1 , p2 ) ;
octree . get ( p2 ) ; //
1