Kigs Framework  Doc version 0.8
Open source multi purpose Rapid Application Development framework
Static Public Member Functions | List of all members
Distance Class Reference

#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...
 

Detailed Description

Encapsulate useful distance calculation methods.

Member Function Documentation

◆ PointAABB()

kfloat Distance::PointAABB ( const Point3D &  P,
const Point3D &  BMin,
const Point3D &  BMax,
Point3D &  MinDistPoint 
)
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

◆ PointAABBAtOrigin()

kfloat Distance::PointAABBAtOrigin ( const Point3D &  P,
const Vector3D &  BoxSize,
Point3D &  MinDistPoint 
)
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

◆ PointMesh()

kfloat Distance::PointMesh ( const Point3D &  P,
const Mesh pMesh,
Mesh::Triangle *&  TrianglePtr 
)
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

◆ PointOBB()

kfloat Distance::PointOBB ( const Point3D &  P,
const Matrix3x4 &  OrientationMatrix,
Vector3D &  BoxSize,
Point3D &  MinDistPoint 
)
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

◆ PointPlane()

kfloat Distance::PointPlane ( const Point3D &  P,
const Vector3D &  PlaneNormal,
const Point3D &  PlaneOrigin 
)
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)

◆ PointTriangle()

kfloat Distance::PointTriangle ( const Point3D &  P,
const Point3D &  A,
const Point3D &  B,
const Point3D &  C 
)
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


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