diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-02-20 14:38:19 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:37:40 +0300 |
commit | d81da1422bd976ee8632b7f893f1b99876faab23 (patch) | |
tree | a6683273df5789133915c0819477579e3cbb670e /geometry/geometry_tests | |
parent | 57872f6b24c218e6b346ec73b644edd11bf3b063 (diff) |
[routing] Storing points of border crossing
Diffstat (limited to 'geometry/geometry_tests')
-rw-r--r-- | geometry/geometry_tests/region_test.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/geometry/geometry_tests/region_test.cpp b/geometry/geometry_tests/region_test.cpp index 64cc0fb208..386a8f4926 100644 --- a/geometry/geometry_tests/region_test.cpp +++ b/geometry/geometry_tests/region_test.cpp @@ -212,3 +212,23 @@ UNIT_TEST(Region_point_at_border_test) TEST(region.AtBorder(p4, 0.01), ("Point lies at the border")); TEST(region.AtBorder(p5, 0.01), ("Point lies at delta interval near the border")); } + +UNIT_TEST(Region_border_intersecion_Test) +{ + typedef m2::PointF P; + P const points[] = { P(0.0, 1.0), P(0.0, 10.0), P(10.0, 10.0), P(10.0, 1.0) }; + m2::Region<P> region(points, points + ARRAY_SIZE(points)); + + P intersection; + + TEST(region.FindIntersection(P(5.0, 5.0), P(15.0, 5.0), intersection), ()); + TEST(intersection == P(10.0, 5.0), ()); + + TEST(region.FindIntersection(P(5.0, 5.0), P(15.0, 15.0), intersection), ()); + TEST(intersection == P(10.0, 10.0), ()); + + TEST(region.FindIntersection(P(7.0, 7.0), P(7.0, 10.0), intersection), ()); + TEST(intersection == P(7.0, 10.0), ()); + + TEST(!region.FindIntersection(P(5.0, 5.0), P(2.0, 2.0), intersection), ("This case has no intersection")); +} |