Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Octree

An octree acceleration data structure

example
let octree = new Octree();
octree.build(models, model => {
  return model._boundingShape;
});
octree.select(enums.SHAPE_FRUSTUM, view._frustum);

Hierarchy

  • Octree

Index

Constructors

constructor

  • newOctree(blockCapacity?: number, maxDepth?: number): Octree
  • Create a octree structure

    Parameters

    • Default value blockCapacity: number = 32

      maximum capacity for each block node before it's been subdivided, might be exceeded if maxDepth is reached

    • Default value maxDepth: number = 5

      maximum depth of this tree

    Returns Octree

Properties

Private _getBoundingShape

_getBoundingShape: Function

Private _selection

_selection: Set<any>

blockCapacity

blockCapacity: number

blocks

blocks: OctreeBlock[]

dynamics

dynamics: any[]

maxDepth

maxDepth: number

Methods

addEntry

  • addEntry(entry: any): void

build

  • build(entries: any, getBoundingShape: any): void
  • 从给定的项中构建这个八叉树。根边界是所有这些条目的边界框。

    Parameters

    • entries: any

      a collection of entries to be queried later

    • getBoundingShape: any
      • a function takes an entry and returns its primitive info

    Returns void

frustumSelect

  • frustumSelect(frustum: any): Set<any>
  • Specialized selection for frustums

    Parameters

    • frustum: any

      the selecting frustum

    Returns Set<any>

    the resulting set of entries

removeEntry

  • removeEntry(entry: any): void

select

  • select(shape: any): Set<any>
  • 选择与给定原始项重叠的所有项

    Parameters

    • shape: any

      the selecting primitive

    Returns Set<any>

    the resulting set of entries

Static createBlocks

  • createBlocks(worldMin: any, worldMax: any, entries: any, blockCapacity: any, curDepth: any, maxDepth: any, getBoundingShape: any): OctreeBlock[]
  • 创建子块,并用给定的条目填充它们

    Parameters

    • worldMin: any

      min position of the parent bounding box

    • worldMax: any

      max position of the parent bounding box

    • entries: any

      the entries to be inserted

    • blockCapacity: any

      maximum capacity for each block node before it's been subdivided, might be exceeded if maxDepth is reached

    • curDepth: any

      depth before subdivided

    • maxDepth: any

      maximum depth of this tree

    • getBoundingShape: any

      a function takes an entry and returns its primitive info

    Returns OctreeBlock[]

    the sub blocks

Generated using TypeDoc