Documentation
¶
Overview ¶
Package BVH implements an AABB-backed BVH tree.
Index ¶
- type O
- type T
- func (t *T) BroadPhase(q hyperrectangle.R) []id.ID
- func (t *T) IDs() []id.ID
- func (t *T) Insert(x id.ID, aabb hyperrectangle.R) error
- func (t *T) Query(f func(r hyperrectangle.R) bool) []id.ID
- func (t *T) Raycast(q ray.R) []id.ID
- func (t *T) Remove(x id.ID) error
- func (t *T) SAH() float64
- func (t *T) Update(x id.ID, aabb hyperrectangle.R) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type T ¶
type T struct {
// contains filtered or unexported fields
}
func (*T) BroadPhase ¶
func (t *T) BroadPhase(q hyperrectangle.R) []id.ID
BroadPhase finds all objects which intersect with the given input AABB.
func (*T) Insert ¶
Insert adds a new AABB into the BVH. The specific data structure which tracks this AABB is managed by the user (external to this library). After the AABB is mutated (e.g. during a simulation tick), the user must call Update to ensure the tree remains valid.
Because the AABB must remain static inside the BVH, we will create a new copy of the input.
func (*T) Query ¶
Query finds all objects which passes the input filtering function. BroadPhase and Raycast are special cases of the Query function. The input filter will be recursively applied; that is, the child of an internal BVH node will be searched only if the parent AABB also passes the filter.