Obi  6.4
Unified particle physics for Unity
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Obi.BIH Class Reference

Static Public Member Functions

static BIHNode[] Build (ref IBounded[] elements, int maxDepth=10, float maxOverlap=0.7f)
 
static int HoarePartition (IBounded[] elements, int start, int end, float pivot, ref BIHNode node, int axis)
 
static float DistanceToSurface (Triangle[] triangles, Vector3[] vertices, Vector3[] normals, in BIHNode node, in Vector3 point)
 
static float DistanceToSurface (BIHNode[] nodes, Triangle[] triangles, Vector3[] vertices, Vector3[] normals, in Vector3 point)
 
static float DistanceToSurface (BIHNode[] nodes, Triangle[] triangles, Vector3[] vertices, Vector3[] normals, in BIHNode node, in Vector3 point)
 

Member Function Documentation

static float Obi.BIH.DistanceToSurface ( BIHNode[]  nodes,
Triangle[]  triangles,
Vector3[]  vertices,
Vector3[]  normals,
in BIHNode  node,
in Vector3  point 
)
static

If the current node is not a leaf, figure out which side of the split plane that contains the query point, and recurse down that side. You will get the index and distance to the closest triangle in that subtree. Then, check if the distance to the nearest triangle is closer to the query point than the distance between the query point and the split plane. If it is closer, there is no need to recurse down the other side of the KD tree and you can just return. Otherwise, you will need to recurse down the other way too, and return whichever result is closer.


The documentation for this class was generated from the following file: