[algorithms] Fix box/segment distance for segment bottom of box
This commit is contained in:
parent
27d8955188
commit
0fb5cabe67
@ -356,20 +356,28 @@ private:
|
||||
|
||||
LessEqual less_equal;
|
||||
|
||||
/*
|
||||
if (less_equal(geometry::get<1>(top_right), geometry::get<1>(p0)))
|
||||
{
|
||||
// closest box point is the top-right corner
|
||||
//return cast::apply(pp_strategy.apply(p0, top_right));
|
||||
return cast::apply(ps_strategy.apply(p0, bottom_right, top_right));
|
||||
return cast::apply(ps_strategy.apply(top_right, p0, p1));
|
||||
}
|
||||
else if (less_equal(geometry::get<1>(bottom_right),
|
||||
else*/
|
||||
if (less_equal(geometry::get<1>(bottom_right),
|
||||
geometry::get<1>(p0)))
|
||||
{
|
||||
return std::min(
|
||||
cast::apply(ps_strategy.apply(top_right, p0, p1)),
|
||||
cast::apply(ps_strategy.apply(p0, bottom_right, top_right))
|
||||
);
|
||||
|
||||
|
||||
// distance is realized between p0 and right-most
|
||||
// segment of box
|
||||
//ReturnType diff =
|
||||
//ps_strategy.get_distance_strategy().apply(p0, bottom_right);
|
||||
return cast::apply(ps_strategy.apply(p0, bottom_right, top_right));
|
||||
///return cast::apply(ps_strategy.apply(p0, bottom_right, top_right));
|
||||
//ReturnType diff =
|
||||
//ps_strategy.get_distance_strategy().template coordinate<0>(p0, bottom_right);
|
||||
//ReturnType diff = cast::apply(geometry::get<0>(p0))
|
||||
@ -414,8 +422,8 @@ private:
|
||||
ReturnType diff =
|
||||
//ps_strategy.get_distance_strategy().template coordinate<1>(p0, top_left);
|
||||
|
||||
ps_strategy.get_distance_strategy().meridian(geometry::get<1>(p0),
|
||||
geometry::get<1>(top_left));
|
||||
ps_strategy.get_distance_strategy().meridian(geometry::get_as_radian<1>(p0),
|
||||
geometry::get_as_radian<1>(top_left));
|
||||
|
||||
//ReturnType diff = cast::apply(geometry::get<1>(p0))
|
||||
// - cast::apply(geometry::get<1>(top_left));
|
||||
|
@ -53,21 +53,21 @@ typedef bg::strategy::distance::geographic_cross_track<bg::strategy::vincenty, s
|
||||
typedef bg::strategy::distance::geographic_cross_track_box_box
|
||||
<
|
||||
bg::strategy::andoyer,
|
||||
bg::srs::spheroid<double>,
|
||||
stype,
|
||||
double
|
||||
> andoyer_bb;
|
||||
|
||||
typedef bg::strategy::distance::geographic_cross_track_box_box
|
||||
<
|
||||
bg::strategy::thomas,
|
||||
bg::srs::spheroid<double>,
|
||||
stype,
|
||||
double
|
||||
> thomas_bb;
|
||||
|
||||
typedef bg::strategy::distance::geographic_cross_track_box_box
|
||||
<
|
||||
bg::strategy::vincenty,
|
||||
bg::srs::spheroid<double>,
|
||||
stype,
|
||||
double
|
||||
> vincenty_bb;
|
||||
|
||||
|
@ -58,21 +58,21 @@ typedef bg::strategy::distance::geographic_cross_track<bg::strategy::vincenty, s
|
||||
typedef bg::strategy::distance::geographic_cross_track_point_box
|
||||
<
|
||||
bg::strategy::andoyer,
|
||||
bg::srs::spheroid<double>,
|
||||
stype,
|
||||
double
|
||||
> andoyer_pb;
|
||||
|
||||
typedef bg::strategy::distance::geographic_cross_track_point_box
|
||||
<
|
||||
bg::strategy::thomas,
|
||||
bg::srs::spheroid<double>,
|
||||
stype,
|
||||
double
|
||||
> thomas_pb;
|
||||
|
||||
typedef bg::strategy::distance::geographic_cross_track_point_box
|
||||
<
|
||||
bg::strategy::vincenty,
|
||||
bg::srs::spheroid<double>,
|
||||
stype,
|
||||
double
|
||||
> vincenty_pb;
|
||||
|
||||
@ -134,22 +134,57 @@ void test_distance_segment_box(Strategy_pp const& strategy_pp,
|
||||
ps_distance("POINT(10 20)", "SEGMENT(0 0,0 25)", strategy_ps),
|
||||
strategy_ps);
|
||||
|
||||
tester::apply("sb2-1", "SEGMENT(0 5, 10 5)", box1,
|
||||
ps_distance("POINT(10 10)", "SEGMENT(0 5,10 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("sb2-2", "SEGMENT(0 5, 15 5)", box1,
|
||||
ps_distance("POINT(10 10)", "SEGMENT(0 5,15 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("sb2-3a", "SEGMENT(0 5, 20 5)", box1,
|
||||
ps_distance("POINT(10 10)", "SEGMENT(0 5,20 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
|
||||
tester::apply("test1", "SEGMENT(0 5, 9 5)", box1,
|
||||
ps_distance("POINT(10 10)", "SEGMENT(0 5, 9 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test2", "SEGMENT(0 5, 10 5)", box1,
|
||||
ps_distance("POINT(10 10)", "SEGMENT(0 5, 10 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test3", "SEGMENT(0 5, 11 5)", box1,
|
||||
ps_distance("POINT(10 10)", "SEGMENT(0 5, 11 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test4", "SEGMENT(0 5, 20 5)", box1,
|
||||
ps_distance("POINT(10 10)", "SEGMENT(0 5,20 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test5", "SEGMENT(0 5, 22 5)", box1,
|
||||
ps_distance("POINT(11 10)", "SEGMENT(0 5,22 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test6", "SEGMENT(10 5, 20 5)", box1,
|
||||
ps_distance("POINT(15 10)", "SEGMENT(10 5,20 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test7", "SEGMENT(10 5, 22 5)", box1,
|
||||
ps_distance("POINT(16 10)", "SEGMENT(10 5,22 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test8", "SEGMENT(12 5, 22 5)", box1,
|
||||
ps_distance("POINT(17 10)", "SEGMENT(12 5,22 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test9", "SEGMENT(18 5, 22 5)", box1,
|
||||
ps_distance("POINT(20 10)", "SEGMENT(18 5,22 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test10", "SEGMENT(18 5, 24 5)", box1,
|
||||
ps_distance("POINT(20 10)", "SEGMENT(18 5,24 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test11", "SEGMENT(20 5, 24 5)", box1,
|
||||
ps_distance("POINT(20 10)", "SEGMENT(20 5,24 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("test12", "SEGMENT(22 5, 24 5)", box1,
|
||||
ps_distance("POINT(20 10)", "SEGMENT(22 5,24 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
/*
|
||||
tester::apply("sb2-3b", "SEGMENT(0 5, 25 5)", box1,
|
||||
ps_distance("POINT(12.5 10)", "SEGMENT(0 5,25 5)", strategy_ps),
|
||||
ps_distance("POINT(15 10)", "SEGMENT(0 5,25 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
tester::apply("sb2-3c", "SEGMENT(0 5, 26 5)", box1,
|
||||
ps_distance("POINT(13 10)", "SEGMENT(0 5,26 5)", strategy_ps),
|
||||
strategy_ps);
|
||||
|
||||
*/
|
||||
//tester::apply("sb2-3", "SEGMENT(0 5, 25 6)", box1,
|
||||
// ps_distance("POINT(12.5 10)", "SEGMENT(0 5,25 6)", strategy_ps),
|
||||
// //pp_distance("POINT(10 10)", "POINT(10 5)", strategy_pp),
|
||||
|
@ -56,21 +56,21 @@ typedef bg::strategy::distance::geographic_cross_track<bg::strategy::vincenty, s
|
||||
typedef bg::strategy::distance::geographic_cross_track_point_box
|
||||
<
|
||||
bg::strategy::andoyer,
|
||||
bg::srs::spheroid<double>,
|
||||
stype,
|
||||
double
|
||||
> andoyer_pb;
|
||||
|
||||
typedef bg::strategy::distance::geographic_cross_track_point_box
|
||||
<
|
||||
bg::strategy::thomas,
|
||||
bg::srs::spheroid<double>,
|
||||
stype,
|
||||
double
|
||||
> thomas_pb;
|
||||
|
||||
typedef bg::strategy::distance::geographic_cross_track_point_box
|
||||
<
|
||||
bg::strategy::vincenty,
|
||||
bg::srs::spheroid<double>,
|
||||
stype,
|
||||
double
|
||||
> vincenty_pb;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user