Bounding volume hierarchy (BVH), a tree structure for expediting geometric queries

Constructor

@:value({ _bucketCount : 8, _maxLeafSize : 4 })new(_mesh:Mesh, _maxLeafSize:Int = 4, _bucketCount:Int = 8)

Initialize a new BVH from parameters. (does not build the tree, build() should be explicitly called afterwards)

Parameters:

_mesh

the mesh

_maxLeafSize

maximum number of faces allowed in a leaf node

_bucketCount

number of buckets used for deciding the best partition

Variables

bucketCount:Int

Number of buckets used for deciding the best partition

faces:Array<Face>

A rearranged array of faces from the mesh, a permutation of a shallow copy of the original. (It contains pointers to the same faces, but is not the same array as mesh.faces)

maxLeafSize:Int

Maximum number of faces allowed in any of its leaf nodes

mesh:Mesh

pointer to the mesh this BVH belongs to

root:BVHNode

root node

Methods

build():Void

Build the bounding volume hierachy