1 #define BOOST_TEST_MODULE COAL_GJK_ASSERTS
3 #include <boost/test/included/unit_test.hpp>
4 #include <boost/math/constants/constants.hpp>
10 constexpr
CoalScalar pi = boost::math::constants::pi<CoalScalar>();
13 static double degToRad =
pi / 180.;
14 return deg * degToRad;
20 size_t polarSteps{32};
21 size_t azimuthSteps{32};
23 const float PI =
static_cast<float>(
pi);
25 const float polarStep =
PI / (float)(polarSteps - 1);
26 const float azimuthStep = 2.0f *
PI / (float)(azimuthSteps - 1);
27 std::vector<Vec3s> vertices;
28 std::vector<Triangle> triangles;
30 for (
size_t p = 0; p < polarSteps; ++p) {
31 for (
size_t a = 0;
a < azimuthSteps; ++
a) {
33 std::sin((
float)p * polarStep) * std::cos((
float)
a * azimuthStep);
35 std::sin((
float)p * polarStep) * std::sin((
float)
a * azimuthStep);
36 const float z = std::cos((
float)p * polarStep);
37 vertices.emplace_back(radius *
x, radius *
y, radius * z);
41 for (
size_t p = 0; p < polarSteps - 1; ++p) {
42 for (
size_t a = 0;
a < azimuthSteps - 1; ++
a) {
43 size_t p0 = p * azimuthSteps +
a;
44 size_t p1 = p * azimuthSteps + (
a + 1);
45 size_t p2 = (p + 1) * azimuthSteps + (
a + 1);
46 size_t p3 = (p + 1) * azimuthSteps +
a;
47 triangles.emplace_back(p0, p2,
p1);
48 triangles.emplace_back(p0, p3, p2);
70 for (
int i = 0; i < 360; ++i) {
71 for (
int j = 0; j < 180; ++j) {
74 (i == 5 && j == 48) || (i == 64 && j == 151) ||
75 (i == 98 && j == 47) || (i == 355 && j == 48) ||
77 (i == 86 && j == 52) || (i == 89 && j == 17) ||
78 (i == 89 && j == 58) || (i == 89 && j == 145)) {
86 BOOST_CHECK_NO_THROW(compute(sphere2Tf, sphere1Tf, request, result));