Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A sparse octree data structure.

License

NotificationsYou must be signed in to change notification settings

vanruesc/sparse-octree

Repository files navigation

CIVersion

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

Demo · Sandbox · Documentation

Installation

This library requires the peer dependencythree.

npm install three sparse-octree

Usage

Points
import{Vector3}from"three";import{PointOctree}from"sparse-octree";constmin=newVector3(-1,-1,-1);constmax=newVector3(1,1,1);constoctree=newPointOctree(min,max);constmyData={};constp1=newVector3(0,0,0);constp2=newVector3(0,0,0.5);octree.set(p1,myData);octree.move(p1,p2);octree.get(p2);// => myDataoctree.remove(p2);octree.get(p2);// => null
Custom Octrees
import{Octree,CubicOctant}from"sparse-octree";exportclassCubicOctreeextendsOctree{constructor(min,size){this.root=newCubicOctant(min,size);}}

Features

  • Pointer-based structure
    • Handles octant splitting
    • Supports cubic octrees for reduced memory usage
    • Dynamic depth
  • Adheres to acommon 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.


[8]ページ先頭

©2009-2025 Movatter.jp