35 #define BOOST_TEST_MODULE FCL_SECURITY_MARGIN
36 #include <boost/test/included/unit_test.hpp>
59 #define MATH_SQUARED(x) (x * x)
61 template <
typename Shape>
65 typedef Eigen::Matrix<FCL_REAL, 1, 1> ScalarMatrix;
70 return m1.isApprox(m2, tol);
101 return s1.
a.isApprox(s2.
a, tol) && s1.
b.isApprox(s2.
b, tol) &&
102 s1.
c.isApprox(s2.
c, tol);
106 return isApprox(s1.
d, s2.
d, tol) && s1.
n.isApprox(s2.
n, tol);
109 template <
typename Shape>
115 const auto &inflation_result = original_shape.inflated(inflation);
116 const Transform3f &shift = inflation_result.second;
117 const Shape &inflated_shape = inflation_result.first;
119 BOOST_CHECK(
isApprox(original_shape, inflated_shape, tol));
125 const auto &inflation_result = original_shape.inflated(inflation);
126 const Shape &inflated_shape = inflation_result.first;
127 const Transform3f &inflation_shift = inflation_result.second;
129 BOOST_CHECK(!
isApprox(original_shape, inflated_shape, tol));
131 const auto &deflation_result = inflated_shape.inflated(-inflation);
132 const Shape &deflated_shape = deflation_result.first;
133 const Transform3f &deflation_shift = deflation_result.second;
135 BOOST_CHECK(
isApprox(original_shape, deflated_shape, tol));
136 BOOST_CHECK((inflation_shift * deflation_shift).isIdentity(tol));
141 const auto &inflation_result = original_shape.inflated(-inflation);
142 const Shape &inflated_shape = inflation_result.first;
143 const Transform3f &inflation_shift = inflation_result.second;
145 BOOST_CHECK(!
isApprox(original_shape, inflated_shape, tol));
147 const auto &deflation_result = inflated_shape.inflated(+inflation);
148 const Shape &deflated_shape = deflation_result.first;
149 const Transform3f &deflation_shift = deflation_result.second;
151 BOOST_CHECK(
isApprox(original_shape, deflated_shape, tol));
152 BOOST_CHECK((inflation_shift * deflation_shift).isIdentity(tol));
156 template <
typename Shape>
158 BOOST_REQUIRE_THROW(shape.inflated(inflation), std::invalid_argument);
161 template <
typename Shape>
163 BOOST_REQUIRE_NO_THROW(shape.inflated(inflation));
177 test(ellipsoid, 0.01, 1e-8);
181 test(capsule, 0.01, 1e-8);
185 test(cylinder, 0.01, 1e-8);
189 test(cone, 0.01, 1e-8);
193 test(halfspace, 0.01, 1e-8);