hpp-fcl  2.4.1
HPP fork of FCL -- The Flexible Collision Library
hpp::fcl::details::GJK Struct Reference

class for GJK algorithm More...

#include <hpp/fcl/narrowphase/gjk.h>

Collaboration diagram for hpp::fcl::details::GJK:

Classes

struct  Simplex
 
struct  SimplexV
 

Public Types

enum  Status { Valid, Inside, Failed, EarlyStopped }
 Status of the GJK algorithm: Valid: GJK converged and the shapes are not in collision. Inside: GJK converged and the shapes are in collision. Failed: GJK did not converge. More...
 
typedef unsigned char vertex_id_t
 

Public Member Functions

 GJK (unsigned int max_iterations_, FCL_REAL tolerance_)
 
void initialize ()
 
Status evaluate (const MinkowskiDiff &shape, const Vec3f &guess, const support_func_guess_t &supportHint=support_func_guess_t::Zero())
 GJK algorithm, given the initial value guess. More...
 
void getSupport (const Vec3f &d, bool dIsNormalized, SimplexV &sv, support_func_guess_t &hint) const
 apply the support function along a direction, the result is return in sv More...
 
bool encloseOrigin ()
 whether the simplex enclose the origin More...
 
SimplexgetSimplex () const
 get the underlying simplex using in GJK, can be used for cache in next iteration More...
 
bool hasClosestPoints ()
 Tells whether the closest points are available. More...
 
bool hasPenetrationInformation (const MinkowskiDiff &shape)
 
bool getClosestPoints (const MinkowskiDiff &shape, Vec3f &w0, Vec3f &w1)
 
Vec3f getGuessFromSimplex () const
 get the guess from current simplex More...
 
void setDistanceEarlyBreak (const FCL_REAL &dup)
 Distance threshold for early break. GJK stops when it proved the distance is more than this threshold. More...
 
bool checkConvergence (const Vec3f &w, const FCL_REAL &rl, FCL_REAL &alpha, const FCL_REAL &omega)
 Convergence check used to stop GJK when shapes are not in collision. More...
 
size_t getIterations ()
 Get GJK number of iterations. More...
 
FCL_REAL getTolerance ()
 Get GJK tolerance. More...
 

Public Attributes

MinkowskiDiff const * shape
 
Vec3f ray
 
GJKVariant gjk_variant
 
GJKConvergenceCriterion convergence_criterion
 
GJKConvergenceCriterionType convergence_criterion_type
 
support_func_guess_t support_hint
 
FCL_REAL distance
 
Simplex simplices [2]
 

Detailed Description

class for GJK algorithm

Note
The computations are performed in the frame of the first shape.

Member Typedef Documentation

◆ vertex_id_t

typedef unsigned char hpp::fcl::details::GJK::vertex_id_t

Member Enumeration Documentation

◆ Status

Status of the GJK algorithm: Valid: GJK converged and the shapes are not in collision. Inside: GJK converged and the shapes are in collision. Failed: GJK did not converge.

Enumerator
Valid 
Inside 
Failed 
EarlyStopped 

Constructor & Destructor Documentation

◆ GJK()

hpp::fcl::details::GJK::GJK ( unsigned int  max_iterations_,
FCL_REAL  tolerance_ 
)
inline
Parameters
max_iterations_number of iteration before GJK returns failure.
tolerance_precision of the algorithm.

The tolerance argument is useful for continuous shapes and for polyhedron with some vertices closer than this threshold.

Suggested values are 100 iterations and a tolerance of 1e-6.

Member Function Documentation

◆ checkConvergence()

bool hpp::fcl::details::GJK::checkConvergence ( const Vec3f w,
const FCL_REAL rl,
FCL_REAL alpha,
const FCL_REAL omega 
)

Convergence check used to stop GJK when shapes are not in collision.

◆ encloseOrigin()

bool hpp::fcl::details::GJK::encloseOrigin ( )

whether the simplex enclose the origin

◆ evaluate()

Status hpp::fcl::details::GJK::evaluate ( const MinkowskiDiff shape,
const Vec3f guess,
const support_func_guess_t supportHint = support_func_guess_t::Zero() 
)

GJK algorithm, given the initial value guess.

◆ getClosestPoints()

bool hpp::fcl::details::GJK::getClosestPoints ( const MinkowskiDiff shape,
Vec3f w0,
Vec3f w1 
)

Get the closest points on each object.

Returns
true on success

◆ getGuessFromSimplex()

Vec3f hpp::fcl::details::GJK::getGuessFromSimplex ( ) const

get the guess from current simplex

◆ getIterations()

size_t hpp::fcl::details::GJK::getIterations ( )
inline

Get GJK number of iterations.

◆ getSimplex()

Simplex* hpp::fcl::details::GJK::getSimplex ( ) const
inline

get the underlying simplex using in GJK, can be used for cache in next iteration

◆ getSupport()

void hpp::fcl::details::GJK::getSupport ( const Vec3f d,
bool  dIsNormalized,
SimplexV sv,
support_func_guess_t hint 
) const
inline

apply the support function along a direction, the result is return in sv

◆ getTolerance()

FCL_REAL hpp::fcl::details::GJK::getTolerance ( )
inline

Get GJK tolerance.

◆ hasClosestPoints()

bool hpp::fcl::details::GJK::hasClosestPoints ( )
inline

Tells whether the closest points are available.

◆ hasPenetrationInformation()

bool hpp::fcl::details::GJK::hasPenetrationInformation ( const MinkowskiDiff shape)
inline

Tells whether the penetration information.

In such case, most indepth points and penetration depth can be retrieved from GJK. Calling EPA has an undefined behaviour.

◆ initialize()

void hpp::fcl::details::GJK::initialize ( )

◆ setDistanceEarlyBreak()

void hpp::fcl::details::GJK::setDistanceEarlyBreak ( const FCL_REAL dup)
inline

Distance threshold for early break. GJK stops when it proved the distance is more than this threshold.

Note
The closest points will be erroneous in this case. If you want the closest points, set this to infinity (the default).

Member Data Documentation

◆ convergence_criterion

GJKConvergenceCriterion hpp::fcl::details::GJK::convergence_criterion

◆ convergence_criterion_type

GJKConvergenceCriterionType hpp::fcl::details::GJK::convergence_criterion_type

◆ distance

FCL_REAL hpp::fcl::details::GJK::distance

The distance computed by GJK. The possible values are

  • \( d = - R - 1 \) when a collision is detected and GJK cannot compute penetration informations.
  • \( - R \le d \le 0 \) when a collision is detected and GJK can compute penetration informations.
  • \( 0 < d \le d_{ub} \) when there is no collision and GJK can compute the closest points.
  • \( d_{ub} < d \) when there is no collision and GJK cannot compute the closest points.

where \( d \) is the GJK::distance, \( R \) is the sum of the shape MinkowskiDiff::inflation and \( d_{ub} \) is the GJK::distance_upper_bound.

◆ gjk_variant

GJKVariant hpp::fcl::details::GJK::gjk_variant

◆ ray

Vec3f hpp::fcl::details::GJK::ray

◆ shape

MinkowskiDiff const* hpp::fcl::details::GJK::shape

◆ simplices

Simplex hpp::fcl::details::GJK::simplices[2]

◆ support_hint

support_func_guess_t hpp::fcl::details::GJK::support_hint

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