[formulas] [tests] Change thomas direct interface

This commit is contained in:
Vissarion Fysikopoulos 2018-06-18 14:08:58 +03:00
parent 88469892dd
commit cc2ded01ee
5 changed files with 15 additions and 85 deletions

View File

@ -40,6 +40,7 @@ namespace boost { namespace geometry { namespace formula
*/
template <
typename CT,
bool SecondOrder = true,
bool EnableCoordinates = true,
bool EnableReverseAzimuth = false,
bool EnableReducedLength = false,
@ -59,8 +60,7 @@ public:
T const& la1,
Dist const& distance,
Azi const& azimuth12,
Spheroid const& spheroid,
bool SecondOrder = true)
Spheroid const& spheroid)
{
result_type result;

View File

@ -1,73 +0,0 @@
// Boost.Geometry
// Copyright (c) 2017 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, 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)
#ifndef BOOST_GEOMETRY_FORMULAS_THOMAS_FIRST_ORDER_DIRECT_HPP
#define BOOST_GEOMETRY_FORMULAS_THOMAS_FIRST_ORDER_DIRECT_HPP
#include <boost/math/constants/constants.hpp>
#include <boost/geometry/core/radius.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/formulas/differential_quantities.hpp>
#include <boost/geometry/formulas/flattening.hpp>
#include <boost/geometry/formulas/result_direct.hpp>
#include <boost/geometry/formulas/thomas_direct.hpp>
namespace boost { namespace geometry { namespace formula
{
/*!
\brief The solution of the direct problem of geodesics on latlong coordinates,
Forsyth-Andoyer-Lambert type approximation with first order terms.
\author See
- Technical Report: PAUL D. THOMAS, MATHEMATICAL MODELS FOR NAVIGATION SYSTEMS, 1965
http://www.dtic.mil/docs/citations/AD0627893
- Technical Report: PAUL D. THOMAS, SPHEROIDAL GEODESICS, REFERENCE SYSTEMS, AND LOCAL GEOMETRY, 1970
http://www.dtic.mil/docs/citations/AD0703541
*/
template <
typename CT,
bool EnableCoordinates = true,
bool EnableReverseAzimuth = false,
bool EnableReducedLength = false,
bool EnableGeodesicScale = false
>
class thomas_first_order_direct
{
public:
typedef result_direct<CT> result_type;
template <typename T, typename Dist, typename Azi, typename Spheroid>
static inline result_type apply(T const& lo1,
T const& la1,
Dist const& distance,
Azi const& azimuth12,
Spheroid const& spheroid)
{ return thomas_direct<
CT,
EnableCoordinates,
EnableReverseAzimuth,
EnableReducedLength,
EnableGeodesicScale
>::apply(lo1, la1, distance, azimuth12, spheroid, false);
}
};
}}} // namespace boost::geometry::formula
#endif // BOOST_GEOMETRY_FORMULAS_THOMAS_FIRST_ORDER_DIRECT_HPP

View File

@ -10,7 +10,6 @@
#ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_PARAMETERS_HPP
#define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_PARAMETERS_HPP
#include <boost/geometry/formulas/thomas_first_order_direct.hpp>
#include <boost/geometry/formulas/andoyer_inverse.hpp>
#include <boost/geometry/formulas/thomas_direct.hpp>
#include <boost/geometry/formulas/thomas_inverse.hpp>
@ -35,9 +34,10 @@ struct andoyer
bool EnableGeodesicScale = false
>
struct direct
: formula::thomas_first_order_direct
: formula::thomas_direct
<
CT, EnableCoordinates, EnableReverseAzimuth,
CT, false,
EnableCoordinates, EnableReverseAzimuth,
EnableReducedLength, EnableGeodesicScale
>
{};
@ -74,7 +74,8 @@ struct thomas
struct direct
: formula::thomas_direct
<
CT, EnableCoordinates, EnableReverseAzimuth,
CT, true,
EnableCoordinates, EnableReverseAzimuth,
EnableReducedLength, EnableGeodesicScale
>
{};

View File

@ -15,7 +15,6 @@
#include <boost/geometry/formulas/vincenty_direct.hpp>
#include <boost/geometry/formulas/thomas_direct.hpp>
#include <boost/geometry/formulas/thomas_first_order_direct.hpp>
//#include <boost/geometry/formulas/series_expansion_direct.hpp>
#include <boost/geometry/formulas/spherical.hpp>
@ -60,14 +59,14 @@ void test_all(expected_results const& results)
result.reverse_azimuth *= r2d;
check_direct(result, results.vincenty, results.karney, 0.00000001);
typedef bg::formula::thomas_direct<double, true, true, true, true> th_t;
typedef bg::formula::thomas_direct<double, true, true, true, true, true> th_t;
result = th_t::apply(lon1r, lat1r, distance, azi12r, spheroid);
result.lon2 *= r2d;
result.lat2 *= r2d;
result.reverse_azimuth *= r2d;
check_direct(result, results.thomas, results.karney, 0.0000001);
typedef bg::formula::thomas_first_order_direct<double, true, true, true, true> th_t1st;
typedef bg::formula::thomas_direct<double, false, true, true, true, true> th_t1st;
result = th_t1st::apply(lon1r, lat1r, distance, azi12r, spheroid);
result.lon2 *= r2d;
result.lat2 *= r2d;

View File

@ -1,8 +1,9 @@
// Boost.Geometry
// Unit Test
// Copyright (c) 2016-2017 Oracle and/or its affiliates.
// Copyright (c) 2016-2018 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
@ -21,6 +22,8 @@
#include <boost/geometry/formulas/vincenty_direct.hpp>
#include <boost/geometry/formulas/vincenty_inverse.hpp>
#include <boost/geometry/strategies/geographic/parameters.hpp>
#include <boost/geometry/srs/spheroid.hpp>
void check_result(expected_result const& result, expected_result const& expected,
@ -68,8 +71,8 @@ void test_formulas(expected_results const& results, bool check_reference_only)
if (results.gnomonic_thomas.lon != ND)
{
bg::formula::gnomonic_intersection<double, bg::formula::thomas_inverse, bg::formula::thomas_direct>
::apply(lona1r, lata1r, lona2r, lata2r, lonb1r, latb1r, lonb2r, latb2r, result.lon, result.lat, spheroid);
bg::formula::gnomonic_intersection<double, bg::strategy::thomas::inverse, bg::strategy::thomas::direct>
::apply(lona1r, lata1r, lona2r, lata2r, lonb1r, latb1r, lonb2r, latb2r, result.lon, result.lat, spheroid);
result.lon *= r2d;
result.lat *= r2d;
check_result(result, results.gnomonic_thomas, results.sjoberg_vincenty, 0.0000001, check_reference_only);