buffer_point_geo.cpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Boost.Geometry
  2. // Unit Test
  3. // Copyright (c) 2018-2019 Barend Gehrels, Amsterdam, the Netherlands.
  4. // Use, modification and distribution is subject to the Boost Software License,
  5. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #include "test_buffer_geo.hpp"
  8. static std::string const simplex = "POINT(4.9 52.0)";
  9. template <bool Clockwise, typename PointType>
  10. void test_point()
  11. {
  12. typedef bg::model::polygon<PointType, Clockwise> polygon;
  13. bg::strategy::buffer::join_miter join_miter;
  14. bg::strategy::buffer::end_flat end_flat;
  15. // NOTE: for now do not test with a radius less than 2 meter, because is not precise yet (in double)
  16. test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 70.7107, 5.0, ut_settings(0.1, false, 8));
  17. test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 76.5437, 5.0, ut_settings(0.1, false, 16));
  18. // * Result is different for clang/VCC. Specified expectation is in between, and tolerance higher
  19. test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 77.9640, 5.0, ut_settings(0.2, false, 32));
  20. // The more points used for the buffer, the more the area approaches 10*PI square meters
  21. test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 282.8430, 10.0, ut_settings(0.1, false, 8));
  22. test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 306.1471, 10.0, ut_settings(0.1, false, 16));
  23. test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 312.1450, 10.0, ut_settings(0.1, false, 32));
  24. // * Same here
  25. test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 313.9051, 10.0, ut_settings(0.2, false, 180));
  26. }
  27. int test_main(int, char* [])
  28. {
  29. BoostGeometryWriteTestConfiguration();
  30. test_point<true, bg::model::point<default_test_type, 2, bg::cs::geographic<bg::degree> > >();
  31. #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
  32. test_point<true, bg::model::point<long double, 2, bg::cs::geographic<bg::degree> > >();
  33. #endif
  34. return 0;
  35. }