60 typedef Eigen::Array<FCL_REAL, 1, 2>
Array2d;
98 const Vec3f& dir,
bool dirIsNormalized,
105 : linear_log_convex_threshold(32),
106 normalize_support_direction(false),
107 getSupportFunc(NULL) {}
119 return getSupport(shapes[0], d, dIsNormalized, hint);
125 getSupport(shapes[1], oR1.transpose() * d, dIsNormalized, hint) +
132 assert(getSupportFunc != NULL);
133 getSupportFunc(*
this, d, dIsNormalized, supp0, supp1, hint,
134 const_cast<ShapeData*>(data));
141 struct HPP_FCL_DLLAPI
GJK {
197 : max_iterations(max_iterations_), tolerance(tolerance_) {
212 shape->
support(d, dIsNormalized, sv.
w0, sv.
w1, hint);
213 sv.
w = sv.
w0 - sv.
w1;
217 bool encloseOrigin();
231 return distance > -shape.
inflation.sum();
239 Vec3f getGuessFromSimplex()
const;
246 distance_upper_bound = dup;
274 inline void removeVertex(
Simplex& simplex);
277 inline void appendVertex(
Simplex& simplex,
const Vec3f&
v,
bool isNormalized,
299 bool projectTriangleOrigin(
const Simplex& current,
Simplex& next);
303 bool projectTetrahedraOrigin(
const Simplex& current,
Simplex& next);
312 struct HPP_FCL_DLLAPI
EPA {
333 if (root) root->
l[0] = face;
339 if (face->l[1]) face->
l[1]->
l[0] = face->
l[0];
340 if (face->l[0]) face->
l[0]->
l[1] = face->
l[1];
341 if (face == root) root = face->
l[1];
370 AccuracyReached = 1 << 1 | Valid,
371 Degenerated = 1 << 1 | Failed,
372 NonConvex = 2 << 1 | Failed,
373 InvalidHull = 3 << 1 | Failed,
374 OutOfFaces = 4 << 1 | Failed,
375 OutOfVertices = 5 << 1 | Failed,
376 FallBack = 6 << 1 | Failed
388 EPA(
unsigned int max_face_num_,
unsigned int max_vertex_num_,
389 unsigned int max_iterations_,
FCL_REAL tolerance_)
390 : max_face_num(max_face_num_),
391 max_vertex_num(max_vertex_num_),
392 max_iterations(max_iterations_),
393 tolerance(tolerance_) {
416 SimplexF* newFace(SimplexV* a, SimplexV* b, SimplexV* vertex,
bool forced);
422 bool expand(
size_t pass, SimplexV* w,
SimplexF* f,
size_t e,
GJKConvergenceCriterionType
Wether the convergence criterion is scaled on the norm of the solution or not.
MinkowskiDiff const * shape
support_func_guess_t support_hint
GJKVariant
Variant to use for the GJK algorithm.
std::vector< int8_t > visited
unsigned int max_face_num
Vec3f support0(const Vec3f &d, bool dIsNormalized, int &hint) const
support function for shape0
FCL_REAL getTolerance()
Get GJK tolerance.
bool initialize(MeshCollisionTraversalNode< BV, RelativeTransformationIsIdentity > &node, BVHModel< BV > &model1, Transform3f &tf1, BVHModel< BV > &model2, Transform3f &tf2, CollisionResult &result, bool use_refit=false, bool refit_bottomup=false)
Initialize traversal node for collision between two meshes, given the current transforms.
Eigen::Matrix< FCL_REAL, 3, 3 > Matrix3f
Vec3f getSupport(const ShapeBase *shape, const Vec3f &dir, bool dirIsNormalized, int &hint)
the support function for shape
size_t getIterations()
Get GJK number of iterations.
EPA(unsigned int max_face_num_, unsigned int max_vertex_num_, unsigned int max_iterations_, FCL_REAL tolerance_)
void append(SimplexF *face)
Vec3f support1(const Vec3f &d, bool dIsNormalized, int &hint) const
support function for shape1
static const size_t EPA_MAX_VERTICES
Vec3f w
support vector (i.e., the furthest point on the shape along the support direction) ...
Minkowski difference class of two shapes.
Eigen::Array< FCL_REAL, 1, 2 > Array2d
static void bind(SimplexF *fa, size_t ea, SimplexF *fb, size_t eb)
Base class for all basic geometric shapes.
FCL_REAL distance_upper_bound
GJK(unsigned int max_iterations_, FCL_REAL tolerance_)
static const size_t EPA_MAX_FACES
unsigned int max_vertex_num
GetSupportFunction getSupportFunc
Vec3f ot1
translation from shape1 to shape0 such that .
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.
Array2d inflation
The radius of the sphere swepted volume. The 2 values correspond to the inflation of shape 0 and shap...
Simplex * getSimplex() const
get the underlying simplex using in GJK, can be used for cache in next iteration
bool normalize_support_direction
Wether or not to use the normalize heuristic in the GJK Nesterov acceleration. This setting is only a...
static const size_t EPA_MAX_ITERATIONS
Eigen::Vector2i support_func_guess_t
unsigned int max_iterations
Vec3f w0
support vector for shape 0 and 1.
unsigned char vertex_id_t
void support(const Vec3f &d, bool dIsNormalized, Vec3f &supp0, Vec3f &supp1, support_func_guess_t &hint) const
support function for the pair of shapes
GJKConvergenceCriterion convergence_criterion
void setDistanceEarlyBreak(const FCL_REAL &dup)
Distance threshold for early break. GJK stops when it proved the distance is more than this threshold...
int linear_log_convex_threshold
Number of points in a Convex object from which using a logarithmic support function is faster than a ...
vertex_id_t rank
size of simplex (number of vertices)
static const FCL_REAL EPA_EPS
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
bool hasClosestPoints()
Tells whether the closest points are available.
GJKConvergenceCriterion
Which convergence criterion is used to stop the algorithm (when the shapes are not in collision)...
unsigned int max_iterations
Matrix3f oR1
rotation from shape1 to shape0 such that .
bool hasPenetrationInformation(const MinkowskiDiff &shape)
bool getClosestPoints(const GJK::Simplex &simplex, Vec3f &w0, Vec3f &w1)
GJKConvergenceCriterionType convergence_criterion_type
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