Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AABB ¶
AABB is an axis-aligned bounding box.
type IntersectFn ¶
type IntersectFn func(*ray.Ray, *IntersectResult)
IntersectFn implements intersection with a ray.
type IntersectResult ¶
IntersectResult holds the results of an intersection.
type Intersector ¶
type Intersector interface { // Intersect must make no assumtions about the initial state of IntersectionResult and // must be sure to set all fields appropriately. Intersect(*ray.Ray, *IntersectResult) AABB() *AABB }
Intersector is an object that can be tested for intersection with a ray.
type Node ¶
type Node struct { Right *Node Left *Node Object Intersector // contains filtered or unexported fields }
Node is a node in the BVH tree. They have up to 2 child nodes and an optional Object. Nodes without children are leaves. Non-leaf Nodes are not expected to contain Objcts.
func NewTree ¶
func NewTree(objects []Intersector) *Node
NewTree takes a list of Intersectors and returns the root of a BVH tree. An empty slice returns nil.
Click to show internal directories.
Click to hide internal directories.