spatial

package
v0.0.0-...-1c10fcc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OctreeMaxDepth     = 21
	OctreeMaxLeafItems = 100
)

Variables

View Source
var (
	ErrOctreeItemNotInserted = errors.New("item not inserted")
	ErrOctreeCannotSplitNode = errors.New("cannot split node")
)

Functions

This section is empty.

Types

type Octree

type Octree struct {
	// contains filtered or unexported fields
}

func NewOctree

func NewOctree(aabb meshx.AABB) *Octree

Construct a bounded octree.

func (*Octree) GetNumberOfItems

func (o *Octree) GetNumberOfItems() int

Get the number of indexed items.

func (*Octree) GetNumberOfNodes

func (o *Octree) GetNumberOfNodes() int

Get the number of nodes.

func (*Octree) Insert

func (o *Octree) Insert(item meshx.IntersectsAABB) error

Insert an item into the octree.

func (*Octree) Query

func (o *Octree) Query(query meshx.IntersectsAABB) []int

Query the octree for intersection items.

func (*Octree) Split

func (o *Octree) Split(code uint64) error

Split a leaf octree node into its eight octant children.

type OctreeNode

type OctreeNode struct {
	// contains filtered or unexported fields
}

func NewOctreeNode

func NewOctreeNode(code uint64, aabb meshx.AABB) *OctreeNode

Construct a leaf OctreeNode.

func (*OctreeNode) Children

func (o *OctreeNode) Children() []uint64

Compute the children octant codes.

func (*OctreeNode) Depth

func (o *OctreeNode) Depth() int

Compute the depth from the code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL