Skip to content

Commit b470ca8

Browse files
committed
Test/CPatch: make cylinder/cone test more generic
1 parent 20258d6 commit b470ca8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/contact_patch.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,15 @@ BOOST_AUTO_TEST_CASE(halfspace_cone) {
368368
const FCL_REAL tol = 1e-6;
369369
EIGEN_VECTOR_IS_APPROX(contact.normal, hspace.n, tol);
370370

371-
const size_t expected_size = 6;
371+
const size_t expected_size = ContactPatch::default_preallocated_size;
372372
ContactPatch expected(expected_size);
373373
expected.tf.rotation() = constructBasisFromVector(contact.normal);
374374
expected.tf.translation() = contact.pos;
375375
expected.penetration_depth = contact.penetration_depth;
376-
std::array<Vec3f, 6> points;
376+
std::array<Vec3f, ContactPatch::default_preallocated_size> points;
377377
const FCL_REAL angle_increment =
378378
2.0 * (FCL_REAL)(EIGEN_PI) / ((FCL_REAL)(6));
379-
for (size_t i = 0; i < 6; ++i) {
379+
for (size_t i = 0; i < ContactPatch::default_preallocated_size; ++i) {
380380
const FCL_REAL theta = (FCL_REAL)(i)*angle_increment;
381381
Vec3f point_on_cone_base(std::cos(theta) * cone.radius,
382382
std::sin(theta) * cone.radius, -cone.halfLength);
@@ -475,16 +475,16 @@ BOOST_AUTO_TEST_CASE(halfspace_cylinder) {
475475

476476
if (col_res.isCollision()) {
477477
const Contact& contact = col_res.getContact(0);
478-
const size_t expected_size = 6;
478+
const size_t expected_size = ContactPatch::default_preallocated_size;
479479
const FCL_REAL tol = 1e-6;
480480
ContactPatch expected(expected_size);
481481
expected.tf.rotation() = constructBasisFromVector(contact.normal);
482482
expected.tf.translation() = contact.pos;
483483
expected.penetration_depth = contact.penetration_depth;
484-
std::array<Vec3f, 6> points;
484+
std::array<Vec3f, ContactPatch::default_preallocated_size> points;
485485
const FCL_REAL angle_increment =
486486
2.0 * (FCL_REAL)(EIGEN_PI) / ((FCL_REAL)(6));
487-
for (size_t i = 0; i < 6; ++i) {
487+
for (size_t i = 0; i < ContactPatch::default_preallocated_size; ++i) {
488488
const FCL_REAL theta = (FCL_REAL)(i)*angle_increment;
489489
Vec3f point_on_cone_base(std::cos(theta) * cylinder.radius,
490490
std::sin(theta) * cylinder.radius,

0 commit comments

Comments
 (0)