Commit 0659236a authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

[Test] Update to API change of shapeIntersect

parent 0eefca6e
......@@ -104,8 +104,9 @@ BOOST_AUTO_TEST_CASE(OBB_Box_test)
GJKSolver solver;
FCL_REAL distance;
bool overlap_obb = obb1.overlap(obb2);
bool overlap_box = solver.shapeIntersect(box1, box1_tf, box2, box2_tf, NULL, NULL, NULL);
bool overlap_box = solver.shapeIntersect(box1, box1_tf, box2, box2_tf, distance, false, NULL, NULL);
BOOST_CHECK(overlap_obb == overlap_box);
}
......@@ -138,13 +139,14 @@ BOOST_AUTO_TEST_CASE(OBB_shape_test)
FCL_REAL len = (aabb1.max_[0] - aabb1.min_[0]) * 0.5;
OBB obb2;
GJKSolver solver;
FCL_REAL distance;
{
Sphere sphere(len);
computeBV(sphere, transforms[i], obb2);
bool overlap_obb = obb1.overlap(obb2);
bool overlap_sphere = solver.shapeIntersect(box1, box1_tf, sphere, transforms[i], NULL, NULL, NULL);
bool overlap_sphere = solver.shapeIntersect(box1, box1_tf, sphere, transforms[i], distance, false, NULL, NULL);
BOOST_CHECK(overlap_obb >= overlap_sphere);
}
......@@ -153,7 +155,7 @@ BOOST_AUTO_TEST_CASE(OBB_shape_test)
computeBV(capsule, transforms[i], obb2);
bool overlap_obb = obb1.overlap(obb2);
bool overlap_capsule = solver.shapeIntersect(box1, box1_tf, capsule, transforms[i], NULL, NULL, NULL);
bool overlap_capsule = solver.shapeIntersect(box1, box1_tf, capsule, transforms[i], distance, false, NULL, NULL);
BOOST_CHECK(overlap_obb >= overlap_capsule);
}
......@@ -162,7 +164,7 @@ BOOST_AUTO_TEST_CASE(OBB_shape_test)
computeBV(cone, transforms[i], obb2);
bool overlap_obb = obb1.overlap(obb2);
bool overlap_cone = solver.shapeIntersect(box1, box1_tf, cone, transforms[i], NULL, NULL, NULL);
bool overlap_cone = solver.shapeIntersect(box1, box1_tf, cone, transforms[i], distance, false, NULL, NULL);
BOOST_CHECK(overlap_obb >= overlap_cone);
}
......@@ -171,7 +173,7 @@ BOOST_AUTO_TEST_CASE(OBB_shape_test)
computeBV(cylinder, transforms[i], obb2);
bool overlap_obb = obb1.overlap(obb2);
bool overlap_cylinder = solver.shapeIntersect(box1, box1_tf, cylinder, transforms[i], NULL, NULL, NULL);
bool overlap_cylinder = solver.shapeIntersect(box1, box1_tf, cylinder, transforms[i], distance, false, NULL, NULL);
BOOST_CHECK(overlap_obb >= overlap_cylinder);
}
}
......
......@@ -14,7 +14,7 @@ int main(int argc, char** argv)
boost::shared_ptr<Box> box1(new Box(1,1,1));
GJKSolver_libccd solver;
Vec3f contact_points;
FCL_REAL penetration_depth;
FCL_REAL distance;
Vec3f normal;
Transform3f tf0, tf1;
......@@ -23,12 +23,10 @@ int main(int argc, char** argv)
tf0.setQuatRotation(Quaternion3f(.6, .8, 0, 0));
tf1.setIdentity();
bool res = solver.shapeIntersect(*box0, tf0, *box1, tf1, &contact_points, &penetration_depth, &normal);
bool res = solver.shapeIntersect(*box0, tf0, *box1, tf1, distance, true, &contact_points, &normal);
cout << "contact points: " << contact_points << endl;
cout << "pen depth: " << penetration_depth << endl;
cout << "signed distance: " << distance << endl;
cout << "normal: " << normal << endl;
cout << "result: " << res << endl;
......
......@@ -61,7 +61,8 @@ BOOST_AUTO_TEST_CASE(Sphere_Capsule_Intersect_test_separated_z)
Capsule capsule (50, 200.);
Transform3f capsule_transform (Vec3f (0., 0., 200));
BOOST_CHECK (!solver.shapeIntersect(sphere1, sphere1_transform, capsule, capsule_transform, NULL, NULL, NULL));
FCL_REAL distance;
BOOST_CHECK (!solver.shapeIntersect(sphere1, sphere1_transform, capsule, capsule_transform, distance, false, NULL, NULL));
}
BOOST_AUTO_TEST_CASE(Sphere_Capsule_Intersect_test_separated_z_negative)
......@@ -75,7 +76,8 @@ BOOST_AUTO_TEST_CASE(Sphere_Capsule_Intersect_test_separated_z_negative)
Capsule capsule (50, 200.);
Transform3f capsule_transform (Vec3f (0., 0., -200));
BOOST_CHECK (!solver.shapeIntersect(sphere1, sphere1_transform, capsule, capsule_transform, NULL, NULL, NULL));
FCL_REAL distance;
BOOST_CHECK (!solver.shapeIntersect(sphere1, sphere1_transform, capsule, capsule_transform, distance, false, NULL, NULL));
}
BOOST_AUTO_TEST_CASE(Sphere_Capsule_Intersect_test_separated_x)
......@@ -89,7 +91,8 @@ BOOST_AUTO_TEST_CASE(Sphere_Capsule_Intersect_test_separated_x)
Capsule capsule (50, 200.);
Transform3f capsule_transform (Vec3f (150., 0., 0.));
BOOST_CHECK (!solver.shapeIntersect(sphere1, sphere1_transform, capsule, capsule_transform, NULL, NULL, NULL));
FCL_REAL distance;
BOOST_CHECK (!solver.shapeIntersect(sphere1, sphere1_transform, capsule, capsule_transform, distance, false, NULL, NULL));
}
BOOST_AUTO_TEST_CASE(Sphere_Capsule_Intersect_test_separated_capsule_rotated)
......@@ -106,7 +109,8 @@ BOOST_AUTO_TEST_CASE(Sphere_Capsule_Intersect_test_separated_capsule_rotated)
setEulerZYX(rotation, M_PI * 0.5, 0., 0.);
Transform3f capsule_transform (rotation, Vec3f (150., 0., 0.));
BOOST_CHECK (!solver.shapeIntersect(sphere1, sphere1_transform, capsule, capsule_transform, NULL, NULL, NULL));
FCL_REAL distance;
BOOST_CHECK (!solver.shapeIntersect(sphere1, sphere1_transform, capsule, capsule_transform, distance, false, NULL, NULL));
}
BOOST_AUTO_TEST_CASE(Sphere_Capsule_Intersect_test_penetration_z)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment