[closest_point] Fixes and test addition

This commit is contained in:
Vissarion Fisikopoulos 2022-01-11 15:22:49 +02:00
parent 830633a8a2
commit 0c18f35d92
2 changed files with 36 additions and 3 deletions

View File

@ -14,9 +14,7 @@
#define CREATE_SVG_CLOSEST_POINTS_HPP
#include <fstream>
#if defined(HAVE_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp>
#endif
#include <boost/geometry/io/svg/svg_mapper.hpp>
template
<

View File

@ -55,6 +55,38 @@ void test_closest_points_point_segment(Strategies const& strategies)
//===========================================================================
template <typename InputPoint, typename OutputPoint, typename Strategies>
void test_closest_points_point_segment_integral(Strategies const& strategies)
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG_CLOSEST_POINTS
std::cout << std::endl;
std::cout << "point/segment closest_points tests" << std::endl;
#endif
using InputSegment = bg::model::segment<InputPoint>;
using OutputSegment = bg::model::segment<OutputPoint>;
using tester = test_geometry<InputPoint, InputSegment, OutputSegment>;
tester::apply("POINT(1 1)",
"SEGMENT(0 1,1 0)",
"SEGMENT(1 1,0.5 0.5)",
"SEGMENT(1 1,0.499962 0.500095)",
"SEGMENT(1 1,0.503314 0.496737)",
strategies);
using tester_integral_output = test_geometry<InputPoint, InputSegment, InputSegment>;
tester_integral_output::apply("POINT(1 1)",
"SEGMENT(0 1,1 0)",
"SEGMENT(1 1,0 0)",
"SEGMENT(1 1,0 0)",
"SEGMENT(1 1,0 0)",
strategies);
}
//===========================================================================
template <typename Point, typename Strategies>
void test_closest_points_point_segment_diff_spheroid(Strategies const& strategies)
{
@ -288,6 +320,9 @@ BOOST_AUTO_TEST_CASE( test_all_pointlike_linear )
test_closest_points_point_segment_diff_spheroid<geo_point>
(andoyer(stype(5000000,6000000)));
using int_car_point = bg::model::point<int, 2, bg::cs::cartesian>;
test_closest_points_point_segment_integral<int_car_point, car_point>(cartesian());
}
// tests from https://github.com/boostorg/geometry/pull/707#issuecomment-786650747