52 int expected_triangle =
55 ASSERT_EQ(expected_triangle, triangle);
57 int expected_subtriangle =
61 ASSERT_EQ(expected_subtriangle, subtriangle);
68 ASSERT_EQ(-1, subtriangle) <<
"triangle is " << triangle;
102 if (section_index >= 80) {
106 unsigned int i = section_index / 4;
107 unsigned int j = section_index % 4;
108 auto &t = triangles[i];
109 Vector3f mt[3]{(t[0] + t[1]) / 2, (t[1] + t[2]) / 2, (t[2] + t[0]) / 2};
143 test_triangles_indexes(p);
149 for (i = 0; p.inclusive_sections[i] > 0; i++) {
151 if (s == p.inclusive_sections[i]) {
155 if (p.inclusive_sections[i] < 0) {
156 ADD_FAILURE() <<
"section " << s <<
" with inclusive=true not found in inclusive_sections";
162 {{
M_GOLDEN, 1.0f, 0.0f}, -1, {27, 30, 43, 46, 49, -1}},
163 {{
M_GOLDEN, -1.0f, 0.0f}, -1, {19, 23, 25, 41, 78, -1}},
164 {{-
M_GOLDEN, 1.0f, 0.0f}, -1, { 1, 38, 59, 63, 65, -1}},
165 {{-
M_GOLDEN, -1.0f, 0.0f}, -1, { 3, 6, 9, 67, 70, -1}},
166 {{ 1.0f, 0.0f,
M_GOLDEN}, -1, {42, 45, 53, 75, 79, -1}},
167 {{-1.0f, 0.0f,
M_GOLDEN}, -1, {55, 62, 66, 69, 73, -1}},
168 {{ 1.0f, 0.0f, -
M_GOLDEN}, -1, {15, 22, 26, 29, 33, -1}},
169 {{-1.0f, 0.0f, -
M_GOLDEN}, -1, { 2, 5, 13, 35, 39, -1}},
170 {{0.0f,
M_GOLDEN, 1.0f}, -1, {47, 50, 54, 57, 61, -1}},
171 {{0.0f,
M_GOLDEN, -1.0f}, -1, {31, 34, 37, 51, 58, -1}},
172 {{0.0f, -
M_GOLDEN, 1.0f}, -1, {11, 18, 71, 74, 77, -1}},
173 {{0.0f, -
M_GOLDEN, -1.0f}, -1, { 7, 10, 14, 17, 21, -1}},
177 ::testing::ValuesIn(icosahedron_vertices));
182 std::vector<TestParam> params;
194 p.
v = a + b + c * 0.001f;
196 p.
v = a + b * 0.001f + c;
198 p.
v = a * 0.001f + b + c;
202 p.
v = a + b * 0.001 + c * 0.001f;
204 p.
v = a * 0.001f + b + c * 0.001f;
206 p.
v = a * 0.001f + b * 0.001f + c;
233 ::testing::ValuesIn(hardcoded_vectors));
void test_triangles_indexes(const TestParam &p)
static std::vector< TestParam > general_vectors
static const Vector3f triangles[20][3]
INSTANTIATE_TEST_CASE_P(IcosahedronVertices, GeodesicGridTest, ::testing::ValuesIn(icosahedron_vertices))
static TestParam hardcoded_vectors[]
static int _triangle_index(const Vector3f &v, bool inclusive)
static TestParam icosahedron_vertices[]
TEST_P(GeodesicGridTest, Sections)
AP_GTEST_PRINTATBLE_PARAM_MEMBER(TestParam, v)
static const int NUM_SUBTRIANGLES
static int section(const Vector3f &v, bool inclusive=false)
static int _subtriangle_index(const unsigned int triangle_index, const Vector3f &v, bool inclusive)
static bool section_triangle(unsigned int section_index, Vector3f &a, Vector3f &b, Vector3f &c)
int inclusive_sections[7]