projected_point.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Unit Test
  3. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
  4. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
  5. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
  6. // This file was modified by Oracle on 2014.
  7. // Modifications copyright (c) 2014, Oracle and/or its affiliates.
  8. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  9. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  10. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  11. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  12. // Use, modification and distribution is subject to the Boost Software License,
  13. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  14. // http://www.boost.org/LICENSE_1_0.txt)
  15. #include <strategies/test_projected_point.hpp>
  16. template <typename P1, typename P2>
  17. void test_all_2d()
  18. {
  19. test_2d<P1, P2>("POINT(1 1)", "POINT(0 0)", "POINT(2 3)", 0.27735203958327);
  20. test_2d<P1, P2>("POINT(2 2)", "POINT(1 4)", "POINT(4 1)", 0.5 * sqrt(2.0));
  21. test_2d<P1, P2>("POINT(6 1)", "POINT(1 4)", "POINT(4 1)", 2.0);
  22. test_2d<P1, P2>("POINT(1 6)", "POINT(1 4)", "POINT(4 1)", 2.0);
  23. }
  24. template <typename P>
  25. void test_all_2d()
  26. {
  27. //test_all_2d<P, int[2]>();
  28. //test_all_2d<P, float[2]>();
  29. //test_all_2d<P, double[2]>();
  30. //test_all_2d<P, test::test_point>();
  31. test_all_2d<P, bg::model::point<int, 2, bg::cs::cartesian> >();
  32. test_all_2d<P, bg::model::point<float, 2, bg::cs::cartesian> >();
  33. test_all_2d<P, bg::model::point<double, 2, bg::cs::cartesian> >();
  34. test_all_2d<P, bg::model::point<long double, 2, bg::cs::cartesian> >();
  35. }
  36. int test_main(int, char* [])
  37. {
  38. test_all_2d<int[2]>();
  39. test_all_2d<float[2]>();
  40. test_all_2d<double[2]>();
  41. //test_all_2d<test::test_point>();
  42. test_all_2d<bg::model::point<int, 2, bg::cs::cartesian> >();
  43. test_all_2d<bg::model::point<float, 2, bg::cs::cartesian> >();
  44. test_all_2d<bg::model::point<double, 2, bg::cs::cartesian> >();
  45. test_services
  46. <
  47. bg::model::point<double, 2, bg::cs::cartesian>,
  48. bg::model::point<float, 2, bg::cs::cartesian>,
  49. long double
  50. >();
  51. #if defined(HAVE_TTMATH)
  52. test_all_2d
  53. <
  54. bg::model::point<ttmath_big, 2, bg::cs::cartesian>,
  55. bg::model::point<ttmath_big, 2, bg::cs::cartesian>
  56. >();
  57. #endif
  58. return 0;
  59. }