| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Software License Agreement (BSD License) | ||
| 3 | * | ||
| 4 | * Copyright (c) 2011-2014, Willow Garage, Inc. | ||
| 5 | * Copyright (c) 2014-2015, Open Source Robotics Foundation | ||
| 6 | * All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * * Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * * Redistributions in binary form must reproduce the above | ||
| 15 | * copyright notice, this list of conditions and the following | ||
| 16 | * disclaimer in the documentation and/or other materials provided | ||
| 17 | * with the distribution. | ||
| 18 | * * Neither the name of Open Source Robotics Foundation nor the names of its | ||
| 19 | * contributors may be used to endorse or promote products derived | ||
| 20 | * from this software without specific prior written permission. | ||
| 21 | * | ||
| 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 25 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 26 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 28 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 30 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
| 32 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 33 | * POSSIBILITY OF SUCH DAMAGE. | ||
| 34 | */ | ||
| 35 | |||
| 36 | /** \author Joseph Mirabel */ | ||
| 37 | |||
| 38 | #include <boost/mpl/vector.hpp> | ||
| 39 | |||
| 40 | #define BOOST_TEST_MODULE COAL_COLLISION | ||
| 41 | #include <boost/test/included/unit_test.hpp> | ||
| 42 | |||
| 43 | #include <boost/assign/list_of.hpp> | ||
| 44 | #include <fstream> | ||
| 45 | |||
| 46 | #include "coal/fwd.hh" | ||
| 47 | |||
| 48 | COAL_COMPILER_DIAGNOSTIC_PUSH | ||
| 49 | COAL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS | ||
| 50 | |||
| 51 | #include "coal/collision.h" | ||
| 52 | |||
| 53 | COAL_COMPILER_DIAGNOSTIC_POP | ||
| 54 | |||
| 55 | #include "coal/BV/BV.h" | ||
| 56 | #include "coal/mesh_loader/assimp.h" | ||
| 57 | #include "coal/narrowphase/narrowphase.h" | ||
| 58 | #include "coal/shape/geometric_shapes.h" | ||
| 59 | |||
| 60 | #include "../src/collision_node.h" | ||
| 61 | #include "coal/internal/BV_splitter.h" | ||
| 62 | #include "coal/internal/traversal_node_bvhs.h" | ||
| 63 | #include "coal/internal/traversal_node_setup.h" | ||
| 64 | |||
| 65 | #include "coal/timings.h" | ||
| 66 | |||
| 67 | #include "fcl_resources/config.h" | ||
| 68 | #include "utility.h" | ||
| 69 | |||
| 70 | using namespace coal; | ||
| 71 | namespace utf = boost::unit_test::framework; | ||
| 72 | |||
| 73 | int num_max_contacts = (std::numeric_limits<int>::max)(); | ||
| 74 | |||
| 75 |
33/66✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 1 times.
✗ Branch 37 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 66 taken 1 times.
✗ Branch 67 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 77 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 1 times.
✗ Branch 106 not taken.
✓ Branch 108 taken 1 times.
✗ Branch 109 not taken.
✓ Branch 111 taken 1 times.
✗ Branch 112 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
|
4 | BOOST_AUTO_TEST_CASE(OBB_Box_test) { |
| 76 | 2 | Scalar r_extents[] = {-1000, -1000, -1000, 1000, 1000, 1000}; | |
| 77 | 2 | std::vector<Transform3s> rotate_transform; | |
| 78 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | generateRandomTransforms(r_extents, rotate_transform, 1); |
| 79 | |||
| 80 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | AABB aabb1; |
| 81 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | aabb1.min_ = Vec3s(-600, -600, -600); |
| 82 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | aabb1.max_ = Vec3s(600, 600, 600); |
| 83 | |||
| 84 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | OBB obb1; |
| 85 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | convertBV(aabb1, rotate_transform[0], obb1); |
| 86 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | Box box1; |
| 87 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | Transform3s box1_tf; |
| 88 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | constructBox(aabb1, rotate_transform[0], box1, box1_tf); |
| 89 | |||
| 90 | 2 | Scalar extents[] = {-1000, -1000, -1000, 1000, 1000, 1000}; | |
| 91 | 2 | std::size_t n = 1000; | |
| 92 | |||
| 93 | 2 | std::vector<Transform3s> transforms; | |
| 94 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | generateRandomTransforms(extents, transforms, n); |
| 95 | |||
| 96 |
2/2✓ Branch 1 taken 1000 times.
✓ Branch 2 taken 1 times.
|
2002 | for (std::size_t i = 0; i < transforms.size(); ++i) { |
| 97 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | AABB aabb; |
| 98 |
2/4✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1000 times.
✗ Branch 5 not taken.
|
2000 | aabb.min_ = aabb1.min_ * 0.5; |
| 99 |
2/4✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1000 times.
✗ Branch 5 not taken.
|
2000 | aabb.max_ = aabb1.max_ * 0.5; |
| 100 | |||
| 101 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | OBB obb2; |
| 102 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | convertBV(aabb, transforms[i], obb2); |
| 103 | |||
| 104 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | Box box2; |
| 105 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | Transform3s box2_tf; |
| 106 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | constructBox(aabb, transforms[i], box2, box2_tf); |
| 107 | |||
| 108 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | GJKSolver solver; |
| 109 | |||
| 110 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | bool overlap_obb = obb1.overlap(obb2); |
| 111 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionRequest request; |
| 112 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionResult result; |
| 113 | // Convention: when doing primitive-primitive collision, either use | ||
| 114 | // `collide` or `ShapeShapeCollide`. | ||
| 115 | // **DO NOT** use methods of the GJKSolver directly if you don't know what | ||
| 116 | // you are doing. | ||
| 117 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | ShapeShapeCollide<Box, Box>(&box1, box1_tf, &box2, box2_tf, &solver, |
| 118 | request, result); | ||
| 119 | 2000 | bool overlap_box = result.isCollision(); | |
| 120 | |||
| 121 |
6/12✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1000 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 1000 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1000 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1000 times.
✗ Branch 18 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 1000 times.
|
2000 | BOOST_CHECK(overlap_obb == overlap_box); |
| 122 | 2000 | } | |
| 123 | 2 | } | |
| 124 | |||
| 125 |
33/66✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 1 times.
✗ Branch 37 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 66 taken 1 times.
✗ Branch 67 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 77 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 1 times.
✗ Branch 106 not taken.
✓ Branch 108 taken 1 times.
✗ Branch 109 not taken.
✓ Branch 111 taken 1 times.
✗ Branch 112 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
|
4 | BOOST_AUTO_TEST_CASE(OBB_shape_test) { |
| 126 | 2 | Scalar r_extents[] = {-1000, -1000, -1000, 1000, 1000, 1000}; | |
| 127 | 2 | std::vector<Transform3s> rotate_transform; | |
| 128 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | generateRandomTransforms(r_extents, rotate_transform, 1); |
| 129 | |||
| 130 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | AABB aabb1; |
| 131 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | aabb1.min_ = Vec3s(-600, -600, -600); |
| 132 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | aabb1.max_ = Vec3s(600, 600, 600); |
| 133 | |||
| 134 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | OBB obb1; |
| 135 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | convertBV(aabb1, rotate_transform[0], obb1); |
| 136 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | Box box1; |
| 137 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | Transform3s box1_tf; |
| 138 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | constructBox(aabb1, rotate_transform[0], box1, box1_tf); |
| 139 | |||
| 140 | 2 | Scalar extents[] = {-1000, -1000, -1000, 1000, 1000, 1000}; | |
| 141 | 2 | std::size_t n = 1000; | |
| 142 | |||
| 143 | 2 | std::vector<Transform3s> transforms; | |
| 144 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | generateRandomTransforms(extents, transforms, n); |
| 145 | |||
| 146 |
2/2✓ Branch 1 taken 1000 times.
✓ Branch 2 taken 1 times.
|
2002 | for (std::size_t i = 0; i < transforms.size(); ++i) { |
| 147 |
2/4✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1000 times.
✗ Branch 5 not taken.
|
2000 | Scalar len = (aabb1.max_[0] - aabb1.min_[0]) * Scalar(0.5); |
| 148 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | OBB obb2; |
| 149 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | GJKSolver solver; |
| 150 | |||
| 151 | { | ||
| 152 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | Sphere sphere(len); |
| 153 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | computeBV(sphere, transforms[i], obb2); |
| 154 | |||
| 155 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | bool overlap_obb = obb1.overlap(obb2); |
| 156 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionRequest request; |
| 157 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionResult result; |
| 158 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | ShapeShapeCollide<Box, Sphere>(&box1, box1_tf, &sphere, transforms[i], |
| 159 | &solver, request, result); | ||
| 160 | 2000 | bool overlap_sphere = result.isCollision(); | |
| 161 | // The sphere is contained inside obb2. So if the sphere overlaps with | ||
| 162 | // obb1, then necessarily obb2 overlaps with obb1. | ||
| 163 |
6/12✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1000 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 1000 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1000 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1000 times.
✗ Branch 18 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 1000 times.
|
2000 | BOOST_CHECK(overlap_obb >= overlap_sphere); |
| 164 | 2000 | } | |
| 165 | |||
| 166 | { | ||
| 167 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | Capsule capsule(len, 2 * len); |
| 168 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | computeBV(capsule, transforms[i], obb2); |
| 169 | |||
| 170 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | bool overlap_obb = obb1.overlap(obb2); |
| 171 | |||
| 172 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionRequest request; |
| 173 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionResult result; |
| 174 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | ShapeShapeCollide<Box, Capsule>(&box1, box1_tf, &capsule, transforms[i], |
| 175 | &solver, request, result); | ||
| 176 | 2000 | bool overlap_capsule = result.isCollision(); | |
| 177 |
6/12✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1000 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 1000 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1000 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1000 times.
✗ Branch 18 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 1000 times.
|
2000 | BOOST_CHECK(overlap_obb >= overlap_capsule); |
| 178 | 2000 | } | |
| 179 | |||
| 180 | { | ||
| 181 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | Cone cone(len, 2 * len); |
| 182 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | computeBV(cone, transforms[i], obb2); |
| 183 | |||
| 184 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | bool overlap_obb = obb1.overlap(obb2); |
| 185 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionRequest request; |
| 186 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionResult result; |
| 187 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | ShapeShapeCollide<Box, Cone>(&box1, box1_tf, &cone, transforms[i], |
| 188 | &solver, request, result); | ||
| 189 | 2000 | bool overlap_cone = result.isCollision(); | |
| 190 |
6/12✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1000 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 1000 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1000 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1000 times.
✗ Branch 18 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 1000 times.
|
2000 | BOOST_CHECK(overlap_obb >= overlap_cone); |
| 191 | 2000 | } | |
| 192 | |||
| 193 | { | ||
| 194 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | Cylinder cylinder(len, 2 * len); |
| 195 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | computeBV(cylinder, transforms[i], obb2); |
| 196 | |||
| 197 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | bool overlap_obb = obb1.overlap(obb2); |
| 198 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionRequest request; |
| 199 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | CollisionResult result; |
| 200 |
1/2✓ Branch 2 taken 1000 times.
✗ Branch 3 not taken.
|
2000 | ShapeShapeCollide<Box, Cylinder>(&box1, box1_tf, &cylinder, transforms[i], |
| 201 | &solver, request, result); | ||
| 202 | 2000 | bool overlap_cylinder = result.isCollision(); | |
| 203 |
6/12✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1000 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 1000 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1000 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1000 times.
✗ Branch 18 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 1000 times.
|
2000 | BOOST_CHECK(overlap_obb >= overlap_cylinder); |
| 204 | 2000 | } | |
| 205 | 2000 | } | |
| 206 | 2 | } | |
| 207 | |||
| 208 |
33/66✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 1 times.
✗ Branch 37 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 66 taken 1 times.
✗ Branch 67 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 77 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 1 times.
✗ Branch 106 not taken.
✓ Branch 108 taken 1 times.
✗ Branch 109 not taken.
✓ Branch 111 taken 1 times.
✗ Branch 112 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
|
4 | BOOST_AUTO_TEST_CASE(OBB_AABB_test) { |
| 209 | 2 | Scalar extents[] = {-1000, -1000, -1000, 1000, 1000, 1000}; | |
| 210 | 2 | std::size_t n = 1000; | |
| 211 | |||
| 212 | 2 | std::vector<Transform3s> transforms; | |
| 213 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | generateRandomTransforms(extents, transforms, n); |
| 214 | |||
| 215 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | AABB aabb1; |
| 216 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | aabb1.min_ = Vec3s(-600, -600, -600); |
| 217 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | aabb1.max_ = Vec3s(600, 600, 600); |
| 218 | |||
| 219 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | OBB obb1; |
| 220 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | convertBV(aabb1, Transform3s(), obb1); |
| 221 | |||
| 222 |
2/2✓ Branch 1 taken 1000 times.
✓ Branch 2 taken 1 times.
|
2002 | for (std::size_t i = 0; i < transforms.size(); ++i) { |
| 223 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | AABB aabb; |
| 224 |
2/4✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1000 times.
✗ Branch 5 not taken.
|
2000 | aabb.min_ = aabb1.min_ * 0.5; |
| 225 |
2/4✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1000 times.
✗ Branch 5 not taken.
|
2000 | aabb.max_ = aabb1.max_ * 0.5; |
| 226 | |||
| 227 |
1/2✓ Branch 3 taken 1000 times.
✗ Branch 4 not taken.
|
2000 | AABB aabb2 = translate(aabb, transforms[i].getTranslation()); |
| 228 | |||
| 229 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | OBB obb2; |
| 230 |
2/4✓ Branch 3 taken 1000 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1000 times.
✗ Branch 7 not taken.
|
2000 | convertBV(aabb, Transform3s(transforms[i].getTranslation()), obb2); |
| 231 | |||
| 232 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | bool overlap_aabb = aabb1.overlap(aabb2); |
| 233 |
1/2✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
|
2000 | bool overlap_obb = obb1.overlap(obb2); |
| 234 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1000 times.
|
2000 | if (overlap_aabb != overlap_obb) { |
| 235 | ✗ | std::cout << aabb1.min_ << " " << aabb1.max_ << std::endl; | |
| 236 | ✗ | std::cout << aabb2.min_ << " " << aabb2.max_ << std::endl; | |
| 237 | ✗ | std::cout << obb1.To << " " << obb1.extent << " " << obb1.axes | |
| 238 | ✗ | << std::endl; | |
| 239 | ✗ | std::cout << obb2.To << " " << obb2.extent << " " << obb2.axes | |
| 240 | ✗ | << std::endl; | |
| 241 | } | ||
| 242 | |||
| 243 |
6/12✓ Branch 1 taken 1000 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1000 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 1000 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1000 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1000 times.
✗ Branch 18 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 1000 times.
|
2000 | BOOST_CHECK(overlap_aabb == overlap_obb); |
| 244 | } | ||
| 245 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | std::cout << std::endl; |
| 246 | 2 | } | |
| 247 | |||
| 248 | std::ostream *bench_stream = NULL; | ||
| 249 | bool bs_nl = true; | ||
| 250 | bool bs_hp = false; | ||
| 251 | #define BENCHMARK(stream) \ | ||
| 252 | if (bench_stream != NULL) { \ | ||
| 253 | *bench_stream << (bs_nl ? "" : ", ") << stream; \ | ||
| 254 | bs_nl = false; \ | ||
| 255 | } | ||
| 256 | #define BENCHMARK_HEADER(stream) \ | ||
| 257 | if (!bs_hp) { \ | ||
| 258 | BENCHMARK(stream) \ | ||
| 259 | } | ||
| 260 | #define BENCHMARK_NEXT() \ | ||
| 261 | if (bench_stream != NULL && !bs_nl) { \ | ||
| 262 | *bench_stream << '\n'; \ | ||
| 263 | bs_nl = true; \ | ||
| 264 | bs_hp = true; \ | ||
| 265 | } | ||
| 266 | |||
| 267 | typedef std::vector<Contact> Contacts_t; | ||
| 268 | typedef boost::mpl::vector<OBB, RSS, KDOP<24>, KDOP<18>, KDOP<16>, kIOS, OBBRSS> | ||
| 269 | BVs_t; | ||
| 270 | std::vector<SplitMethodType> splitMethods = boost::assign::list_of( | ||
| 271 | SPLIT_METHOD_MEAN)(SPLIT_METHOD_MEDIAN)(SPLIT_METHOD_BV_CENTER); | ||
| 272 | |||
| 273 | #define BV_STR_SPECIALIZATION(bv) \ | ||
| 274 | template <> \ | ||
| 275 | const char *str<bv>() { \ | ||
| 276 | return #bv; \ | ||
| 277 | } | ||
| 278 | template <typename BV> | ||
| 279 | const char *str(); | ||
| 280 | 18 | BV_STR_SPECIALIZATION(AABB) | |
| 281 | 33 | BV_STR_SPECIALIZATION(OBB) | |
| 282 | 36 | BV_STR_SPECIALIZATION(RSS) | |
| 283 | 12 | BV_STR_SPECIALIZATION(KDOP<24>) | |
| 284 | 12 | BV_STR_SPECIALIZATION(KDOP<18>) | |
| 285 | 12 | BV_STR_SPECIALIZATION(KDOP<16>) | |
| 286 | 36 | BV_STR_SPECIALIZATION(kIOS) | |
| 287 | 36 | BV_STR_SPECIALIZATION(OBBRSS) | |
| 288 | |||
| 289 | template <typename T> | ||
| 290 | struct wrap {}; | ||
| 291 | |||
| 292 | struct base_traits { | ||
| 293 | enum { IS_IMPLEMENTED = true }; | ||
| 294 | }; | ||
| 295 | |||
| 296 | enum { | ||
| 297 | Oriented = true, | ||
| 298 | NonOriented = false, | ||
| 299 | Recursive = true, | ||
| 300 | NonRecursive = false | ||
| 301 | }; | ||
| 302 | |||
| 303 | template <typename BV, bool Oriented, bool recursive> | ||
| 304 | struct traits : base_traits {}; | ||
| 305 | |||
| 306 | template <short N, bool recursive> | ||
| 307 | struct traits<KDOP<N>, Oriented, recursive> : base_traits { | ||
| 308 | enum { IS_IMPLEMENTED = false }; | ||
| 309 | }; | ||
| 310 | |||
| 311 | COAL_COMPILER_DIAGNOSTIC_PUSH | ||
| 312 | COAL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS | ||
| 313 | |||
| 314 | struct mesh_mesh_run_test { | ||
| 315 | 3 | mesh_mesh_run_test(const std::vector<Transform3s> &_transforms, | |
| 316 | const CollisionRequest _request) | ||
| 317 | 3 | : transforms(_transforms), | |
| 318 | 3 | request(_request), | |
| 319 | 3 | enable_statistics(false), | |
| 320 | 3 | benchmark(false), | |
| 321 | 3 | isInit(false), | |
| 322 | 3 | indent(0) {} | |
| 323 | |||
| 324 | const std::vector<Transform3s> &transforms; | ||
| 325 | const CollisionRequest request; | ||
| 326 | bool enable_statistics, benchmark; | ||
| 327 | std::vector<Contacts_t> contacts; | ||
| 328 | std::vector<Contacts_t> contacts_ref; | ||
| 329 | bool isInit; | ||
| 330 | |||
| 331 | int indent; | ||
| 332 | |||
| 333 | COAL_COMPILER_DIAGNOSTIC_POP | ||
| 334 | |||
| 335 | 354 | const char *getindent() { | |
| 336 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354 times.
|
354 | assert(indent < 9); |
| 337 | static const char *t[] = {"", | ||
| 338 | "\t", | ||
| 339 | "\t\t", | ||
| 340 | "\t\t\t", | ||
| 341 | "\t\t\t\t", | ||
| 342 | "\t\t\t\t\t", | ||
| 343 | "\t\t\t\t\t\t", | ||
| 344 | "\t\t\t\t\t\t\t", | ||
| 345 | "\t\t\t\t\t\t\t\t"}; | ||
| 346 | 354 | return t[indent]; | |
| 347 | } | ||
| 348 | |||
| 349 | template <typename BV> | ||
| 350 | 138 | void query(const std::vector<Transform3s> &transforms, | |
| 351 | SplitMethodType splitMethod, const CollisionRequest request, | ||
| 352 | std::vector<Contacts_t> &contacts) { | ||
| 353 |
7/10✓ Branch 0 taken 22 times.
✓ Branch 1 taken 47 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
138 | BENCHMARK_HEADER("BV"); |
| 354 |
7/10✓ Branch 0 taken 22 times.
✓ Branch 1 taken 47 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
138 | BENCHMARK_HEADER("oriented"); |
| 355 |
7/10✓ Branch 0 taken 22 times.
✓ Branch 1 taken 47 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
138 | BENCHMARK_HEADER("Split method"); |
| 356 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 48 times.
|
138 | if (enable_statistics) { |
| 357 |
2/10✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
42 | BENCHMARK_HEADER("num_bv_tests"); |
| 358 |
2/10✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
42 | BENCHMARK_HEADER("num_leaf_tests"); |
| 359 | } | ||
| 360 |
7/10✓ Branch 0 taken 22 times.
✓ Branch 1 taken 47 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
138 | BENCHMARK_HEADER("numContacts"); |
| 361 |
7/10✓ Branch 0 taken 22 times.
✓ Branch 1 taken 47 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
138 | BENCHMARK_HEADER("distance_lower_bound"); |
| 362 |
7/10✓ Branch 0 taken 22 times.
✓ Branch 1 taken 47 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
138 | BENCHMARK_HEADER("time"); |
| 363 |
5/6✓ Branch 0 taken 48 times.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 47 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
138 | BENCHMARK_NEXT(); |
| 364 | |||
| 365 | typedef BVHModel<BV> BVH_t; | ||
| 366 | typedef shared_ptr<BVH_t> BVHPtr_t; | ||
| 367 | |||
| 368 |
6/16✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 69 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 69 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 69 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 69 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 69 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
|
138 | BVHPtr_t model1(new BVH_t), model2(new BVH_t); |
| 369 |
3/8✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 69 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 69 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
138 | model1->bv_splitter.reset(new BVSplitter<BV>(splitMethod)); |
| 370 |
3/8✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 69 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 69 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
138 | model2->bv_splitter.reset(new BVSplitter<BV>(splitMethod)); |
| 371 | |||
| 372 |
4/8✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 69 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 69 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 69 times.
✗ Branch 11 not taken.
|
276 | loadPolyhedronFromResource(TEST_RESOURCES_DIR "/env.obj", Vec3s::Ones(), |
| 373 | model1); | ||
| 374 |
4/8✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 69 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 69 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 69 times.
✗ Branch 11 not taken.
|
276 | loadPolyhedronFromResource(TEST_RESOURCES_DIR "/rob.obj", Vec3s::Ones(), |
| 375 | model2); | ||
| 376 | |||
| 377 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
138 | Timer timer(false); |
| 378 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
138 | const Transform3s tf2; |
| 379 | 138 | const std::size_t N = transforms.size(); | |
| 380 | |||
| 381 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
138 | contacts.resize(3 * N); |
| 382 | |||
| 383 | if (traits<BV, Oriented, Recursive>::IS_IMPLEMENTED) { | ||
| 384 |
8/16✓ Branch 2 taken 42 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 42 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 42 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 42 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 42 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 42 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 42 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 42 times.
✗ Branch 27 not taken.
|
84 | BOOST_TEST_MESSAGE(getindent() << "BV: " << str<BV>() << " oriented"); |
| 385 | 84 | ++indent; | |
| 386 | |||
| 387 |
2/2✓ Branch 3 taken 12 times.
✓ Branch 4 taken 42 times.
|
108 | for (std::size_t i = 0; i < transforms.size(); ++i) { |
| 388 | 24 | const Transform3s &tf1 = transforms[i]; | |
| 389 | 24 | timer.start(); | |
| 390 | |||
| 391 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
24 | CollisionResult local_result; |
| 392 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
24 | MeshCollisionTraversalNode<BV, 0> node(request); |
| 393 | 24 | node.enable_statistics = enable_statistics; | |
| 394 | |||
| 395 | bool success = | ||
| 396 |
1/2✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | initialize(node, *model1, tf1, *model2, tf2, local_result); |
| 397 |
6/12✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 12 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 12 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 12 times.
✗ Branch 18 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 12 times.
|
24 | BOOST_REQUIRE(success); |
| 398 | |||
| 399 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
24 | collide(&node, request, local_result); |
| 400 | |||
| 401 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
24 | timer.stop(); |
| 402 | |||
| 403 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
24 | BENCHMARK(str<BV>()); |
| 404 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(1); |
| 405 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(splitMethod); |
| 406 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
24 | if (enable_statistics) { |
| 407 |
9/18✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 12 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 12 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 12 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 12 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 12 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 12 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 12 times.
✗ Branch 29 not taken.
|
24 | BOOST_TEST_MESSAGE(getindent() << "statistics: " << node.num_bv_tests |
| 408 | << " " << node.num_leaf_tests); | ||
| 409 |
7/14✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 12 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 12 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 12 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 12 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 12 times.
✗ Branch 24 not taken.
|
24 | BOOST_TEST_MESSAGE(getindent() |
| 410 | << "nb contacts: " << local_result.numContacts()); | ||
| 411 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(node.num_bv_tests); |
| 412 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(node.num_leaf_tests); |
| 413 | } | ||
| 414 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
24 | BENCHMARK(local_result.numContacts()); |
| 415 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(local_result.distance_lower_bound); |
| 416 |
1/10✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
24 | BENCHMARK(timer.duration().count()); |
| 417 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
24 | BENCHMARK_NEXT(); |
| 418 | |||
| 419 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | if (local_result.numContacts() > 0) { |
| 420 | ✗ | local_result.getContacts(contacts[i]); | |
| 421 | ✗ | std::sort(contacts[i].begin(), contacts[i].end()); | |
| 422 | } | ||
| 423 | } | ||
| 424 | 84 | --indent; | |
| 425 | } | ||
| 426 | |||
| 427 | if (traits<BV, NonOriented, Recursive>::IS_IMPLEMENTED) { | ||
| 428 |
7/14✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 69 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 69 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 69 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 69 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 69 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 69 times.
✗ Branch 24 not taken.
|
138 | BOOST_TEST_MESSAGE(getindent() << "BV: " << str<BV>()); |
| 429 | 138 | ++indent; | |
| 430 | |||
| 431 |
2/2✓ Branch 3 taken 21 times.
✓ Branch 4 taken 69 times.
|
180 | for (std::size_t i = 0; i < transforms.size(); ++i) { |
| 432 |
1/2✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
|
42 | const Transform3s tf1 = transforms[i]; |
| 433 | |||
| 434 | 42 | timer.start(); | |
| 435 |
1/2✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
|
42 | CollisionResult local_result; |
| 436 |
1/2✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
|
42 | MeshCollisionTraversalNode<BV, RelativeTransformationIsIdentity> node( |
| 437 | request); | ||
| 438 | 42 | node.enable_statistics = enable_statistics; | |
| 439 | |||
| 440 |
2/6✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
42 | BVH_t *model1_tmp = new BVH_t(*model1); |
| 441 |
1/2✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
|
42 | Transform3s tf1_tmp = tf1; |
| 442 |
2/6✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
42 | BVH_t *model2_tmp = new BVH_t(*model2); |
| 443 |
1/2✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
|
42 | Transform3s tf2_tmp = tf2; |
| 444 | |||
| 445 |
1/2✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
|
42 | bool success = initialize(node, *model1_tmp, tf1_tmp, *model2_tmp, |
| 446 | tf2_tmp, local_result, true, true); | ||
| 447 |
6/12✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 21 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 21 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 21 times.
✗ Branch 18 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 21 times.
|
42 | BOOST_REQUIRE(success); |
| 448 | |||
| 449 |
1/2✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
|
42 | collide(&node, request, local_result); |
| 450 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
42 | delete model1_tmp; |
| 451 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
42 | delete model2_tmp; |
| 452 | |||
| 453 |
1/2✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
|
42 | timer.stop(); |
| 454 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
42 | BENCHMARK(str<BV>()); |
| 455 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
42 | BENCHMARK(2); |
| 456 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
42 | BENCHMARK(splitMethod); |
| 457 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
42 | if (enable_statistics) { |
| 458 |
9/18✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 21 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 21 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 21 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 21 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 21 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 21 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 21 times.
✗ Branch 29 not taken.
|
42 | BOOST_TEST_MESSAGE(getindent() << "statistics: " << node.num_bv_tests |
| 459 | << " " << node.num_leaf_tests); | ||
| 460 |
7/14✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 21 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 21 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 21 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 21 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 21 times.
✗ Branch 24 not taken.
|
42 | BOOST_TEST_MESSAGE(getindent() |
| 461 | << "nb contacts: " << local_result.numContacts()); | ||
| 462 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
42 | BENCHMARK(node.num_bv_tests); |
| 463 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
42 | BENCHMARK(node.num_leaf_tests); |
| 464 | } | ||
| 465 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
42 | BENCHMARK(local_result.numContacts()); |
| 466 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
42 | BENCHMARK(local_result.distance_lower_bound); |
| 467 |
1/10✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
42 | BENCHMARK(timer.duration().count()); |
| 468 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
42 | BENCHMARK_NEXT(); |
| 469 | |||
| 470 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
|
42 | if (local_result.numContacts() > 0) { |
| 471 | ✗ | local_result.getContacts(contacts[i + N]); | |
| 472 | ✗ | std::sort(contacts[i + N].begin(), contacts[i + N].end()); | |
| 473 | } | ||
| 474 | } | ||
| 475 | 138 | --indent; | |
| 476 | } | ||
| 477 | |||
| 478 | if (traits<BV, Oriented, NonRecursive>::IS_IMPLEMENTED) { | ||
| 479 |
8/16✓ Branch 2 taken 42 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 42 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 42 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 42 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 42 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 42 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 42 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 42 times.
✗ Branch 27 not taken.
|
84 | BOOST_TEST_MESSAGE(getindent() |
| 480 | << "BV: " << str<BV>() << " oriented non-recursive"); | ||
| 481 | 84 | ++indent; | |
| 482 | |||
| 483 |
2/2✓ Branch 3 taken 12 times.
✓ Branch 4 taken 42 times.
|
108 | for (std::size_t i = 0; i < transforms.size(); ++i) { |
| 484 | 24 | timer.start(); | |
| 485 |
1/2✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
|
24 | const Transform3s tf1 = transforms[i]; |
| 486 | |||
| 487 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
24 | CollisionResult local_result; |
| 488 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
24 | MeshCollisionTraversalNode<BV, 0> node(request); |
| 489 | 24 | node.enable_statistics = enable_statistics; | |
| 490 | |||
| 491 | bool success = | ||
| 492 |
1/2✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | initialize(node, *model1, tf1, *model2, tf2, local_result); |
| 493 |
6/12✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 12 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 12 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 12 times.
✗ Branch 18 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 12 times.
|
24 | BOOST_REQUIRE(success); |
| 494 | |||
| 495 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
24 | collide(&node, request, local_result, NULL, false); |
| 496 | |||
| 497 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
24 | timer.stop(); |
| 498 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
24 | BENCHMARK(str<BV>()); |
| 499 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(0); |
| 500 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(splitMethod); |
| 501 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
24 | if (enable_statistics) { |
| 502 |
9/18✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 12 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 12 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 12 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 12 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 12 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 12 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 12 times.
✗ Branch 29 not taken.
|
24 | BOOST_TEST_MESSAGE(getindent() << "statistics: " << node.num_bv_tests |
| 503 | << " " << node.num_leaf_tests); | ||
| 504 |
7/14✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 12 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 12 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 12 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 12 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 12 times.
✗ Branch 24 not taken.
|
24 | BOOST_TEST_MESSAGE(getindent() |
| 505 | << "nb contacts: " << local_result.numContacts()); | ||
| 506 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(node.num_bv_tests); |
| 507 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(node.num_leaf_tests); |
| 508 | } | ||
| 509 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
24 | BENCHMARK(local_result.numContacts()); |
| 510 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
24 | BENCHMARK(local_result.distance_lower_bound); |
| 511 |
1/10✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
24 | BENCHMARK(timer.duration().count()); |
| 512 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
24 | BENCHMARK_NEXT(); |
| 513 | |||
| 514 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | if (local_result.numContacts() > 0) { |
| 515 | ✗ | local_result.getContacts(contacts[i + 2 * N]); | |
| 516 | ✗ | std::sort(contacts[i + 2 * N].begin(), contacts[i + 2 * N].end()); | |
| 517 | } | ||
| 518 | } | ||
| 519 | 84 | --indent; | |
| 520 | } | ||
| 521 | 138 | } | |
| 522 | |||
| 523 | 42 | void check_contacts(std::size_t i0, std::size_t i1, bool warn) { | |
| 524 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 42 times.
|
84 | for (std::size_t i = i0; i < i1; ++i) { |
| 525 | 42 | Contacts_t in_ref_but_not_in_i; | |
| 526 |
2/4✓ Branch 2 taken 42 times.
✗ Branch 3 not taken.
✓ Branch 9 taken 42 times.
✗ Branch 10 not taken.
|
210 | std::set_difference( |
| 527 | 126 | contacts_ref[i].begin(), contacts_ref[i].end(), contacts[i].begin(), | |
| 528 | 42 | contacts[i].end(), | |
| 529 | std::inserter(in_ref_but_not_in_i, in_ref_but_not_in_i.begin())); | ||
| 530 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 42 times.
|
42 | if (!in_ref_but_not_in_i.empty()) { |
| 531 | ✗ | for (std::size_t j = 0; j < in_ref_but_not_in_i.size(); ++j) { | |
| 532 | ✗ | if (warn) { | |
| 533 | ✗ | BOOST_WARN_MESSAGE( | |
| 534 | false, "Missed contacts: " << in_ref_but_not_in_i[j].b1 << ", " | ||
| 535 | << in_ref_but_not_in_i[j].b2); | ||
| 536 | } else { | ||
| 537 | ✗ | BOOST_CHECK_MESSAGE( | |
| 538 | false, "Missed contacts: " << in_ref_but_not_in_i[j].b1 << ", " | ||
| 539 | << in_ref_but_not_in_i[j].b2); | ||
| 540 | } | ||
| 541 | } | ||
| 542 | } | ||
| 543 | |||
| 544 | 42 | Contacts_t in_i_but_not_in_ref; | |
| 545 |
2/4✓ Branch 2 taken 42 times.
✗ Branch 3 not taken.
✓ Branch 9 taken 42 times.
✗ Branch 10 not taken.
|
210 | std::set_difference( |
| 546 | 126 | contacts[i].begin(), contacts[i].end(), contacts_ref[i].begin(), | |
| 547 | 42 | contacts_ref[i].end(), | |
| 548 | std::inserter(in_i_but_not_in_ref, in_i_but_not_in_ref.begin())); | ||
| 549 | |||
| 550 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 42 times.
|
42 | if (!in_i_but_not_in_ref.empty()) { |
| 551 | ✗ | for (std::size_t j = 0; j < in_i_but_not_in_ref.size(); ++j) { | |
| 552 | ✗ | if (warn) { | |
| 553 | ✗ | BOOST_WARN_MESSAGE( | |
| 554 | false, "False contacts: " << in_i_but_not_in_ref[j].b1 << ", " | ||
| 555 | << in_i_but_not_in_ref[j].b2); | ||
| 556 | } else { | ||
| 557 | ✗ | BOOST_CHECK_MESSAGE( | |
| 558 | false, "False contacts: " << in_i_but_not_in_ref[j].b1 << ", " | ||
| 559 | << in_i_but_not_in_ref[j].b2); | ||
| 560 | } | ||
| 561 | } | ||
| 562 | } | ||
| 563 | 42 | } | |
| 564 | 42 | } | |
| 565 | |||
| 566 | template <typename BV> | ||
| 567 | 132 | void check() { | |
| 568 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 20 times.
|
132 | if (benchmark) return; |
| 569 | 40 | const std::size_t N = transforms.size(); | |
| 570 | |||
| 571 |
5/10✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
✓ Branch 11 taken 20 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 20 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 20 times.
|
40 | BOOST_REQUIRE_EQUAL(contacts.size(), 3 * N); |
| 572 |
5/10✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
✓ Branch 12 taken 20 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 20 times.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 20 times.
|
40 | BOOST_REQUIRE_EQUAL(contacts.size(), contacts_ref.size()); |
| 573 | |||
| 574 | if (traits<BV, Oriented, Recursive>::IS_IMPLEMENTED) { | ||
| 575 |
8/16✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 11 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 11 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 11 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 11 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 11 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 11 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 11 times.
✗ Branch 27 not taken.
|
22 | BOOST_TEST_MESSAGE(getindent() << "BV: " << str<BV>() << " oriented"); |
| 576 | 22 | ++indent; | |
| 577 | 22 | check_contacts(0, N, false); | |
| 578 | 22 | --indent; | |
| 579 | } | ||
| 580 | if (traits<BV, NonOriented, Recursive>::IS_IMPLEMENTED) { | ||
| 581 |
7/14✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 20 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 20 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 20 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 20 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 20 times.
✗ Branch 24 not taken.
|
40 | BOOST_TEST_MESSAGE(getindent() << "BV: " << str<BV>()); |
| 582 | 40 | ++indent; | |
| 583 | 40 | check_contacts(N, 2 * N, true); | |
| 584 | 40 | --indent; | |
| 585 | } | ||
| 586 | if (traits<BV, Oriented, NonRecursive>::IS_IMPLEMENTED) { | ||
| 587 |
8/16✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 11 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 11 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 11 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 11 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 11 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 11 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 11 times.
✗ Branch 27 not taken.
|
22 | BOOST_TEST_MESSAGE(getindent() |
| 588 | << "BV: " << str<BV>() << " oriented non-recursive"); | ||
| 589 | 22 | ++indent; | |
| 590 | 22 | check_contacts(2 * N, 3 * N, false); | |
| 591 | 22 | --indent; | |
| 592 | } | ||
| 593 | } | ||
| 594 | |||
| 595 | template <typename BV> | ||
| 596 | 46 | void operator()(wrap<BV>) { | |
| 597 |
2/2✓ Branch 1 taken 69 times.
✓ Branch 2 taken 23 times.
|
184 | for (std::size_t i = 0; i < splitMethods.size(); ++i) { |
| 598 |
7/14✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 69 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 69 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 69 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 69 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 69 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 69 times.
✗ Branch 24 not taken.
|
138 | BOOST_TEST_MESSAGE(getindent() << "splitMethod: " << splitMethods[i]); |
| 599 | 138 | ++indent; | |
| 600 |
2/4✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 69 times.
✗ Branch 6 not taken.
|
138 | query<BV>(transforms, splitMethods[i], request, |
| 601 |
2/2✓ Branch 0 taken 66 times.
✓ Branch 1 taken 3 times.
|
138 | (isInit ? contacts : contacts_ref)); |
| 602 |
2/2✓ Branch 0 taken 66 times.
✓ Branch 1 taken 3 times.
|
138 | if (isInit) check<BV>(); |
| 603 | 138 | isInit = true; | |
| 604 | 138 | --indent; | |
| 605 | } | ||
| 606 | 46 | } | |
| 607 | }; | ||
| 608 | |||
| 609 | // This test | ||
| 610 | // 1. load two objects "env.obj" and "rob.obj" from directory | ||
| 611 | // fcl_resources, | ||
| 612 | // 2. generates n random transformation and for each of them denote tf, | ||
| 613 | // 2.1 performs a collision test where object 1 is in pose tf. All | ||
| 614 | // the contacts are stored in vector global_pairs. | ||
| 615 | // 2.2 performs a series of collision tests with the same object and | ||
| 616 | // the same poses using various methods and various types of bounding | ||
| 617 | // volumes. Each time the contacts are stored in vector global_pairs_now. | ||
| 618 | // | ||
| 619 | // The methods used to test collision are | ||
| 620 | // - collide_Test that calls function collide with tf for object1 pose and | ||
| 621 | // identity for the second object pose, | ||
| 622 | // - collide_Test2 that moves all vertices of object1 in pose tf and that | ||
| 623 | // calls function collide with identity for both object poses, | ||
| 624 | // | ||
| 625 |
33/66✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 1 times.
✗ Branch 37 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 66 taken 1 times.
✗ Branch 67 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 77 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 1 times.
✗ Branch 106 not taken.
✓ Branch 108 taken 1 times.
✗ Branch 109 not taken.
✓ Branch 111 taken 1 times.
✗ Branch 112 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
|
4 | BOOST_AUTO_TEST_CASE(mesh_mesh) { |
| 626 | 2 | std::vector<Transform3s> transforms; | |
| 627 | 2 | Scalar extents[] = {-3000, -3000, 0, 3000, 3000, 3000}; | |
| 628 | #ifndef NDEBUG // if debug mode | ||
| 629 | 2 | std::size_t n = 1; | |
| 630 | #else | ||
| 631 | std::size_t n = 10; | ||
| 632 | #endif | ||
| 633 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
|
2 | n = getNbRun(utf::master_test_suite().argc, utf::master_test_suite().argv, n); |
| 634 | |||
| 635 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | generateRandomTransforms(extents, transforms, n); |
| 636 | |||
| 637 |
7/14✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
|
22 | Eigen::IOFormat f(Eigen::FullPrecision, 0, ", ", ",", "", "", "(", ")"); |
| 638 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
|
4 | for (std::size_t i = 0; i < transforms.size(); ++i) { |
| 639 |
13/26✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 1 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 1 times.
✗ Branch 30 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
|
2 | BOOST_TEST_MESSAGE( |
| 640 | "q" << i << "=" << transforms[i].getTranslation().format(f) << "+" | ||
| 641 | << transforms[i].getQuatRotation().coeffs().format(f)); | ||
| 642 | } | ||
| 643 | |||
| 644 | COAL_COMPILER_DIAGNOSTIC_PUSH | ||
| 645 | COAL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS | ||
| 646 | |||
| 647 | // Request all contacts and check that all methods give the same result. | ||
| 648 | mesh_mesh_run_test runner( | ||
| 649 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | transforms, CollisionRequest(CONTACT, (size_t)num_max_contacts)); |
| 650 | 2 | runner.enable_statistics = true; | |
| 651 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | boost::mpl::for_each<BVs_t, wrap<boost::mpl::placeholders::_1>>(runner); |
| 652 | |||
| 653 | COAL_COMPILER_DIAGNOSTIC_POP | ||
| 654 | 2 | } | |
| 655 | |||
| 656 |
33/66✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 1 times.
✗ Branch 37 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 66 taken 1 times.
✗ Branch 67 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 77 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 1 times.
✗ Branch 106 not taken.
✓ Branch 108 taken 1 times.
✗ Branch 109 not taken.
✓ Branch 111 taken 1 times.
✗ Branch 112 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
|
4 | BOOST_AUTO_TEST_CASE(mesh_mesh_benchmark) { |
| 657 | 2 | std::vector<Transform3s> transforms; | |
| 658 | 2 | Scalar extents[] = {-3000, -3000, 0, 3000, 3000, 3000}; | |
| 659 | #ifndef NDEBUG | ||
| 660 | 2 | std::size_t n = 0; | |
| 661 | #else | ||
| 662 | std::size_t n = 10; | ||
| 663 | #endif | ||
| 664 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
|
2 | n = getNbRun(utf::master_test_suite().argc, utf::master_test_suite().argv, n); |
| 665 | |||
| 666 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | generateRandomTransforms(extents, transforms, n); |
| 667 | |||
| 668 |
7/14✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
|
22 | Eigen::IOFormat f(Eigen::FullPrecision, 0, ", ", ",", "", "", "(", ")"); |
| 669 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
2 | for (std::size_t i = 0; i < transforms.size(); ++i) { |
| 670 | ✗ | BOOST_TEST_MESSAGE( | |
| 671 | "q" << i << "=" << transforms[i].getTranslation().format(f) << "+" | ||
| 672 | << transforms[i].getQuatRotation().coeffs().format(f)); | ||
| 673 | } | ||
| 674 | |||
| 675 | // Request all contacts and check that all methods give the same result. | ||
| 676 | typedef boost::mpl::vector<OBB, RSS, AABB, KDOP<24>, KDOP<18>, KDOP<16>, kIOS, | ||
| 677 | OBBRSS> | ||
| 678 | BVs_t; | ||
| 679 | |||
| 680 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | std::ofstream ofs("./collision.benchmark.csv", std::ofstream::out); |
| 681 | 2 | bench_stream = &ofs; | |
| 682 | |||
| 683 | // without lower bound. | ||
| 684 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | mesh_mesh_run_test runner1(transforms, CollisionRequest()); |
| 685 | 2 | runner1.enable_statistics = false; | |
| 686 | 2 | runner1.benchmark = true; | |
| 687 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | boost::mpl::for_each<BVs_t, wrap<boost::mpl::placeholders::_1>>(runner1); |
| 688 | |||
| 689 | // with lower bound. | ||
| 690 | mesh_mesh_run_test runner2(transforms, | ||
| 691 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | CollisionRequest(DISTANCE_LOWER_BOUND, 1)); |
| 692 | 2 | runner2.enable_statistics = false; | |
| 693 | 2 | runner2.benchmark = true; | |
| 694 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | boost::mpl::for_each<BVs_t, wrap<boost::mpl::placeholders::_1>>(runner2); |
| 695 | |||
| 696 | 2 | bench_stream = NULL; | |
| 697 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | ofs.close(); |
| 698 | 2 | } | |
| 699 |