1 #include <gtest/gtest.h> 8 #include "../../../src/core/maps/regular_squares_grid.h" 48 ASSERT_EQ(
DSegment({{0, 0}, {0, 1}, {0, 2}, {0, 3}}),
53 ASSERT_EQ(
DSegment({{0, 0}, {0, 1}, {1, 2}, {1, 3}}),
58 ASSERT_EQ(
DSegment({{0, 0}, {0, 1}, {1, 1}, {1, 2}, {2, 2}, {2, 3}}),
63 ASSERT_EQ(
DSegment({{0, 0}, {1, 1}, {2, 2}, {3, 3}}),
68 ASSERT_EQ(
DSegment({{0, 0}, {1, 0}, {1, 1}, {2, 1}, {2, 2}, {3, 2}}),
73 ASSERT_EQ(
DSegment({{0, 0}, {1, 0}, {2, 1}, {3, 1}}),
78 ASSERT_EQ(
DSegment({{0, 0}, {1, 0}, {2, 0}, {3, 0}}),
83 ASSERT_EQ(
DSegment({{0, 0}, {1, 0}, {2, -1}, {3, -1}}),
88 ASSERT_EQ(
DSegment({{0, 0}, {1, 0}, {1, -1}, {2, -1}, {2, -2}, {3, -2}}),
93 ASSERT_EQ(
DSegment({{0, 0}, {1, -1}, {2, -2}, {3, -3}}),
98 ASSERT_EQ(
DSegment({{0, 0}, {0, -1}, {1, -1}, {1, -2}, {2, -2}, {2, -3}}),
103 ASSERT_EQ(
DSegment({{0, 0}, {0, -1}, {1, -2}, {1, -3}}),
108 ASSERT_EQ(
DSegment({{0, 0}, {0, -1}, {0, -2}, {0, -3}}),
113 ASSERT_EQ(
DSegment({{0, 0}, {0, -1}, {-1, -2}, {-1, -3}}),
118 ASSERT_EQ(
DSegment({{0, 0}, {0, -1}, {-1, -1}, {-1, -2}, {-2, -2}, {-2, -3}}),
123 ASSERT_EQ(
DSegment({{0, 0}, {-1, -1}, {-2, -2}, {-3, -3}}),
128 ASSERT_EQ(
DSegment({{0, 0}, {-1, 0}, {-1, -1}, {-2, -1}, {-2, -2}, {-3, -2}}),
133 ASSERT_EQ(
DSegment({{0, 0}, {-1, 0}, {-2, -1}, {-3, -1}}),
138 ASSERT_EQ(
DSegment({{0, 0}, {-1, 0}, {-2, 0}, {-3, 0}}),
143 ASSERT_EQ(
DSegment({{0, 0}, {-1, 0}, {-2, 1}, {-3, 1}}),
148 ASSERT_EQ(
DSegment({{0, 0}, {-1, 0}, {-1, 1}, {-2, 1}, {-2, 2}, {-3, 2}}),
153 ASSERT_EQ(
DSegment({{0, 0}, {-1, 1}, {-2, 2}, {-3, 3}}),
158 ASSERT_EQ(
DSegment({{0, 0}, {0, 1}, {-1, 1}, {-1, 2}, {-2, 2}, {-2, 3}}),
163 ASSERT_EQ(
DSegment({{0, 0}, {0, 1}, {-1, 2}, {-1, 3}}),
169 ASSERT_EQ(
DSegment({{7, 5}, {8, 5}, {9, 5}, {10, 5}}),
174 ASSERT_EQ(
DSegment({{-4, -6}, {-3, -6}, {-2, -6}, {-1, -6}}),
179 ASSERT_EQ(
DSegment({{7, 5}, {8, 5}, {9, 5}, {10, 5}}),
184 ASSERT_EQ(
DSegment({{10, 5}, {9, 5}, {8, 5}, {7, 5}}),
190 ASSERT_EQ(
DSegment({{7, 5}, {7, 6}, {7, 7}, {7, 8}}),
195 ASSERT_EQ(
DSegment({{7, 5}, {7, 6}, {7, 7}, {7, 8}}),
200 ASSERT_EQ(
DSegment({{7, 5}, {7, 6}, {7, 7}, {7, 8}}),
205 ASSERT_EQ(
DSegment({{7, 8}, {7, 7}, {7, 6}, {7, 5}}),
210 ASSERT_EQ(
DSegment({{0, 0}, {0, 1}, {0, 2}, {0, 3},
211 {1, 3}, {1, 4}, {1, 5}, {1, 6}}),
218 DSegment({{5, 7}, {6, 8}, {7, 9}, {8, 10}}));
223 DSegment({{8, 10}, {7, 9}, {6, 8}, {5, 7}}));
228 DSegment({{-2, -2}, {-1, -2}, {-1, -1},
229 {0, -1}, {0, 0}, {1, 0}, {1, 1}}));
235 {0, -1}, {-1, -1}, {-1, -2}, {-2, -2}}));
240 DSegment({{-2, -2}, {-2, -1}, {-1, -1},
241 {-1, 0}, {0, 0}, {0, 1}, {1, 1}}));
247 {-1, 0}, {-1, -1}, {-2, -1}, {-2, -2}}));
252 DSegment({{-2, -2}, {-2, -1}, {-1, -1},
253 {0, 0}, {1, 0}, {1, 1}}));
259 {-1, -1}, {-2, -1}, {-2, -2}}));
266 DSegment({{0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}}));
271 DSegment({{0, 0}, {0, -1}, {0, -2}, {0, -3}, {0, -4}}));
276 DSegment({{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}}));
281 DSegment({{0, 0}, {-1, 0}, {-2, 0}, {-3, 0}, {-4, 0}}));
288 static_assert(std::numeric_limits<double>::has_infinity,
289 "Infinity is not defined for doubles.");
290 static constexpr
double Inf = std::numeric_limits<double>::infinity();
302 test_grid_access(0, 0);
303 test_grid_access(std::numeric_limits<double>::max(),
304 std::numeric_limits<double>::max());
312 test_grid_access(-5, 3);
313 test_grid_access(std::numeric_limits<double>::lowest(),
314 std::numeric_limits<double>::max());
322 test_grid_access(-5, -3);
323 test_grid_access(std::numeric_limits<double>::lowest(),
324 std::numeric_limits<double>::lowest());
332 test_grid_access(5, -3);
333 test_grid_access(std::numeric_limits<double>::max(),
334 std::numeric_limits<double>::lowest());
345 int main (
int argc,
char *argv[]) {
346 ::testing::InitGoogleTest(&argc, argv);
347 return RUN_ALL_TESTS();
int main(int argc, char *argv[])
std::vector< DiscretePoint2D > DSegment
Coord world_to_cell(const Point2D &pt) const
Point2D cell_to_world(const Coord &cell) const
std::vector< Coord > world_to_cells(const Segment2D &s) const
TEST_F(RSGSegmentRasterizationTest, samePoint)
static constexpr double Grid_Scale
void test_grid_access(double x, double y)
Point2D cell_middle(const DiscretePoint2D &pnt)
RSGSegmentRasterizationTest()