Skip to content
Snippets Groups Projects
Commit 2a0633ea authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

[GJK] Add checks for ill-conditionned directions in support function.

parent bdade023
No related branches found
No related tags found
No related merge requests found
......@@ -248,6 +248,14 @@ void getSupportFuncTpl (const MinkowskiDiff& md,
bool ( (bool)shape_traits<Shape0>::NeedNormalizedDir
|| (bool)shape_traits<Shape1>::NeedNormalizedDir)
};
#ifndef NDEBUG
// Need normalized direction and direction is normalized
assert(!NeedNormalizedDir || !dirIsNormalized || fabs(dir.squaredNorm() - 1) < 1e-6);
// Need normalized direction but direction is not normalized.
assert(!NeedNormalizedDir || dirIsNormalized || fabs(dir.normalized().squaredNorm() - 1) < 1e-6);
// Don't need normalized direction. Check that dir is not zero.
assert( NeedNormalizedDir || dir.cwiseAbs().maxCoeff() >= 1e-6);
#endif
getSupportTpl<Shape0, Shape1, TransformIsIdentity> (
static_cast <const Shape0*>(md.shapes[0]),
static_cast <const Shape1*>(md.shapes[1]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment