Kigs Framework
Doc version 0.8
Open source multi purpose Rapid Application Development framework

#include <Distance.h>
Static Public Member Functions  
static kfloat  PointTriangle (const Point3D &P, const Point3D &A, const Point3D &B, const Point3D &C) 
return distance from point to triangle triangle is given by points A,B,C More...  
static kfloat  PointMesh (const Point3D &P, const Mesh *pMesh, Mesh::Triangle *&TrianglePtr) 
return distance from point to mesh the triangle from the mesh, where the distance is shortest is returned More...  
static kfloat  PointAABBAtOrigin (const Point3D &P, const Vector3D &BoxSize, Point3D &MinDistPoint) 
return distance from point to axis aligned box the box is defined by a vector (diagonal), and centered on the origin point (0,0,0) More...  
static kfloat  PointAABB (const Point3D &P, const Point3D &BMin, const Point3D &BMax, Point3D &MinDistPoint) 
return distance from point to axis aligned box the box is defined by min and max points More...  
static kfloat  PointOBB (const Point3D &P, const Matrix3x4 &OrientationMatrix, Vector3D &BoxSize, Point3D &MinDistPoint) 
return distance from point to oriented box the box is defined a size (diagonal vector) and a transform matrix (rotation/scale and position) More...  
static kfloat  PointPlane (const Point3D &P, const Vector3D &PlaneNormal, const Point3D &PlaneOrigin) 
return distance from point to plane plane is given by point PlaneOrigin and normal PlaneNormal More...  
Encapsulate useful distance calculation methods.

static 
return distance from point to axis aligned box the box is defined by min and max points
compute distance from a point (P) to a BBOX (min and max poins) also return the nearest point on the BBox
first check on x axis
then check on y axis
then check on z axis

static 
return distance from point to axis aligned box the box is defined by a vector (diagonal), and centered on the origin point (0,0,0)
compute distance from a point (P) to a BBOX centered at origin (half diagonal) also return the nearest point on the BBox
first check on x axis
then check on y axis
then check on z axis

static 
return distance from point to mesh the triangle from the mesh, where the distance is shortest is returned
compute distance from a point (P) to a mesh also return the nearest triangle
select the minimal distance

static 
return distance from point to oriented box the box is defined a size (diagonal vector) and a transform matrix (rotation/scale and position)
compute distance from a point (P) to an oriented BOX (half diagonal in local coordinate system, and transform matrix) also return the nearest point on the BBox
first compute point coordinate in local Box coordinate system
then use PointAABBAtOrigin method
and transform intersection point back again in global space
probably a bug to check here : returned distance is computed in local space so no scale is applied even if transform matrix has a scale

static 
return distance from point to plane plane is given by point PlaneOrigin and normal PlaneNormal
compute distance from a point (P) to an plane (Origin and Normal)

static 
return distance from point to triangle triangle is given by points A,B,C
compute distance from a point (P) to a triangle (A,B,C) seperate plane in parts