coal 3.0.2 Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library |
class for GJK algorithm More...
#include <coal/narrowphase/gjk.h>
Classes | |
| struct | Simplex |
| A simplex is a set of up to 4 vertices. Its rank is the number of vertices it contains. More... | |
| struct | SimplexV |
Public Types | |
| enum | Status { DidNotRun , Failed , NoCollisionEarlyStopped , NoCollision , CollisionWithPenetrationInformation , Collision } |
| Status of the GJK algorithm: DidNotRun: GJK has not been run. Failed: GJK did not converge (it exceeded the maximum number of iterations). NoCollisionEarlyStopped: GJK found a separating hyperplane and exited before converting. The shapes are not in collision. NoCollision: GJK converged and the shapes are not in collision. Collision: GJK converged and the shapes are in collision. Failed: GJK did not converge. More... | |
| typedef unsigned char | vertex_id_t |
Public Member Functions | |
| GJK (size_t max_iterations_, CoalScalar tolerance_) | |
| void | reset (size_t max_iterations_, CoalScalar tolerance_) |
| resets the GJK algorithm, preparing it for a new run. Other than the maximum number of iterations and the tolerance, this function does not modify the parameters of the GJK algorithm. | |
| Status | evaluate (const MinkowskiDiff &shape, const Vec3s &guess, const support_func_guess_t &supportHint=support_func_guess_t::Zero()) |
| GJK algorithm, given the initial value guess. | |
| void | getSupport (const Vec3s &d, SimplexV &sv, support_func_guess_t &hint) const |
| apply the support function along a direction, the result is return in sv | |
| bool | encloseOrigin () |
| whether the simplex enclose the origin | |
| Simplex * | getSimplex () const |
| get the underlying simplex using in GJK, can be used for cache in next iteration | |
| bool | hasClosestPoints () const |
| Tells whether the closest points are available. | |
| void | getWitnessPointsAndNormal (const MinkowskiDiff &shape, Vec3s &w0, Vec3s &w1, Vec3s &normal) const |
| Vec3s | getGuessFromSimplex () const |
| get the guess from current simplex | |
| void | setDistanceEarlyBreak (const CoalScalar &dup) |
| Distance threshold for early break. GJK stops when it proved the distance is more than this threshold. | |
| bool | checkConvergence (const Vec3s &w, const CoalScalar &rl, CoalScalar &alpha, const CoalScalar &omega) const |
| Convergence check used to stop GJK when shapes are not in collision. | |
| size_t | getNumMaxIterations () const |
| Get the max number of iterations of GJK. | |
| CoalScalar | getTolerance () const |
| Get the tolerance of GJK. | |
| size_t | getNumIterations () const |
| Get the number of iterations of the last run of GJK. | |
| size_t | getNumIterationsMomentumStopped () const |
| Get GJK number of iterations before momentum stops. Only usefull if the Nesterov or Polyak acceleration activated. | |
Public Attributes | |
| CoalScalar | distance_upper_bound |
| Status | status |
| GJKVariant | gjk_variant |
| GJKConvergenceCriterion | convergence_criterion |
| GJKConvergenceCriterionType | convergence_criterion_type |
| MinkowskiDiff const * | shape |
| Vec3s | ray |
| support_func_guess_t | support_hint |
| CoalScalar | distance |
| The distance between the two shapes, computed by GJK. If the distance is below GJK's threshold, the shapes are in collision in the eyes of GJK. If distance_upper_bound is set to a value lower than infinity, GJK will early stop as soon as it finds distance to be greater than distance_upper_bound. | |
| Simplex * | simplex |
class for GJK algorithm
| typedef unsigned char coal::details::GJK::vertex_id_t |
Status of the GJK algorithm: DidNotRun: GJK has not been run. Failed: GJK did not converge (it exceeded the maximum number of iterations). NoCollisionEarlyStopped: GJK found a separating hyperplane and exited before converting. The shapes are not in collision. NoCollision: GJK converged and the shapes are not in collision. Collision: GJK converged and the shapes are in collision. Failed: GJK did not converge.
| Enumerator | |
|---|---|
| DidNotRun | |
| Failed | |
| NoCollisionEarlyStopped | |
| NoCollision | |
| CollisionWithPenetrationInformation | |
| Collision | |
| inline |
| 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.
| bool coal::details::GJK::checkConvergence | ( | const Vec3s & | w, |
| const CoalScalar & | rl, | ||
| CoalScalar & | alpha, | ||
| const CoalScalar & | omega ) const |
Convergence check used to stop GJK when shapes are not in collision.
| bool coal::details::GJK::encloseOrigin | ( | ) |
whether the simplex enclose the origin
| Status coal::details::GJK::evaluate | ( | const MinkowskiDiff & | shape, |
| const Vec3s & | guess, | ||
| const support_func_guess_t & | supportHint = support_func_guess_t::Zero() ) |
GJK algorithm, given the initial value guess.
| Vec3s coal::details::GJK::getGuessFromSimplex | ( | ) | const |
get the guess from current simplex
| inline |
Get the number of iterations of the last run of GJK.
| inline |
Get GJK number of iterations before momentum stops. Only usefull if the Nesterov or Polyak acceleration activated.
| inline |
Get the max number of iterations of GJK.
| inline |
get the underlying simplex using in GJK, can be used for cache in next iteration
| inline |
apply the support function along a direction, the result is return in sv
| inline |
Get the tolerance of GJK.
| void coal::details::GJK::getWitnessPointsAndNormal | ( | const MinkowskiDiff & | shape, |
| Vec3s & | w0, | ||
| Vec3s & | w1, | ||
| Vec3s & | normal ) const |
Get the witness points on each object, and the corresponding normal.
| [in] | shape | is the Minkowski difference of the two shapes. |
| [out] | w0 | is the witness point on shape0. |
| [out] | w1 | is the witness point on shape1. |
| [out] | normal | is the normal of the separating plane found by GJK. It points from shape0 to shape1. |
| inline |
Tells whether the closest points are available.
| void coal::details::GJK::reset | ( | size_t | max_iterations_, |
| CoalScalar | tolerance_ ) |
| inline |
Distance threshold for early break. GJK stops when it proved the distance is more than this threshold.
| GJKConvergenceCriterion coal::details::GJK::convergence_criterion |
| GJKConvergenceCriterionType coal::details::GJK::convergence_criterion_type |
| CoalScalar coal::details::GJK::distance |
| CoalScalar coal::details::GJK::distance_upper_bound |
| GJKVariant coal::details::GJK::gjk_variant |
| Vec3s coal::details::GJK::ray |
| MinkowskiDiff const* coal::details::GJK::shape |
| Simplex* coal::details::GJK::simplex |
| Status coal::details::GJK::status |
| support_func_guess_t coal::details::GJK::support_hint |