// Boost.Geometry // Copyright (c) 2018 Yaghyavardhan Singh Khangarot, Hyderabad, India. // Contributed and/or modified by Yaghyavardhan Singh Khangarot, // as part of Google Summer of Code 2018 program. // This file was modified by Oracle on 2018. // Modifications copyright (c) 2018 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include #include "test_hausdorff_distance.hpp" template void test_all_cartesian() { typedef bg::model::linestring

linestring_2d; typedef bg::model::multi_linestring mlinestring_t; typedef bg::model::multi_point

mpoint_t; #ifdef BOOST_GEOMETRY_TEST_DEBUG typedef typename coordinate_system

::type CordType; std::cout << typeid(CordType).name() << std::endl; #endif test_geometry("POINT(3 1)","MULTIPOINT(0 0,3 4,4 3)", sqrt(5.0)); test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 3); test_geometry("MULTIPOINT(3 0,2 1,3 2)","MULTIPOINT(0 0,3 4,4 3)", 3); test_geometry("LINESTRING(1 1,2 2,4 3)","MULTILINESTRING((0 0,3 4,4 3),(1 1,2 2,4 3))", sqrt(5.0)); test_geometry("MULTILINESTRING((3 0,2 1,3 2),(0 0,3 4,4 3))","MULTILINESTRING((0 0,3 4,4 3),(3 0,2 1,3 2))", 3); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)","LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)",0); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)","LINESTRING(1 1, 0 1, 0 0, 1 0, 1 1)",0); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 0)","LINESTRING(0 0, 1 0, 1 1, 0 0)",0); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 0)","LINESTRING(1 1, 0 0, 1 0, 1 1)",0); test_geometry("LINESTRING(0 0, 1 0)","LINESTRING(0 0, 1 0)",0); test_geometry("LINESTRING(0 0,3 4,4 3)","LINESTRING(4 3,3 4,0 0)",0); } template void test_all_geographic() { typedef bg::model::linestring

linestring_2d; typedef bg::model::multi_linestring mlinestring_t; typedef bg::model::multi_point

mpoint_t; #ifdef BOOST_GEOMETRY_TEST_DEBUG typedef typename coordinate_system

::type CordType; std::cout << typeid(CordType).name() << std::endl; #endif test_geometry("POINT(3 1)","MULTIPOINT(0 0,3 4,4 3)", 247552); test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 333958); test_geometry("MULTIPOINT(3 0,2 1,3 2)","MULTIPOINT(0 0,3 4,4 3)", 333958); test_geometry("LINESTRING(1 1,2 2,4 3)","MULTILINESTRING((0 0,3 4,4 3),(1 1,2 2,4 3))", 247518); test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)",bg::strategy::distance::geographic(), 333958.472379679); test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)",bg::strategy::distance::geographic(), 333958.472379679); test_geometry("MULTILINESTRING((3 0,2 1,3 2),(0 0,3 4,4 3))","MULTILINESTRING((0 0,3 4,4 3),(3 0,2 1,3 2))",333958); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)","LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)",0); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)","LINESTRING(1 1, 0 1, 0 0, 1 0, 1 1)",0); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 0)","LINESTRING(0 0, 1 0, 1 1, 0 0)",0); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 0)","LINESTRING(1 1, 0 0, 1 0, 1 1)",0); test_geometry("LINESTRING(0 0, 1 0)","LINESTRING(0 0, 1 0)",0); test_geometry("LINESTRING(0 0,3 4,4 3)","LINESTRING(4 3,3 4,0 0)",0); } template void test_all_spherical_equ() { typedef bg::model::linestring

linestring_2d; typedef bg::model::multi_linestring mlinestring_t; typedef bg::model::multi_point

mpoint_t; #ifdef BOOST_GEOMETRY_TEST_DEBUG typedef typename coordinate_system

::type CordType; std::cout << typeid(CordType).name() << std::endl; #endif test_geometry("POINT(3 1)","MULTIPOINT(0 0,3 4,4 3)", 0.03902); test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 0.05236); test_geometry("MULTIPOINT(3 0,2 1,3 2)","MULTIPOINT(0 0,3 4,4 3)", 0.05236); test_geometry("LINESTRING(1 1,2 2,4 3)","MULTILINESTRING((0 0,3 4,4 3),(1 1,2 2,4 3))", 0.03900); test_geometry("MULTILINESTRING((3 0,2 1,3 2),(0 0,3 4,4 3))","MULTILINESTRING((0 0,3 4,4 3),(3 0,2 1,3 2))",0.05236); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)","LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)",0); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)","LINESTRING(1 1, 0 1, 0 0, 1 0, 1 1)",0); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 0)","LINESTRING(0 0, 1 0, 1 1, 0 0)",0); test_geometry("LINESTRING(0 0, 1 0, 1 1, 0 0)","LINESTRING(1 1, 0 0, 1 0, 1 1)",0); test_geometry("LINESTRING(0 0, 1 0)","LINESTRING(0 0, 1 0)",0); test_geometry("LINESTRING(0 0,3 4,4 3)","LINESTRING(4 3,3 4,0 0)",0); } int test_main(int, char* []) { //Cartesian Coordinate System test_all_cartesian >(); test_all_cartesian >(); test_all_cartesian >(); //Geographic Coordinate System test_all_geographic > >(); test_all_geographic > >(); //Spherical_Equatorial Coordinate System test_all_spherical_equ > >(); test_all_spherical_equ > >(); return 0; }