C# Class Hyperion.Accelerators.KdTree.KdTree

The KdTreeAccelerator aggregate speeds up intersectiontesting substantially by py putting a big bounding box around the whole scene and then cutting it down into several smaller boxes recursively, so that intersection testing is sped up pretty fast.
Inheritance: Hyperion.Core.Interfaces.IAggregate
Show file Open project: Kintaro/Hyperion

Public Properties

Property Type Description
NumberOfTotalLeafs int
NumberOfTotalNodes int

Public Methods

Method Description
BuildTree ( int nodeNum, BoundingBox nodeBounds, List allPrimBounds, int primNums, int numberOfPrimitives, int depth, List edges, int prims0, int prims1, int primIndex, int badRefines ) : void

Builds the Kd-Tree

CreateAccelerator ( List primitives, ParameterSet parameterSet ) : IAggregate

Creates a new Kd-Tree

Intersect ( Ray ray, Intersection &intersection ) : bool

Checks if the given ray intersects the primitive.

IntersectP ( Ray ray ) : bool

A quick check just to test if the ray intersects the primitive. This method doesn't fill in Intersection information, so this method is obviously faster for pure testing.

KdTree ( List p, int isectCost, int traversalCost, double emptyBonus, int maxPrimitives, int maxDepth ) : System

Creates a new KdTree

Method Details

BuildTree() public method

Builds the Kd-Tree
public BuildTree ( int nodeNum, BoundingBox nodeBounds, List allPrimBounds, int primNums, int numberOfPrimitives, int depth, List edges, int prims0, int prims1, int primIndex, int badRefines ) : void
nodeNum int /// The current node index ///
nodeBounds Hyperion.Core.Geometry.BoundingBox /// The node's bounding box ///
allPrimBounds List /// The primitive's bounding boxes ///
primNums int /// Array of primitive indices ///
numberOfPrimitives int /// Number of primitives to build from ///
depth int /// The current recursion depth ///
edges List /// Array of edges ///
prims0 int /// ///
prims1 int /// ///
primIndex int
badRefines int /// Amount of bad refines ///
return void

CreateAccelerator() public static method

Creates a new Kd-Tree
public static CreateAccelerator ( List primitives, ParameterSet parameterSet ) : IAggregate
primitives List /// List of primitives to include in the Tree ///
parameterSet ParameterSet /// Parameters for the Kd-Tree ///
return Hyperion.Core.Interfaces.IAggregate

Intersect() public method

Checks if the given ray intersects the primitive.
public Intersect ( Ray ray, Intersection &intersection ) : bool
ray Hyperion.Core.Geometry.Ray /// The ray to test for ///
intersection Hyperion.Core.Interfaces.Intersection /// A pointer to an Intersection structure that'll hold /// the intersection information. ///
return bool

IntersectP() public method

A quick check just to test if the ray intersects the primitive. This method doesn't fill in Intersection information, so this method is obviously faster for pure testing.
public IntersectP ( Ray ray ) : bool
ray Hyperion.Core.Geometry.Ray /// The ray to test for ///
return bool

KdTree() public method

Creates a new KdTree
public KdTree ( List p, int isectCost, int traversalCost, double emptyBonus, int maxPrimitives, int maxDepth ) : System
p List /// List of primitives to build the kd-Tree from ///
isectCost int /// Cost for an intersection ///
traversalCost int /// Cost for traversing along edges ///
emptyBonus double /// Bonus for empty leafs ///
maxPrimitives int /// Maximum amount of primitives per leaf ///
maxDepth int /// Maximum recursion depth ///
return System

Property Details

NumberOfTotalLeafs public static property

public static int NumberOfTotalLeafs
return int

NumberOfTotalNodes public static property

public static int NumberOfTotalNodes
return int