Go to the documentation of this file.
37 #define BOOST_TEST_MODULE FCL_GEOMETRIC_SHAPES
38 #include <boost/test/included/unit_test.hpp>
50 pts[0] =
Vec3f(l, w, d);
51 pts[1] =
Vec3f(l, w, -d);
52 pts[2] =
Vec3f(l, -w, d);
53 pts[3] =
Vec3f(l, -w, -d);
54 pts[4] =
Vec3f(-l, w, d);
55 pts[5] =
Vec3f(-l, w, -d);
56 pts[6] =
Vec3f(-l, -w, d);
57 pts[7] =
Vec3f(-l, -w, -d);
60 polygons[0].
set(0, 2, 3, 1);
61 polygons[1].
set(2, 6, 7, 3);
62 polygons[2].
set(4, 5, 7, 6);
63 polygons[3].
set(0, 1, 5, 4);
64 polygons[4].
set(1, 3, 7, 5);
65 polygons[5].
set(0, 2, 6, 4);
80 for (
int i = 0; i < 8; ++i) {
81 BOOST_CHECK_EQUAL(
box.neighbors[i].count(), 3);
83 BOOST_CHECK_EQUAL(
box.neighbors[0][0], 1);
84 BOOST_CHECK_EQUAL(
box.neighbors[0][1], 2);
85 BOOST_CHECK_EQUAL(
box.neighbors[0][2], 4);
87 BOOST_CHECK_EQUAL(
box.neighbors[1][0], 0);
88 BOOST_CHECK_EQUAL(
box.neighbors[1][1], 3);
89 BOOST_CHECK_EQUAL(
box.neighbors[1][2], 5);
91 BOOST_CHECK_EQUAL(
box.neighbors[2][0], 0);
92 BOOST_CHECK_EQUAL(
box.neighbors[2][1], 3);
93 BOOST_CHECK_EQUAL(
box.neighbors[2][2], 6);
95 BOOST_CHECK_EQUAL(
box.neighbors[3][0], 1);
96 BOOST_CHECK_EQUAL(
box.neighbors[3][1], 2);
97 BOOST_CHECK_EQUAL(
box.neighbors[3][2], 7);
99 BOOST_CHECK_EQUAL(
box.neighbors[4][0], 0);
100 BOOST_CHECK_EQUAL(
box.neighbors[4][1], 5);
101 BOOST_CHECK_EQUAL(
box.neighbors[4][2], 6);
103 BOOST_CHECK_EQUAL(
box.neighbors[5][0], 1);
104 BOOST_CHECK_EQUAL(
box.neighbors[5][1], 4);
105 BOOST_CHECK_EQUAL(
box.neighbors[5][2], 7);
107 BOOST_CHECK_EQUAL(
box.neighbors[6][0], 2);
108 BOOST_CHECK_EQUAL(
box.neighbors[6][1], 4);
109 BOOST_CHECK_EQUAL(
box.neighbors[6][2], 7);
111 BOOST_CHECK_EQUAL(
box.neighbors[7][0], 3);
112 BOOST_CHECK_EQUAL(
box.neighbors[7][1], 5);
113 BOOST_CHECK_EQUAL(
box.neighbors[7][2], 6);
116 template <
typename Sa,
typename Sb>
132 BOOST_TEST_MESSAGE(
tf1 <<
'\n'
136 << cB.pos.format(
pyfmt) <<
'\n');
138 BOOST_WARN_SMALL((cA.
pos - cB.pos).squaredNorm(), tol);
139 BOOST_WARN_SMALL((cA.
normal - cB.normal).squaredNorm(), tol);
146 template <
typename Sa,
typename Sb>
155 BOOST_TEST_MESSAGE(
tf1 <<
'\n'
171 BOOST_WARN_SMALL((resA.
normal - resA.
normal).squaredNorm(), tol);
181 Box box(l * 2, w * 2, d * 2);
195 for (
int i = 0; i < 1000; ++i) {
202 #ifdef HPP_FCL_HAS_QHULL
204 std::vector<Vec3f> points({
211 std::invalid_argument);
213 std::invalid_argument);
215 std::invalid_argument);
217 std::invalid_argument);
221 std::vector<Vec3f> points({
229 points.data(), (
unsigned int)points.size(),
false, NULL);
231 BOOST_REQUIRE_EQUAL(convexHull->num_points, 4);
232 BOOST_CHECK_EQUAL(convexHull->neighbors[0].count(), 3);
233 BOOST_CHECK_EQUAL(convexHull->neighbors[1].count(), 3);
234 BOOST_CHECK_EQUAL(convexHull->neighbors[2].count(), 3);
239 std::vector<Vec3f> points({
253 points.data(), (
unsigned int)points.size(),
false, NULL);
255 BOOST_REQUIRE_EQUAL(8, convexHull->num_points);
256 for (
int i = 0; i < 8; ++i) {
257 BOOST_CHECK(convexHull->points[i].cwiseAbs() ==
Vec3f(1, 1, 1));
258 BOOST_CHECK_EQUAL(convexHull->neighbors[i].count(), 3);
263 (
unsigned int)points.size(),
true, NULL);
265 BOOST_CHECK(convex_tri != NULL);
267 BOOST_REQUIRE_EQUAL(8, convexHull->num_points);
268 for (
int i = 0; i < 8; ++i) {
269 BOOST_CHECK(convexHull->points[i].cwiseAbs() ==
Vec3f(1, 1, 1));
270 BOOST_CHECK(convexHull->neighbors[i].count() >= 3);
271 BOOST_CHECK(convexHull->neighbors[i].count() <= 6);
const Eigen::IOFormat pyfmt
void compareShapeIntersection(const Sa &sa, const Sb &sb, const Transform3f &tf1, const Transform3f &tf2, FCL_REAL tol=1e-9)
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
void set(index_type p0, index_type p1, index_type p2, index_type p3)
Set the vertex indices of the quadrilateral.
Vec3f nearest_points[2]
nearest points
static ConvexBase * convexHull(const Vec3f *points, unsigned int num_points, bool keepTriangles, const char *qhullCommand=NULL)
Build a convex hull based on Qhull library and store the vertices and optionally the triangles.
const Contact & getContact(size_t i) const
get the i-th contact calculated
size_t numContacts() const
number of contacts found
HPP_FCL_DLLAPI FCL_REAL distance(const Matrix3f &R0, const Vec3f &T0, const kIOS &b1, const kIOS &b2, Vec3f *P=NULL, Vec3f *Q=NULL)
Approximate distance between two kIOS bounding volumes.
void compareShapeDistance(const Sa &sa, const Sb &sb, const Transform3f &tf1, const Transform3f &tf2, FCL_REAL tol=1e-9)
HPP_FCL_DLLAPI std::size_t collide(const CollisionObject *o1, const CollisionObject *o2, const CollisionRequest &request, CollisionResult &result)
Main collision interface: given two collision objects, and the requirements for contacts,...
Vec3f normal
In case both objects are in collision, store the normal.
Quadrilateral with 4 indices for points.
request to the collision algorithm
Convex< Quadrilateral > buildBox(FCL_REAL l, FCL_REAL w, FCL_REAL d)
BOOST_AUTO_TEST_CASE(convex)
bool isCollision() const
return binary collision result
FCL_REAL min_distance
minimum distance between two objects. if two objects are in collision, min_distance <= 0.
Base for convex polytope.
request to the distance computation
void generateRandomTransform(FCL_REAL extents[6], Transform3f &transform)
Generate one random transform whose translation is constrained by extents and rotation without constr...
FCL_REAL distance_lower_bound
Center at zero point, axis aligned box.
hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:13