mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 15:14:02 +00:00
parent
d7698b1c8a
commit
aa2162f56b
@ -569,7 +569,7 @@ struct touch : public base_turn_handler
|
||||
// ||
|
||||
// |^----
|
||||
// >----->P
|
||||
// * * they touch here (P/Q are (nearly) on top)
|
||||
// * * they touch here (P/Q are (nearly) on top of each other)
|
||||
//
|
||||
// Q continues from where P comes.
|
||||
// P continues from where Q comes
|
||||
@ -586,6 +586,14 @@ struct touch : public base_turn_handler
|
||||
// >----->P qj is LEFT of P1 and pi is LEFT of Q2
|
||||
// (the other way round is also possible)
|
||||
|
||||
// There are also cases like this:
|
||||
// P
|
||||
// ^
|
||||
// ||
|
||||
// ||
|
||||
// P----^-----<Q
|
||||
// This code is not for these cases because of the condition opposite(side.pi_wrt_q1(), side.qk_wrt_p2())
|
||||
|
||||
auto has_distance = [&](auto const& r1, auto const& r2) -> bool
|
||||
{
|
||||
auto const d1 = get_distance_measure(r1.at(0), r1.at(1), r2.at(1), umbrella_strategy);
|
||||
@ -674,6 +682,7 @@ struct touch : public base_turn_handler
|
||||
{
|
||||
if (side_qk_p1 == 0 && side_pk_q1 == 0
|
||||
&& has_pk && has_qk
|
||||
&& opposite(side.pi_wrt_q1(), side.qk_wrt_p2())
|
||||
&& handle_imperfect_touch(range_p, range_q, side_pk_q2, umbrella_strategy, ti))
|
||||
{
|
||||
// If q continues collinearly (opposite) with p, it should be blocked
|
||||
|
@ -58,6 +58,13 @@ struct side_calculator
|
||||
, m_range_q(range_q)
|
||||
{}
|
||||
|
||||
inline int pi_wrt_q1() const { return m_side_strategy.apply(get_qi(), get_qj(), get_pi()); }
|
||||
|
||||
inline int pj_wrt_q1() const { return m_side_strategy.apply(get_qi(), get_qj(), get_pj()); }
|
||||
inline int pj_wrt_q2() const { return m_side_strategy.apply(get_qj(), get_qk(), get_pj()); }
|
||||
inline int qj_wrt_p1() const { return m_side_strategy.apply(get_pi(), get_pj(), get_qj()); }
|
||||
inline int qj_wrt_p2() const { return m_side_strategy.apply(get_pj(), get_pk(), get_qj()); }
|
||||
|
||||
inline int pk_wrt_p1() const { return m_side_strategy.apply(get_pi(), get_pj(), get_pk()); }
|
||||
inline int pk_wrt_q1() const { return m_side_strategy.apply(get_qi(), get_qj(), get_pk()); }
|
||||
inline int qk_wrt_p1() const { return m_side_strategy.apply(get_pi(), get_pj(), get_qk()); }
|
||||
@ -66,12 +73,6 @@ struct side_calculator
|
||||
inline int pk_wrt_q2() const { return m_side_strategy.apply(get_qj(), get_qk(), get_pk()); }
|
||||
inline int qk_wrt_p2() const { return m_side_strategy.apply(get_pj(), get_pk(), get_qk()); }
|
||||
|
||||
// Necessary when rescaling turns off:
|
||||
inline int qj_wrt_p1() const { return m_side_strategy.apply(get_pi(), get_pj(), get_qj()); }
|
||||
inline int qj_wrt_p2() const { return m_side_strategy.apply(get_pj(), get_pk(), get_qj()); }
|
||||
inline int pj_wrt_q1() const { return m_side_strategy.apply(get_qi(), get_qj(), get_pj()); }
|
||||
inline int pj_wrt_q2() const { return m_side_strategy.apply(get_qj(), get_qk(), get_pj()); }
|
||||
|
||||
inline auto const& get_pi() const { return m_range_p.at(0); }
|
||||
inline auto const& get_pj() const { return m_range_p.at(1); }
|
||||
inline auto const& get_pk() const { return m_range_p.at(2); }
|
||||
|
@ -1231,6 +1231,59 @@ static std::string issue_1342_b[2] =
|
||||
"POLYGON((2.000000861538488 2.944711629068049e-16,2.000000861538488 2.0000008,23.52786548447633 2.0000008,23.52786548447633 2.944711629068049e-16,2.000000861538488 2.944711629068049e-16))"
|
||||
};
|
||||
|
||||
static std::string issue_1345_a[2] =
|
||||
{
|
||||
// Needs check for opposite in handle_imperfect_touch
|
||||
R""""(
|
||||
POLYGON((
|
||||
-2.0785311235613415 -0.6304193410175202,
|
||||
-2.0534946127981359 -0.6304193410175202,
|
||||
-2.0534946127981359 -0.8867932112327471,
|
||||
-2.3098684830133629 -0.8867932112327471,
|
||||
-2.3098684830133629 -0.6554558517807265,
|
||||
-2.2848319722501573 -0.6554558517807265,
|
||||
-2.0785311235613415 -0.6554558517807265,
|
||||
-2.0785311235613415 -0.6304193410175202
|
||||
))
|
||||
)"""",
|
||||
R""""(
|
||||
POLYGON((
|
||||
-2.0785311235613420 -0.6304193410175202,
|
||||
-2.0534946127981359 -0.6304193410175202,
|
||||
-2.0534946127981359 -0.6554558517807265,
|
||||
-2.0785311235613420 -0.6554558517807265,
|
||||
-2.0785311235613420 -0.6304193410175202
|
||||
))
|
||||
)""""
|
||||
};
|
||||
|
||||
static std::string issue_1345_b[2] =
|
||||
{
|
||||
// Needs check for opposite in handle_imperfect_touch
|
||||
R""""(
|
||||
POLYGON((
|
||||
-6.1723606999999996 3.2834021000000000,
|
||||
-6.1723606999999996 2.8006724999999992,
|
||||
-5.7133718999999994 2.8006724999999992,
|
||||
-5.7133718999999994 3.2834021000000000,
|
||||
-5.6896310999999997 3.2834021000000000,
|
||||
-5.6896310999999997 2.7769316999999996,
|
||||
-6.1961014999999993 2.7769316999999996,
|
||||
-6.1961014999999993 3.2834021000000000,
|
||||
-6.1723606999999996 3.2834021000000000
|
||||
))
|
||||
)"""",
|
||||
R""""(
|
||||
POLYGON((
|
||||
-6.1723606999999996 2.8006724999999997,
|
||||
-5.7133718999999994 2.8006724999999997,
|
||||
-5.7133718999999994 2.7769316999999996,
|
||||
-6.1723606999999996 2.7769316999999996,
|
||||
-6.1723606999999996 2.8006724999999997
|
||||
))
|
||||
)""""
|
||||
};
|
||||
|
||||
static std::string ggl_list_20120229_volker[3] =
|
||||
{
|
||||
"POLYGON((1716 1554,2076 2250,2436 2352,2796 1248,3156 2484,3516 2688,3516 2688,3156 2484,2796 1248,2436 2352,2076 2250, 1716 1554))",
|
||||
|
@ -647,6 +647,9 @@ void test_all()
|
||||
TEST_DIFFERENCE(issue_1342_a, 2, 5.762381026454777, 0, 0.0, 2);
|
||||
TEST_DIFFERENCE(issue_1342_b, 2, 5.762381026454777, 1, 2.55e-14, 3);
|
||||
|
||||
TEST_DIFFERENCE(issue_1345_a, 1, 0.059308854, 0, 0.0, 1);
|
||||
TEST_DIFFERENCE(issue_1345_b, 2, 0.024048025, 0, 0.0, 2);
|
||||
|
||||
TEST_DIFFERENCE(mysql_21977775, 2, 160.856568913, 2, 92.3565689126, 4);
|
||||
TEST_DIFFERENCE(mysql_21965285, 1, 92.0, 1, 14.0, 1);
|
||||
TEST_DIFFERENCE(mysql_23023665_1, 1, 92.0, 1, 142.5, 2);
|
||||
|
@ -315,6 +315,9 @@ void test_areal()
|
||||
TEST_INTERSECTION(issue_1342_a, 1, -1, 43.05575);
|
||||
TEST_INTERSECTION(issue_1342_b, 1, -1, 43.05575);
|
||||
|
||||
TEST_INTERSECTION(issue_1345_a, 1, -1, 0.00062682687);
|
||||
TEST_INTERSECTION(issue_1345_b, 1, -1, 0.010896761);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
|
||||
1, 31, 2.271707796);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
|
||||
|
@ -493,6 +493,12 @@ void test_areal()
|
||||
TEST_UNION(issue_1342_b, 1, 0, -1, 48.81812749462214);
|
||||
TEST_UNION_REV(issue_1342_b, 1, 0, -1, 48.81812749462214);
|
||||
|
||||
TEST_UNION(issue_1345_a, 1, 0, -1, 0.059935681);
|
||||
TEST_UNION_REV(issue_1345_a, 1, 0, -1, 0.059935681);
|
||||
|
||||
TEST_UNION(issue_1345_b, 1, 0, -1, 0.034944786);
|
||||
TEST_UNION_REV(issue_1345_b, 1, 0, -1, 0.034944786);
|
||||
|
||||
TEST_UNION(geos_1, 1, 0, -1, expectation_limits(3458.0, 3461.3203125));
|
||||
TEST_UNION(geos_2, 1, 0, -1, expectation_limits(349.0625, 350.55102539));
|
||||
TEST_UNION(geos_3, 1, 0, -1, 29391548.4998779);
|
||||
|
Loading…
x
Reference in New Issue
Block a user