trees

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 4 Imported by: 0

README

Trees

Package dedicated to different trees used for spatially organizing 3D elements for aiding lookups in other packages in this repository like rendering and marching.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OctreeDepthFromCount

func OctreeDepthFromCount(count int) int

Types

type BoundingBoxElement added in v0.9.0

type BoundingBoxElement geometry.AABB

func (BoundingBoxElement) BoundingBox added in v0.9.0

func (be BoundingBoxElement) BoundingBox() geometry.AABB

func (BoundingBoxElement) ClosestPoint added in v0.9.0

func (be BoundingBoxElement) ClosestPoint(p vector3.Float64) vector3.Float64

type Element

type Element interface {
	BoundingBox() geometry.AABB
	ClosestPoint(p vector3.Float64) vector3.Float64
}

type KDTree

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

func NewKDTreeWithDepth

func NewKDTreeWithDepth(elements []Element, maxDepth int) *KDTree

func (KDTree) BoundingBox

func (kdt KDTree) BoundingBox() geometry.AABB

type OctTree

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

func NewOctree

func NewOctree(elements []Element) *OctTree

func NewOctreeWithDepth

func NewOctreeWithDepth(elements []Element, maxDepth int) *OctTree

func (OctTree) BoundingBox

func (ot OctTree) BoundingBox() geometry.AABB

func (OctTree) ClosestPoint

func (ot OctTree) ClosestPoint(v vector3.Float64) (int, vector3.Float64)

func (OctTree) ElementsContainingPoint

func (ot OctTree) ElementsContainingPoint(v vector3.Float64) []int

func (*OctTree) ElementsIntersectingRay

func (ot *OctTree) ElementsIntersectingRay(ray geometry.Ray, min, max float64) []int

func (OctTree) TraverseIntersectingRay added in v0.4.0

func (ot OctTree) TraverseIntersectingRay(ray geometry.Ray, min, max float64, iterator func(i int, min, max *float64))

type Tree

type Tree interface {
	TraverseIntersectingRay(ray geometry.Ray, min, max float64, iterator func(i int, min, max *float64))
	ElementsContainingPoint(v vector3.Float64) []int
	ClosestPoint(v vector3.Float64) (int, vector3.Float64)
	ElementsIntersectingRay(ray geometry.Ray, min, max float64) []int
	BoundingBox() geometry.AABB
}

Jump to

Keyboard shortcuts

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