37 #define BOOST_TEST_MODULE COAL_NESTEROV_GJK
38 #include <boost/test/included/unit_test.hpp>
40 #include <Eigen/Geometry>
109 unsigned int max_iterations = 128;
111 GJK gjk(max_iterations, tolerance);
112 GJK gjk_nesterov(max_iterations, tolerance);
114 GJK gjk_polyak(max_iterations, tolerance);
123 std::vector<Transform3s> transforms;
130 init_support_guess.setZero();
132 for (
size_t i = 0; i < n; ++i) {
140 GJK::Status res_gjk_1 =
141 gjk.evaluate(mink_diff, init_guess, init_support_guess);
143 GJK::Status res_gjk_2 =
144 gjk.evaluate(mink_diff, init_guess, init_support_guess);
145 BOOST_CHECK(res_gjk_1 == res_gjk_2);
151 GJK::Status res_nesterov_gjk_1 =
152 gjk_nesterov.
evaluate(mink_diff, init_guess, init_support_guess);
153 Vec3s ray_nesterov = gjk_nesterov.
ray;
154 GJK::Status res_nesterov_gjk_2 =
155 gjk_nesterov.
evaluate(mink_diff, init_guess, init_support_guess);
156 BOOST_CHECK(res_nesterov_gjk_1 == res_nesterov_gjk_2);
161 BOOST_CHECK(res_nesterov_gjk_1 == res_gjk_1);
162 BOOST_CHECK_SMALL(fabs(ray_gjk.norm() - ray_nesterov.norm()), 1e-4);
166 BOOST_CHECK(
gjk.getNumIterations() < max_iterations);
172 GJK::Status res_polyak_gjk_1 =
173 gjk_polyak.
evaluate(mink_diff, init_guess, init_support_guess);
175 GJK::Status res_polyak_gjk_2 =
176 gjk_polyak.
evaluate(mink_diff, init_guess, init_support_guess);
177 BOOST_CHECK(res_polyak_gjk_1 == res_polyak_gjk_2);
182 BOOST_CHECK(res_polyak_gjk_1 == res_gjk_1);
183 BOOST_CHECK_SMALL(fabs(ray_gjk.norm() - ray_polyak.norm()), 1e-4);
187 BOOST_CHECK(
gjk.getNumIterations() < max_iterations);
215 Box box0 =
Box(0.1, 0.2, 0.3);
216 Box box1 =
Box(1.1, 1.2, 1.3);
260 Box box0 =
Box(0.1, 0.2, 0.3);
261 Box box1 =
Box(1.1, 1.2, 1.3);
268 Box box0 =
Box(0.1, 0.2, 0.3);
269 Box box1 =
Box(1.1, 1.2, 1.3);