cheshirekow  v0.1.0
mpblocks::gjk88 Namespace Reference

Classes

struct  MinkowskiPair
 

Typedefs

template<class Point >
using PairVec = std::vector< MinkowskiPair< Point > >
 

Enumerations

enum  Result { COLLISION, COLLISION_FREE, INDETERMINANT }
 

Functions

template<class Ops , class Point >
bool advanceSimplex (Ops &ops, std::vector< MinkowskiPair< Point > > &simplex, Point &dir)
 returns true if the origin is contained in the simplex, and if it is not, returns false and generates a new search direction More...
 
template<class Ops , class Point >
bool advanceSimplex2 (Ops &ops, PairVec< Point > &simplex, Point &dir)
 returns true if the origin is contained in the segment More...
 
template<class Ops , class Point >
bool advanceSimplex3 (Ops &ops, PairVec< Point > &simplex, Point &dir)
 returns true if the origin is contained in the triangle More...
 
template<class Ops , class Point >
bool advanceSimplex4 (Ops &ops, PairVec< Point > &simplex, Point &dir)
 returns true if the origin is contained in the tetrahedron More...
 
template<class Ops , class SupportFn , class Point , class SimplexHistory , class PointHistory >
Result collisionDistance_2d_debug (Ops ops, SupportFn supportFn, Point &a, Point &b, Point &v, SimplexHistory sHist, PointHistory vHist, int maxIter=100)
 
template<class Ops , class SupportFn , class Point >
Result collisionDistance_3d (Ops ops, SupportFn supportFn, Point &a, Point &b, Point &v, int maxIter=100)
 
template<class Ops , class SupportFn , class Point , class SimplexHistory , class PointHistory , class ErrorHistory >
Result collisionDistance_3d_debug (Ops ops, SupportFn supportFn, Point &a, Point &b, Point &v, SimplexHistory sHist, PointHistory vHist, ErrorHistory eHist, int maxIter=100)
 
template<class Ops , class Point >
bool growSimplex2 (Ops &ops, PairVec< Point > &simplex, Point &v)
 returns true if the origin is contained in the segment More...
 
template<class Ops , class Point >
bool growSimplex3_2d (Ops &ops, PairVec< Point > &simplex, Point &v)
 returns true if the origin is contained in the triangle More...
 
template<class Ops , class Point >
bool growSimplex3_3d (Ops &ops, PairVec< Point > &simplex, Point &v)
 returns true if the origin is contained in the triangle More...
 
template<class Ops , class Point >
bool growSimplex4_3d (Ops &ops, PairVec< Point > &simplex, Point &v, int depth=0)
 returns true if the origin is contained in the tetrahedron More...
 
template<class Ops , class Point >
bool growSimplex_2d (Ops &ops, std::vector< MinkowskiPair< Point > > &simplex, Point &v)
 returns true if the origin is contained in the simplex, and if it is not, returns false and generates a new search direction More...
 
template<class Ops , class Point >
bool growSimplex_3d (Ops &ops, std::vector< MinkowskiPair< Point > > &simplex, Point &v)
 returns true if the origin is contained in the simplex, and if it is not, returns false and generates a new search direction More...
 
template<class Ops , class SupportFn , class Point >
Result isCollision (Ops ops, SupportFn supportFn, Point &a, Point &b, Point &d, int maxIter=100)
 GJK algorithm, determines if two convex objects are in collision. More...
 
template<int NDim, class Point >
bool isEqual (const Point &a, const Point &b)
 
template<typename T >
int sgn (T val)
 

Typedef Documentation

template<class Point >
using mpblocks::gjk88::PairVec = typedef std::vector< MinkowskiPair<Point> >

Definition at line 70 of file gjk88.h.

Enumeration Type Documentation

Enumerator
COLLISION 
COLLISION_FREE 
INDETERMINANT 

Definition at line 61 of file gjk88.h.

Function Documentation

template<class Ops , class Point >
bool mpblocks::gjk88::advanceSimplex ( Ops &  ops,
std::vector< MinkowskiPair< Point > > &  simplex,
Point &  dir 
)

returns true if the origin is contained in the simplex, and if it is not, returns false and generates a new search direction

Definition at line 295 of file gjk88.h.

template<class Ops , class Point >
bool mpblocks::gjk88::advanceSimplex2 ( Ops &  ops,
PairVec< Point > &  simplex,
Point &  dir 
)

returns true if the origin is contained in the segment

Definition at line 75 of file gjk88.h.

template<class Ops , class Point >
bool mpblocks::gjk88::advanceSimplex3 ( Ops &  ops,
PairVec< Point > &  simplex,
Point &  dir 
)

returns true if the origin is contained in the triangle

Definition at line 103 of file gjk88.h.

template<class Ops , class Point >
bool mpblocks::gjk88::advanceSimplex4 ( Ops &  ops,
PairVec< Point > &  simplex,
Point &  dir 
)

returns true if the origin is contained in the tetrahedron

Definition at line 183 of file gjk88.h.

template<class Ops , class SupportFn , class Point , class SimplexHistory , class PointHistory >
Result mpblocks::gjk88::collisionDistance_2d_debug ( Ops  ops,
SupportFn  supportFn,
Point &  a,
Point &  b,
Point &  v,
SimplexHistory  sHist,
PointHistory  vHist,
int  maxIter = 100 
)

Definition at line 765 of file gjk88.h.

template<class Ops , class SupportFn , class Point >
Result mpblocks::gjk88::collisionDistance_3d ( Ops  ops,
SupportFn  supportFn,
Point &  a,
Point &  b,
Point &  v,
int  maxIter = 100 
)

Definition at line 810 of file gjk88.h.

template<class Ops , class SupportFn , class Point , class SimplexHistory , class PointHistory , class ErrorHistory >
Result mpblocks::gjk88::collisionDistance_3d_debug ( Ops  ops,
SupportFn  supportFn,
Point &  a,
Point &  b,
Point &  v,
SimplexHistory  sHist,
PointHistory  vHist,
ErrorHistory  eHist,
int  maxIter = 100 
)

Definition at line 846 of file gjk88.h.

template<class Ops , class Point >
bool mpblocks::gjk88::growSimplex2 ( Ops &  ops,
PairVec< Point > &  simplex,
Point &  v 
)

returns true if the origin is contained in the segment

Definition at line 414 of file gjk88.h.

template<class Ops , class Point >
bool mpblocks::gjk88::growSimplex3_2d ( Ops &  ops,
PairVec< Point > &  simplex,
Point &  v 
)

returns true if the origin is contained in the triangle

Definition at line 440 of file gjk88.h.

template<class Ops , class Point >
bool mpblocks::gjk88::growSimplex3_3d ( Ops &  ops,
PairVec< Point > &  simplex,
Point &  v 
)

returns true if the origin is contained in the triangle

Definition at line 485 of file gjk88.h.

template<class Ops , class Point >
bool mpblocks::gjk88::growSimplex4_3d ( Ops &  ops,
PairVec< Point > &  simplex,
Point &  v,
int  depth = 0 
)

returns true if the origin is contained in the tetrahedron

Definition at line 567 of file gjk88.h.

template<class Ops , class Point >
bool mpblocks::gjk88::growSimplex_2d ( Ops &  ops,
std::vector< MinkowskiPair< Point > > &  simplex,
Point &  v 
)

returns true if the origin is contained in the simplex, and if it is not, returns false and generates a new search direction

Definition at line 709 of file gjk88.h.

template<class Ops , class Point >
bool mpblocks::gjk88::growSimplex_3d ( Ops &  ops,
std::vector< MinkowskiPair< Point > > &  simplex,
Point &  v 
)

returns true if the origin is contained in the simplex, and if it is not, returns false and generates a new search direction

Definition at line 731 of file gjk88.h.

template<class Ops , class SupportFn , class Point >
Result mpblocks::gjk88::isCollision ( Ops  ops,
SupportFn  supportFn,
Point &  a,
Point &  b,
Point &  d,
int  maxIter = 100 
)

GJK algorithm, determines if two convex objects are in collision.

Template Parameters
Opsclass providing vector math, see note
SupportFnfunctional which computes support points, see note
Pointa three dimensional vector type, must support math operators + and -
Parameters
opsprovides vector math, see note
supportFncomputes support points given a search direction
a[in|out]initial search point from object A
b[in|out]initial search point frmo object B
d[out]output, the last search direction from the algorithm
maxIterthe maximum number of iterations to run
Returns
either COLLISION, COLLISION_FREE, or INDETERMINANT if maxIter is reached
Note
Vector Math:

The point class must support arithmetic operations. For two points a,b the following must be valid and mean what they usually do:

  • a+b
  • a-b
  • -a

The Ops struct provides dot product and cross product for the point type. These functions may be static, and ops need not have size (in fact, it probably shouldn't).

Note
Support Function:

SupportFn (and the object of it's type supportFn) is a functional (i.e. has an operator() ) which implements the support function for the object pair. The signature should be something like:

void operator()( const Point& d, Point& a, Point& b )

d is the search direction, and a and b are the function outputs. They should be the max/min points in the search direction from the two objects A/B (respectively).

Definition at line 365 of file gjk88.h.

template<int NDim, class Point >
bool mpblocks::gjk88::isEqual ( const Point &  a,
const Point &  b 
)

Definition at line 800 of file gjk88.h.

template<typename T >
int mpblocks::gjk88::sgn ( val)

Definition at line 39 of file gjk88.h.