Skip to content

Commit bdb3488

Browse files
committed
Merge pull request #110 from sherm1/fix-bug-in-propagateBVHFrontListCollisionRecurse
Fixes a nasty bug in propagateBVHFrontListCollisionRecurse()
2 parents c821b10 + 5e6990f commit bdb3488

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/ccd/motion.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ FCL_REAL TBVMotionBoundVisitor<RSS>::visit(const SplineMotion& motion) const
5454

5555
FCL_REAL tmp;
5656
// max_i |c_i * n|
57-
FCL_REAL cn_max = std::fabs(c1.dot(n));
58-
tmp = std::fabs(c2.dot(n));
57+
FCL_REAL cn_max = std::abs(c1.dot(n));
58+
tmp = std::abs(c2.dot(n));
5959
if(tmp > cn_max) cn_max = tmp;
60-
tmp = std::fabs(c3.dot(n));
60+
tmp = std::abs(c3.dot(n));
6161
if(tmp > cn_max) cn_max = tmp;
62-
tmp = std::fabs(c4.dot(n));
62+
tmp = std::abs(c4.dot(n));
6363
if(tmp > cn_max) cn_max = tmp;
6464

6565
// max_i ||c_i||
@@ -99,10 +99,10 @@ FCL_REAL TriangleMotionBoundVisitor::visit(const SplineMotion& motion) const
9999
FCL_REAL T_bound = motion.computeTBound(n);
100100
FCL_REAL tf_t = motion.getCurrentTime();
101101

102-
FCL_REAL R_bound = std::fabs(a.dot(n)) + a.length() + (a.cross(n)).length();
103-
FCL_REAL R_bound_tmp = std::fabs(b.dot(n)) + b.length() + (b.cross(n)).length();
102+
FCL_REAL R_bound = std::abs(a.dot(n)) + a.length() + (a.cross(n)).length();
103+
FCL_REAL R_bound_tmp = std::abs(b.dot(n)) + b.length() + (b.cross(n)).length();
104104
if(R_bound_tmp > R_bound) R_bound = R_bound_tmp;
105-
R_bound_tmp = std::fabs(c.dot(n)) + c.length() + (c.cross(n)).length();
105+
R_bound_tmp = std::abs(c.dot(n)) + c.length() + (c.cross(n)).length();
106106
if(R_bound_tmp > R_bound) R_bound = R_bound_tmp;
107107

108108
FCL_REAL dWdW_max = motion.computeDWMax();

src/narrowphase/narrowphase.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ namespace details
9595
// If segments not parallel, compute closest point on L1 to L2 and
9696
// clamp to segment S1. Else pick arbitrary s (here 0)
9797
if (denom != 0.0f) {
98-
std::cerr << "demoninator equals zero, using 0 as reference" << std::endl;
98+
std::cerr << "denominator equals zero, using 0 as reference" << std::endl;
9999
s = clamp((b*f - c*e) / denom, 0.0f, 1.0f);
100100
} else s = 0.0f;
101101
// Compute point on L2 closest to S1(s) using

src/traversal/traversal_recurse.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ void propagateBVHFrontListCollisionRecurse(CollisionTraversalNodeBase* node, BVH
414414
if(node->firstOverSecond(b1, b2))
415415
{
416416
int c1 = node->getFirstLeftChild(b1);
417-
int c2 = node->getFirstRightChild(b2);
417+
int c2 = node->getFirstRightChild(b1);
418418

419419
collisionRecurse(node, c1, b2, front_list);
420420
collisionRecurse(node, c2, b2, front_list);

test/test_fcl_geometric_shapes.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void printComparisonError(const std::string& comparison_type,
177177
<< "tf2.translation: " << tf2.getTranslation() << std::endl
178178
<< "expected_depth: " << expected_depth << std::endl
179179
<< "actual_depth : " << actual_depth << std::endl
180-
<< "difference: " << std::fabs(actual_depth - expected_depth) << std::endl
180+
<< "difference: " << std::abs(actual_depth - expected_depth) << std::endl
181181
<< "tolerance: " << tol << std::endl;
182182
}
183183

@@ -201,7 +201,7 @@ bool checkContactPoints(const S1& s1, const Transform3f& tf1,
201201

202202
if (check_depth)
203203
{
204-
bool depth_equal = std::fabs(actual.penetration_depth - expected.penetration_depth) < tol;
204+
bool depth_equal = std::abs(actual.penetration_depth - expected.penetration_depth) < tol;
205205
if (!depth_equal)
206206
return false;
207207
}

0 commit comments

Comments
 (0)