// 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. // 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 "test_frechet_distance.hpp" template void test_all_cartesian() { typedef bg::model::linestring

linestring_2d; #ifdef BOOST_GEOMETRY_TEST_DEBUG typedef typename coordinate_system

::type CordType; std::cout << typeid(CordType).name() << std::endl; #endif test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 3); test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)",bg::strategy::distance::pythagoras<>(), 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)",sqrt(2.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)",sqrt(2.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)",5); } template void test_all_geographic() { typedef bg::model::linestring

linestring_2d; #ifdef BOOST_GEOMETRY_TEST_DEBUG typedef typename coordinate_system

::type CordType; std::cout << typeid(CordType).name() << std::endl; #endif test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 333958); 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("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)",156898); 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)",156898); 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)",555093); } template void test_all_spherical_equ() { typedef bg::model::linestring

linestring_2d; #ifdef BOOST_GEOMETRY_TEST_DEBUG typedef typename coordinate_system

::type CordType; std::cout << typeid(CordType).name() << std::endl; #endif test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 0.05235987); test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)",bg::strategy::distance::haversine(), 0.05235987); 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.02468205); 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.02468205); 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.0872409); } int test_main(int, char* []) { //Cartesian Coordinate System test_all_cartesian >(); //Geographic Coordinate System test_all_geographic > >(); //Spherical_Equatorial Coordinate System test_all_spherical_equ > >(); return 0; }