Bullet Collision Detection & Physics Library
Macros | Enumerations | Functions | Variables
boxBoxDistance.cpp File Reference
#include <math.h>
#include "../PlatformDefinitions.h"
#include "boxBoxDistance.h"
Include dependency graph for boxBoxDistance.cpp:

Go to the source code of this file.

Macros

#define AaxisTest(dim, letter, first)
 
#define BaxisTest(dim, letter)
 
#define CrossAxisTest(dima, dimb, letterb)
 
#define VertexBFaceA_SetNewMin()
 
#define VertexAFaceB_SetNewMin()
 
#define CustomEdgeEdgeTest(ac, ac_letter, ad, ad_letter, bc, bc_letter, bd, bd_letter)
 
#define EdgeEdge_SetNewMin(ac_letter, ad_letter, bc_letter, bd_letter)
 

Enumerations

enum  BoxSepAxisType {
  A_AXIS,
  B_AXIS,
  CROSS_AXIS
}
 

Functions

static float sqr (float a)
 
float VertexBFaceATest (bool &inVoronoi, float &t0, float &t1, const vmVector3 &hA, PE_REF(vmVector3) faceOffsetAB, PE_REF(vmVector3) faceOffsetBA, const vmMatrix3 &matrixAB, const vmMatrix3 &matrixBA, PE_REF(vmVector3) signsB, PE_REF(vmVector3) scalesB)
 
void VertexBFaceATests (bool &done, float &minDistSqr, vmPoint3 &localPointA, vmPoint3 &localPointB, FeatureType &featureA, FeatureType &featureB, const vmVector3 &hA, PE_REF(vmVector3) faceOffsetAB, PE_REF(vmVector3) faceOffsetBA, const vmMatrix3 &matrixAB, const vmMatrix3 &matrixBA, PE_REF(vmVector3) signsB, PE_REF(vmVector3) scalesB, bool first)
 
float VertexAFaceBTest (bool &inVoronoi, float &t0, float &t1, const vmVector3 &hB, PE_REF(vmVector3) faceOffsetAB, PE_REF(vmVector3) faceOffsetBA, const vmMatrix3 &matrixAB, const vmMatrix3 &matrixBA, PE_REF(vmVector3) signsA, PE_REF(vmVector3) scalesA)
 
void VertexAFaceBTests (bool &done, float &minDistSqr, vmPoint3 &localPointA, vmPoint3 &localPointB, FeatureType &featureA, FeatureType &featureB, const vmVector3 &hB, PE_REF(vmVector3) faceOffsetAB, PE_REF(vmVector3) faceOffsetBA, const vmMatrix3 &matrixAB, const vmMatrix3 &matrixBA, PE_REF(vmVector3) signsA, PE_REF(vmVector3) scalesA, bool first)
 
float CustomEdgeEdgeTest_0101 (bool &inVoronoi, float &tA, float &tB, const vmVector3 &hA, const vmVector3 &hB, PE_REF(vmVector3) faceOffsetAB, PE_REF(vmVector3) faceOffsetBA, const vmMatrix3 &matrixAB, const vmMatrix3 &matrixBA, PE_REF(vmVector3) signsA, PE_REF(vmVector3) signsB, PE_REF(vmVector3) scalesA, PE_REF(vmVector3) scalesB)
 
float CustomEdgeEdgeTest_0110 (bool &inVoronoi, float &tA, float &tB, const vmVector3 &hA, const vmVector3 &hB, PE_REF(vmVector3) faceOffsetAB, PE_REF(vmVector3) faceOffsetBA, const vmMatrix3 &matrixAB, const vmMatrix3 &matrixBA, PE_REF(vmVector3) signsA, PE_REF(vmVector3) signsB, PE_REF(vmVector3) scalesA, PE_REF(vmVector3) scalesB)
 
float CustomEdgeEdgeTest_1001 (bool &inVoronoi, float &tA, float &tB, const vmVector3 &hA, const vmVector3 &hB, PE_REF(vmVector3) faceOffsetAB, PE_REF(vmVector3) faceOffsetBA, const vmMatrix3 &matrixAB, const vmMatrix3 &matrixBA, PE_REF(vmVector3) signsA, PE_REF(vmVector3) signsB, PE_REF(vmVector3) scalesA, PE_REF(vmVector3) scalesB)
 
float CustomEdgeEdgeTest_1010 (bool &inVoronoi, float &tA, float &tB, const vmVector3 &hA, const vmVector3 &hB, PE_REF(vmVector3) faceOffsetAB, PE_REF(vmVector3) faceOffsetBA, const vmMatrix3 &matrixAB, const vmMatrix3 &matrixBA, PE_REF(vmVector3) signsA, PE_REF(vmVector3) signsB, PE_REF(vmVector3) scalesA, PE_REF(vmVector3) scalesB)
 
void EdgeEdgeTests (bool &done, float &minDistSqr, vmPoint3 &localPointA, vmPoint3 &localPointB, int &otherFaceDimA, int &otherFaceDimB, FeatureType &featureA, FeatureType &featureB, const vmVector3 &hA, const vmVector3 &hB, PE_REF(vmVector3) faceOffsetAB, PE_REF(vmVector3) faceOffsetBA, const vmMatrix3 &matrixAB, const vmMatrix3 &matrixBA, PE_REF(vmVector3) signsA, PE_REF(vmVector3) signsB, PE_REF(vmVector3) scalesA, PE_REF(vmVector3) scalesB, bool first)
 
float boxBoxDistance (vmVector3 &normal, BoxPoint &boxPointA, BoxPoint &boxPointB, PE_REF(Box) boxA, const vmTransform3 &transformA, PE_REF(Box) boxB, const vmTransform3 &transformB, float distanceThreshold)
 

Variables

static const float voronoiTol = -1.0e-5f
 

Macro Definition Documentation

#define AaxisTest (   dim,
  letter,
  first 
)
Value:
{ \
if ( first ) \
{ \
maxGap = gap = gapsA.get##letter(); \
if ( gap > distanceThreshold ) return gap; \
axisType = A_AXIS; \
faceDimA = dim; \
axisA = identity.getCol##dim(); \
} \
else \
{ \
gap = gapsA.get##letter(); \
if ( gap > distanceThreshold ) return gap; \
else if ( gap > maxGap ) \
{ \
maxGap = gap; \
axisType = A_AXIS; \
faceDimA = dim; \
axisA = identity.getCol##dim(); \
} \
} \
}

Definition at line 45 of file boxBoxDistance.cpp.

#define BaxisTest (   dim,
  letter 
)
Value:
{ \
gap = gapsB.get##letter(); \
if ( gap > distanceThreshold ) return gap; \
else if ( gap > maxGap ) \
{ \
maxGap = gap; \
axisType = B_AXIS; \
faceDimB = dim; \
axisB = identity.getCol##dim(); \
} \
}

Definition at line 70 of file boxBoxDistance.cpp.

#define CrossAxisTest (   dima,
  dimb,
  letterb 
)
Value:
{ \
const float lsqr_tolerance = 1.0e-30f; \
float lsqr; \
\
lsqr = lsqrs.getCol##dima().get##letterb(); \
\
if ( lsqr > lsqr_tolerance ) \
{ \
float l_recip = 1.0f / sqrtf( lsqr ); \
gap = float(gapsAxB.getCol##dima().get##letterb()) * l_recip; \
\
if ( gap > distanceThreshold ) \
{ \
return gap; \
} \
\
if ( gap > maxGap ) \
{ \
maxGap = gap; \
axisType = CROSS_AXIS; \
edgeDimA = dima; \
edgeDimB = dimb; \
axisA = cross(identity.getCol##dima(),matrixAB.getCol##dimb()) * l_recip; \
} \
} \
}
static float4 cross(const float4 &a, const float4 &b)

Definition at line 83 of file boxBoxDistance.cpp.

#define CustomEdgeEdgeTest (   ac,
  ac_letter,
  ad,
  ad_letter,
  bc,
  bc_letter,
  bd,
  bd_letter 
)

Definition at line 381 of file boxBoxDistance.cpp.

#define EdgeEdge_SetNewMin (   ac_letter,
  ad_letter,
  bc_letter,
  bd_letter 
)
Value:
{ \
minDistSqr = distSqr; \
localPointA.set##ac_letter(scalesA.get##ac_letter()); \
localPointA.set##ad_letter(tA); \
localPointB.set##bc_letter(scalesB.get##bc_letter()); \
localPointB.set##bd_letter(tB); \
otherFaceDimA = testOtherFaceDimA; \
otherFaceDimB = testOtherFaceDimB; \
featureA = E; \
featureB = E; \
}
float distSqr(const Point3 &pnt0, const Point3 &pnt1)
Definition: Box.h:33

Definition at line 518 of file boxBoxDistance.cpp.

#define VertexAFaceB_SetNewMin ( )
Value:
{ \
minDistSqr = distSqr; \
localPointB.setX(t0); \
localPointB.setY(t1); \
localPointA.setX( scalesA.getX() ); \
localPointA.setY( scalesA.getY() ); \
featureA = V; \
featureB = F; \
}
Definition: Box.h:33
float distSqr(const Point3 &pnt0, const Point3 &pnt1)
Definition: Box.h:33

Definition at line 287 of file boxBoxDistance.cpp.

#define VertexBFaceA_SetNewMin ( )
Value:
{ \
minDistSqr = distSqr; \
localPointA.setX(t0); \
localPointA.setY(t1); \
localPointB.setX( scalesB.getX() ); \
localPointB.setY( scalesB.getY() ); \
featureA = F; \
featureB = V; \
}
Definition: Box.h:33
float distSqr(const Point3 &pnt0, const Point3 &pnt1)
Definition: Box.h:33

Definition at line 161 of file boxBoxDistance.cpp.

Enumeration Type Documentation

Enumerator
A_AXIS 
B_AXIS 
CROSS_AXIS 

Definition at line 29 of file boxBoxDistance.cpp.

Function Documentation

float boxBoxDistance ( vmVector3 normal,
BoxPoint boxPointA,
BoxPoint boxPointB,
PE_REF(Box boxA,
const vmTransform3 transformA,
PE_REF(Box boxB,
const vmTransform3 transformB,
float  distanceThreshold 
)

Definition at line 777 of file boxBoxDistance.cpp.

float CustomEdgeEdgeTest_0101 ( bool &  inVoronoi,
float &  tA,
float &  tB,
const vmVector3 hA,
const vmVector3 hB,
PE_REF(vmVector3 faceOffsetAB,
PE_REF(vmVector3 faceOffsetBA,
const vmMatrix3 matrixAB,
const vmMatrix3 matrixBA,
PE_REF(vmVector3 signsA,
PE_REF(vmVector3 signsB,
PE_REF(vmVector3 scalesA,
PE_REF(vmVector3 scalesB 
)

Definition at line 443 of file boxBoxDistance.cpp.

float CustomEdgeEdgeTest_0110 ( bool &  inVoronoi,
float &  tA,
float &  tB,
const vmVector3 hA,
const vmVector3 hB,
PE_REF(vmVector3 faceOffsetAB,
PE_REF(vmVector3 faceOffsetBA,
const vmMatrix3 matrixAB,
const vmMatrix3 matrixBA,
PE_REF(vmVector3 signsA,
PE_REF(vmVector3 signsB,
PE_REF(vmVector3 scalesA,
PE_REF(vmVector3 scalesB 
)

Definition at line 462 of file boxBoxDistance.cpp.

float CustomEdgeEdgeTest_1001 ( bool &  inVoronoi,
float &  tA,
float &  tB,
const vmVector3 hA,
const vmVector3 hB,
PE_REF(vmVector3 faceOffsetAB,
PE_REF(vmVector3 faceOffsetBA,
const vmMatrix3 matrixAB,
const vmMatrix3 matrixBA,
PE_REF(vmVector3 signsA,
PE_REF(vmVector3 signsB,
PE_REF(vmVector3 scalesA,
PE_REF(vmVector3 scalesB 
)

Definition at line 481 of file boxBoxDistance.cpp.

float CustomEdgeEdgeTest_1010 ( bool &  inVoronoi,
float &  tA,
float &  tB,
const vmVector3 hA,
const vmVector3 hB,
PE_REF(vmVector3 faceOffsetAB,
PE_REF(vmVector3 faceOffsetBA,
const vmMatrix3 matrixAB,
const vmMatrix3 matrixBA,
PE_REF(vmVector3 signsA,
PE_REF(vmVector3 signsB,
PE_REF(vmVector3 scalesA,
PE_REF(vmVector3 scalesB 
)

Definition at line 500 of file boxBoxDistance.cpp.

void EdgeEdgeTests ( bool &  done,
float &  minDistSqr,
vmPoint3 localPointA,
vmPoint3 localPointB,
int &  otherFaceDimA,
int &  otherFaceDimB,
FeatureType featureA,
FeatureType featureB,
const vmVector3 hA,
const vmVector3 hB,
PE_REF(vmVector3 faceOffsetAB,
PE_REF(vmVector3 faceOffsetBA,
const vmMatrix3 matrixAB,
const vmMatrix3 matrixBA,
PE_REF(vmVector3 signsA,
PE_REF(vmVector3 signsB,
PE_REF(vmVector3 scalesA,
PE_REF(vmVector3 scalesB,
bool  first 
)

Definition at line 532 of file boxBoxDistance.cpp.

static float sqr ( float  a)
inlinestatic

Definition at line 24 of file boxBoxDistance.cpp.

float VertexAFaceBTest ( bool &  inVoronoi,
float &  t0,
float &  t1,
const vmVector3 hB,
PE_REF(vmVector3 faceOffsetAB,
PE_REF(vmVector3 faceOffsetBA,
const vmMatrix3 matrixAB,
const vmMatrix3 matrixBA,
PE_REF(vmVector3 signsA,
PE_REF(vmVector3 scalesA 
)
inline

Definition at line 250 of file boxBoxDistance.cpp.

void VertexAFaceBTests ( bool &  done,
float &  minDistSqr,
vmPoint3 localPointA,
vmPoint3 localPointB,
FeatureType featureA,
FeatureType featureB,
const vmVector3 hB,
PE_REF(vmVector3 faceOffsetAB,
PE_REF(vmVector3 faceOffsetBA,
const vmMatrix3 matrixAB,
const vmMatrix3 matrixBA,
PE_REF(vmVector3 signsA,
PE_REF(vmVector3 scalesA,
bool  first 
)

Definition at line 299 of file boxBoxDistance.cpp.

float VertexBFaceATest ( bool &  inVoronoi,
float &  t0,
float &  t1,
const vmVector3 hA,
PE_REF(vmVector3 faceOffsetAB,
PE_REF(vmVector3 faceOffsetBA,
const vmMatrix3 matrixAB,
const vmMatrix3 matrixBA,
PE_REF(vmVector3 signsB,
PE_REF(vmVector3 scalesB 
)
inline

Definition at line 117 of file boxBoxDistance.cpp.

void VertexBFaceATests ( bool &  done,
float &  minDistSqr,
vmPoint3 localPointA,
vmPoint3 localPointB,
FeatureType featureA,
FeatureType featureB,
const vmVector3 hA,
PE_REF(vmVector3 faceOffsetAB,
PE_REF(vmVector3 faceOffsetBA,
const vmMatrix3 matrixAB,
const vmMatrix3 matrixBA,
PE_REF(vmVector3 signsB,
PE_REF(vmVector3 scalesB,
bool  first 
)

Definition at line 173 of file boxBoxDistance.cpp.

Variable Documentation

const float voronoiTol = -1.0e-5f
static

Definition at line 38 of file boxBoxDistance.cpp.