81      for (
size_t i = 0; i < 4; ++i) vertex[i] = 
nullptr;
 
 
 
  124  size_t max_iterations;
 
  133  size_t iterations_momentum_stop;
 
  144      : max_iterations(max_iterations_), tolerance(tolerance_) {
 
  145    COAL_ASSERT(tolerance_ > 0, 
"Tolerance must be positive.",
 
  146                std::invalid_argument);
 
 
  168    sv.
w = sv.
w0 - sv.
w1;
 
 
  198    distance_upper_bound = dup;
 
 
  218    return iterations_momentum_stop;
 
 
  228  inline void removeVertex(Simplex& simplex);
 
  231  inline void appendVertex(Simplex& simplex, 
const Vec3ps& v,
 
  249  bool projectLineOrigin(
const Simplex& current, Simplex& next);
 
  253  bool projectTriangleOrigin(
const Simplex& current, Simplex& next);
 
  257  bool projectTetrahedraOrigin(
const Simplex& current, Simplex& next);
 
 
  272    size_t adjacent_edge[3];         
 
 
  297      if (root != 
nullptr) root->
prev_face = face;
 
 
  307      if (face == root) root = face->
next_face;
 
 
 
  316    assert(ea == 0 || ea == 1 || ea == 2);
 
  317    assert(eb == 0 || eb == 1 || eb == 2);
 
 
  329        : current_face(nullptr), first_face(nullptr), num_faces(0) {}
 
 
 
  336    AccuracyReached = 1 << 1 | Valid,
 
  337    Degenerated = 1 << 1 | Failed,
 
  338    NonConvex = 2 << 1 | Failed,
 
  339    InvalidHull = 3 << 1 | Failed,
 
  340    OutOfFaces = 4 << 1 | Failed,
 
  341    OutOfVertices = 5 << 1 | Failed,
 
  342    FallBack = 6 << 1 | Failed
 
 
  356  size_t max_iterations;
 
  359  std::vector<SimplexVertex> sv_store;
 
  360  std::vector<SimplexFace> fc_store;
 
  367      : max_iterations(max_iterations_), tolerance(tolerance_) {
 
 
  374      : max_iterations(other.max_iterations),
 
  375        tolerance(other.tolerance),
 
  376        sv_store(other.sv_store),
 
  377        fc_store(other.fc_store) {
 
 
  439  SimplexFace* newFace(
size_t id_a, 
size_t id_b, 
size_t id_vertex,
 
 
#define COAL_DLLAPI
Definition config.hh:88
 
#define COAL_ASSERT(check, message, exception)
Definition fwd.hh:82
 
Main namespace.
Definition broadphase_bruteforce.h:44
 
GJKConvergenceCriterionType
Wether the convergence criterion is scaled on the norm of the solution or not.
Definition data_types.h:118
 
Eigen::Matrix< SolverScalar, 3, 1 > Vec3ps
Definition data_types.h:83
 
Scalar distance(const Matrix3s &R0, const Vec3s &T0, const kIOS &b1, const kIOS &b2, Vec3s *P=NULL, Vec3s *Q=NULL)
Approximate distance between two kIOS bounding volumes.
 
double SolverScalar
Definition data_types.h:82
 
Eigen::Matrix< Scalar, 3, 1 > Vec3s
Definition data_types.h:70
 
double Scalar
Definition data_types.h:68
 
Eigen::Vector2i support_func_guess_t
Definition data_types.h:80
 
GJKConvergenceCriterion
Which convergence criterion is used to stop the algorithm (when the shapes are not in collision)....
Definition data_types.h:114
 
GJKVariant
Variant to use for the GJK algorithm.
Definition data_types.h:108
 
The simplex list of EPA is a linked list of faces. Note: EPA's linked list does not own any memory....
Definition gjk.h:284
 
SimplexFace * root
Definition gjk.h:285
 
void reset()
Definition gjk.h:289
 
size_t count
Definition gjk.h:286
 
void append(SimplexFace *face)
Definition gjk.h:294
 
SimplexFaceList()
Definition gjk.h:287
 
void remove(SimplexFace *face)
Definition gjk.h:302
 
size_t adjacent_edge[3]
Definition gjk.h:272
 
SimplexFace * adjacent_faces[3]
Definition gjk.h:269
 
SolverScalar d
Definition gjk.h:265
 
bool ignore
Definition gjk.h:266
 
SimplexFace * next_face
Definition gjk.h:271
 
size_t pass
Definition gjk.h:276
 
Vec3ps n
Definition gjk.h:264
 
SimplexFace()
Definition gjk.h:278
 
SimplexFace * prev_face
Definition gjk.h:270
 
SimplexHorizon()
Definition gjk.h:328
 
SimplexFace * first_face
Definition gjk.h:326
 
size_t num_faces
Definition gjk.h:327
 
SimplexFace * current_face
Definition gjk.h:325
 
class for EPA algorithm
Definition gjk.h:261
 
size_t getNumMaxIterations() const
Get the max number of iterations of EPA.
Definition gjk.h:382
 
support_func_guess_t support_hint
Definition gjk.h:349
 
GJK::SimplexV SimplexVertex
Definition gjk.h:262
 
Status status
Definition gjk.h:346
 
Status
Definition gjk.h:332
 
EPA(const EPA &other)
Copy constructor of EPA. Mostly needed for the copy constructor of GJKSolver.
Definition gjk.h:373
 
size_t getNumVertices() const
Get the number of vertices in the polytope of the last run of EPA.
Definition gjk.h:397
 
static void bind(SimplexFace *fa, size_t ea, SimplexFace *fb, size_t eb)
We bind the face fa along its edge ea to the face fb along its edge fb.
Definition gjk.h:314
 
size_t getNumMaxFaces() const
Get the max number of faces of EPA.
Definition gjk.h:388
 
SolverScalar depth
Definition gjk.h:350
 
size_t getNumIterations() const
Get the number of iterations of the last run of EPA.
Definition gjk.h:394
 
GJK::Simplex result
Definition gjk.h:347
 
void getWitnessPointsAndNormal(const MinkowskiDiff &shape, Vec3ps &w0, Vec3ps &w1, Vec3ps &normal) const
 
EPA(size_t max_iterations_, SolverScalar tolerance_)
Definition gjk.h:366
 
void reset(size_t max_iterations, SolverScalar tolerance)
resets the EPA algorithm, preparing it for a new run. It potentially reallocates memory for the verti...
 
Status evaluate(GJK &gjk, const Vec3ps &guess)
 
SolverScalar getTolerance() const
Get the tolerance of EPA.
Definition gjk.h:391
 
Vec3ps normal
Definition gjk.h:348
 
size_t getNumFaces() const
Get the number of faces in the polytope of the last run of EPA.
Definition gjk.h:400
 
size_t getNumMaxVertices() const
Get the max number of vertices of EPA.
Definition gjk.h:385
 
SimplexFace * closest_face
Definition gjk.h:351
 
Vec3ps w1
Definition gjk.h:56
 
Vec3ps w
support vector (i.e., the furthest point on the shape along the support direction)
Definition gjk.h:59
 
Vec3ps w0
support vector for shape 0 and 1.
Definition gjk.h:56
 
A simplex is a set of up to 4 vertices. Its rank is the number of vertices it contains.
Definition gjk.h:71
 
vertex_id_t rank
size of simplex (number of vertices)
Definition gjk.h:75
 
void reset()
Definition gjk.h:79
 
Simplex()
Definition gjk.h:77
 
class for GJK algorithm
Definition gjk.h:53
 
void reset(size_t max_iterations_, SolverScalar tolerance_)
resets the GJK algorithm, preparing it for a new run. Other than the maximum number of iterations and...
 
GJK(size_t max_iterations_, SolverScalar tolerance_)
Definition gjk.h:143
 
SolverScalar getTolerance() const
Get the tolerance of GJK.
Definition gjk.h:210
 
void setDistanceEarlyBreak(const SolverScalar &dup)
Distance threshold for early break. GJK stops when it proved the distance is more than this threshold...
Definition gjk.h:197
 
GJKConvergenceCriterionType convergence_criterion_type
Definition gjk.h:108
 
support_func_guess_t support_hint
Definition gjk.h:112
 
SolverScalar distance_upper_bound
Definition gjk.h:104
 
GJKVariant gjk_variant
Definition gjk.h:106
 
MinkowskiDiff const  * shape
Definition gjk.h:110
 
Vec3ps ray
Definition gjk.h:111
 
SolverScalar distance
The distance between the two shapes, computed by GJK. If the distance is below GJK's threshold,...
Definition gjk.h:118
 
bool checkConvergence(const Vec3ps &w, const SolverScalar &rl, SolverScalar &alpha, const SolverScalar &omega) const
Convergence check used to stop GJK when shapes are not in collision.
 
size_t getNumIterationsMomentumStopped() const
Get GJK number of iterations before momentum stops. Only usefull if the Nesterov or Polyak accelerati...
Definition gjk.h:217
 
Status evaluate(const MinkowskiDiff &shape, const Vec3ps &guess, const support_func_guess_t &supportHint=support_func_guess_t::Zero())
GJK algorithm, given the initial value guess.
 
Vec3ps getGuessFromSimplex() const
get the guess from current simplex
 
Simplex * simplex
Definition gjk.h:119
 
size_t getNumIterations() const
Get the number of iterations of the last run of GJK.
Definition gjk.h:213
 
unsigned char vertex_id_t
Definition gjk.h:62
 
size_t getNumMaxIterations() const
Get the max number of iterations of GJK.
Definition gjk.h:207
 
GJKConvergenceCriterion convergence_criterion
Definition gjk.h:107
 
Status
Status of the GJK algorithm: DidNotRun: GJK has not been run. Failed: GJK did not converge (it exceed...
Definition gjk.h:94
 
@ DidNotRun
Definition gjk.h:95
 
@ Failed
Definition gjk.h:96
 
@ NoCollisionEarlyStopped
Definition gjk.h:97
 
@ CollisionWithPenetrationInformation
Definition gjk.h:99
 
@ NoCollision
Definition gjk.h:98
 
bool hasClosestPoints() const
Tells whether the closest points are available.
Definition gjk.h:179
 
Status status
Definition gjk.h:105
 
bool encloseOrigin()
whether the simplex enclose the origin
 
void getSupport(const Vec3ps &d, SimplexV &sv, support_func_guess_t &hint) const
apply the support function along a direction, the result is return in sv
Definition gjk.h:162
 
Simplex * getSimplex() const
get the underlying simplex using in GJK, can be used for cache in next iteration
Definition gjk.h:176
 
void getWitnessPointsAndNormal(const MinkowskiDiff &shape, Vec3ps &w0, Vec3ps &w1, Vec3ps &normal) const
 
Minkowski difference class of two shapes.
Definition minkowski_difference.h:53
 
void support(const Vec3s &dir, Vec3s &supp0, Vec3s &supp1, support_func_guess_t &hint) const
Support function for the pair of shapes. This method assumes set has already been called.
Definition minkowski_difference.h:174