diff options
author | Roman Sorokin <sorok-roma@yandex.ru> | 2014-08-05 17:22:39 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:23:33 +0300 |
commit | 8ccca443f16ee37b5382e65c57c942f0ca09ea08 (patch) | |
tree | 5012ae8bb09cb757504d06f98a9ba08dd13c1d93 /geometry/geometry_tests | |
parent | 026d4bca976345a1d79c9ce6d52436da086a522c (diff) |
new test for length of spline
Diffstat (limited to 'geometry/geometry_tests')
-rw-r--r-- | geometry/geometry_tests/spline_test.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/geometry/geometry_tests/spline_test.cpp b/geometry/geometry_tests/spline_test.cpp index aa03af8af0..2d881e7b00 100644 --- a/geometry/geometry_tests/spline_test.cpp +++ b/geometry/geometry_tests/spline_test.cpp @@ -182,3 +182,26 @@ UNIT_TEST(BeginAgain) TEST_EQUAL(itr.BeginAgain(), true, ()); } +UNIT_TEST(Length) +{ + vector<PointF> path; + PointF const p1(27.5536633f, 64.2492523f); + PointF const p2(27.5547638f, 64.2474289f); + PointF const p3(27.5549412f, 64.2471237f); + PointF const p4(27.5559044f, 64.2456436f); + PointF const p5(27.556284f, 64.2451782f); + path.push_back(p1); + path.push_back(p2); + path.push_back(p3); + path.push_back(p4); + path.push_back(p5); + Spline spl(path); + float len1 = spl.GetLength(); + float l1 = p1.Length(p2); + float l2 = p2.Length(p3); + float l3 = p3.Length(p4); + float l4 = p4.Length(p5); + float len2 = l1 + l2 + l3 + l4; + TEST_ALMOST_EQUAL(len1, len2, ()); +} + |