41 #include <gtest/gtest.h>
42 #include <Eigen/Dense>
58 bool enable_nearest_points,
59 bool enable_signed_distance,
68 X_FA.translation() = p_FA;
69 X_FB.translation() = p_FB;
76 using CollisionGeometryPtr_t = std::shared_ptr<fcl::CollisionGeometry<S>>;
77 CollisionGeometryPtr_t sphere_geometry_1(
new fcl::Sphere<S>(radius1));
78 CollisionGeometryPtr_t sphere_geometry_2(
new fcl::Sphere<S>(radius2));
82 const S min_distance =
fcl::distance(&sphere_1, &sphere_2, request, *result);
99 bool enable_nearest_points,
100 bool enable_signed_distance,
101 S min_distance_expected,
105 const S min_distance = ComputeSphereSphereDistance<S>(
107 enable_nearest_points, enable_signed_distance, &result);
108 EXPECT_NEAR(min_distance, min_distance_expected, tol);
114 template <
typename S>
134 template <
typename S>
136 std::vector<SphereSpecification<S>> spheres;
142 for (
int i = 0; i < static_cast<int>(spheres.size()); ++i) {
143 for (
int j = i + 1; j < static_cast<int>(spheres.size()); ++j) {
145 bool enable_signed_distance =
true;
146 CheckSphereToSphereDistance<S>(
147 spheres[i], spheres[j], solver_type,
true, enable_signed_distance,
149 sphere_sphere_distance.
p_WP2, tol);
153 CheckSphereToSphereDistance<S>(
154 spheres[j], spheres[i], solver_type,
true, enable_signed_distance,
156 sphere_sphere_distance.
p_WP1, tol);
158 enable_signed_distance =
false;
159 CheckSphereToSphereDistance<S>(
160 spheres[i], spheres[j], solver_type,
true, enable_signed_distance,
162 sphere_sphere_distance.
p_WP2, tol);
166 CheckSphereToSphereDistance<S>(
167 spheres[j], spheres[i], solver_type,
true, enable_signed_distance,
169 sphere_sphere_distance.
p_WP1, tol);
191 int main(
int argc,
char* argv[]) {
192 ::testing::InitGoogleTest(&argc, argv);
193 return RUN_ALL_TESTS();