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));
168 test(sphere, 0.01, 1e-8);
173 test(box, 0.01, 1e-8);
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);
void test_throw(const Shape &shape, const FCL_REAL inflation)
Vec3f halfSide
box side half-length
request to the distance computation
Ellipsoid centered at point zero.
FCL_REAL halfLength
Half Length along z axis.
Cylinder along Z axis. The cylinder is defined at its centroid.
void test(const Shape &original_shape, const FCL_REAL inflation, const FCL_REAL tol=1e-8)
Half Space: this is equivalent to the Plane in ODE. The separation plane is defined as n * x = d; Poi...
request to the collision algorithm
void test_no_throw(const Shape &shape, const FCL_REAL inflation)
FCL_REAL radius
Radius of the cone.
bool isApprox(const Shape &s1, const Shape &s2, const FCL_REAL tol)
Center at zero point, axis aligned box.
Triangle stores the points instead of only indices of points.
Cone The base of the cone is at and the top is at .
FCL_REAL radius
Radius of the sphere.
FCL_REAL radius
Radius of the cylinder.
Center at zero point sphere.
Capsule It is where is the distance between the point x and the capsule segment AB...
BOOST_AUTO_TEST_CASE(test_inflate)
shared_ptr< CollisionGeometry > CollisionGeometryPtr_t
FCL_REAL halfLength
Half Length along z axis.
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Vec3f radii
Radii of the Ellipsoid (such that on boundary: x^2/rx^2 + y^2/ry^2.
the object for collision or distance computation, contains the geometry and the transform information...
FCL_REAL radius
Radius of capsule.
FCL_REAL halfLength
Half Length along z axis.