mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-12 05:51:47 +00:00
[geometry] Fixed unit test for collinear intersections w.r.t new parameters
This commit is contained in:
parent
ecd0cd8499
commit
41f9c94e31
@ -127,6 +127,16 @@ public :
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(BOOST_GEOMETRY_DEFINE_STREAM_OPERATOR_SEGMENT_RATIO)
|
||||||
|
friend std::ostream& operator<<(std::ostream &os, segment_ratio const& ratio)
|
||||||
|
{
|
||||||
|
os << ratio.m_numerator << "/" << ratio.m_denominator;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private :
|
private :
|
||||||
Type m_numerator;
|
Type m_numerator;
|
||||||
Type m_denominator;
|
Type m_denominator;
|
||||||
|
@ -15,6 +15,7 @@ test-suite boost-geometry-strategies
|
|||||||
[ run projected_point.cpp ]
|
[ run projected_point.cpp ]
|
||||||
[ run pythagoras.cpp ]
|
[ run pythagoras.cpp ]
|
||||||
[ run spherical_side.cpp ]
|
[ run spherical_side.cpp ]
|
||||||
|
[ run segment_intersection_collinear.cpp ]
|
||||||
[ run transform_cs.cpp ]
|
[ run transform_cs.cpp ]
|
||||||
[ run transformer.cpp ]
|
[ run transformer.cpp ]
|
||||||
[ run within.cpp ]
|
[ run within.cpp ]
|
||||||
|
@ -103,16 +103,23 @@ static void test_segment_intersection(int caseno,
|
|||||||
segment_type s34(p3,p4);
|
segment_type s34(p3,p4);
|
||||||
|
|
||||||
// Get the intersection point (or two points)
|
// Get the intersection point (or two points)
|
||||||
segment_intersection_points<P> is
|
typedef bg::detail::no_rescale_policy rescale_policy_type;
|
||||||
= strategy::intersection::relate_cartesian_segments
|
rescale_policy_type rescale_policy;
|
||||||
|
|
||||||
|
typedef bg::segment_intersection_points
|
||||||
<
|
<
|
||||||
policies::relate::segments_intersection_points
|
P,
|
||||||
|
typename bg::segment_ratio_type
|
||||||
<
|
<
|
||||||
segment_type,
|
P,
|
||||||
segment_type,
|
rescale_policy_type
|
||||||
segment_intersection_points<P>
|
>::type
|
||||||
>
|
> result_type;
|
||||||
>::apply(s12, s34);
|
|
||||||
|
result_type is = strategy::intersection::relate_cartesian_segments
|
||||||
|
<
|
||||||
|
bg::policies::relate::segments_intersection_points<result_type>
|
||||||
|
>::apply(s12, s34, rescale_policy);
|
||||||
|
|
||||||
// Get the Dimension Extended 9 Intersection Matrix (de9im) for Segments
|
// Get the Dimension Extended 9 Intersection Matrix (de9im) for Segments
|
||||||
// (this one is extended by GGL having opposite)
|
// (this one is extended by GGL having opposite)
|
||||||
@ -127,8 +134,8 @@ static void test_segment_intersection(int caseno,
|
|||||||
// Get just a character for Left/Right/intersects/etc, purpose is more for debugging
|
// Get just a character for Left/Right/intersects/etc, purpose is more for debugging
|
||||||
policies::relate::direction_type dir = strategy::intersection::relate_cartesian_segments
|
policies::relate::direction_type dir = strategy::intersection::relate_cartesian_segments
|
||||||
<
|
<
|
||||||
policies::relate::segments_direction<segment_type, segment_type>
|
policies::relate::segments_direction
|
||||||
>::apply(s12, s34);
|
>::apply(s12, s34, rescale_policy);
|
||||||
|
|
||||||
int expected_count = 0;
|
int expected_count = 0;
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#define BOOST_GEOMETRY_DEFINE_STREAM_OPERATOR_SEGMENT_RATIO
|
||||||
|
|
||||||
#include <geometry_test_common.hpp>
|
#include <geometry_test_common.hpp>
|
||||||
|
|
||||||
@ -75,28 +76,32 @@ static void test_segment_intersection(std::string const& case_id,
|
|||||||
segment_type s12(p1,p2);
|
segment_type s12(p1,p2);
|
||||||
segment_type s34(p3,p4);
|
segment_type s34(p3,p4);
|
||||||
|
|
||||||
|
typedef bg::detail::no_rescale_policy rescale_policy_type;
|
||||||
|
rescale_policy_type rescale_policy;
|
||||||
|
|
||||||
|
typedef bg::segment_intersection_points
|
||||||
|
<
|
||||||
|
P,
|
||||||
|
typename bg::segment_ratio_type
|
||||||
|
<
|
||||||
|
P,
|
||||||
|
rescale_policy_type
|
||||||
|
>::type
|
||||||
|
> result_type;
|
||||||
|
|
||||||
// Get the intersection point (or two points)
|
// Get the intersection point (or two points)
|
||||||
bg::segment_intersection_points<P> is
|
result_type is
|
||||||
= bg::strategy::intersection::relate_cartesian_segments
|
= bg::strategy::intersection::relate_cartesian_segments
|
||||||
<
|
<
|
||||||
bg::policies::relate::segments_intersection_points
|
bg::policies::relate::segments_intersection_points<result_type>
|
||||||
<
|
>::apply(s12, s34, rescale_policy, p1, p2, p3, p4);
|
||||||
segment_type,
|
|
||||||
segment_type,
|
|
||||||
bg::segment_intersection_points<P>
|
|
||||||
>
|
|
||||||
>::apply(s12, s34, p1, p2, p3, p4);
|
|
||||||
|
|
||||||
// Get just a character for Left/Right/intersects/etc, purpose is more for debugging
|
// Get just a character for Left/Right/intersects/etc, purpose is more for debugging
|
||||||
bg::policies::relate::direction_type dir
|
bg::policies::relate::direction_type dir
|
||||||
= bg::strategy::intersection::relate_cartesian_segments
|
= bg::strategy::intersection::relate_cartesian_segments
|
||||||
<
|
<
|
||||||
bg::policies::relate::segments_direction
|
bg::policies::relate::segments_direction
|
||||||
<
|
>::apply(s12, s34, rescale_policy, p1, p2, p3, p4);
|
||||||
segment_type,
|
|
||||||
segment_type
|
|
||||||
>
|
|
||||||
>::apply(s12, s34, p1, p2, p3, p4);
|
|
||||||
|
|
||||||
std::size_t expected_count =
|
std::size_t expected_count =
|
||||||
check(is, 0, expected_x1, expected_y1)
|
check(is, 0, expected_x1, expected_y1)
|
||||||
@ -132,17 +137,25 @@ static void test_segment_ratio(std::string const& case_id,
|
|||||||
segment_type s12(p1, p2);
|
segment_type s12(p1, p2);
|
||||||
segment_type s34(p3, p4);
|
segment_type s34(p3, p4);
|
||||||
|
|
||||||
|
typedef bg::detail::no_rescale_policy rescale_policy_type;
|
||||||
|
rescale_policy_type rescale_policy;
|
||||||
|
|
||||||
|
typedef bg::segment_intersection_points
|
||||||
|
<
|
||||||
|
P,
|
||||||
|
typename bg::segment_ratio_type
|
||||||
|
<
|
||||||
|
P,
|
||||||
|
rescale_policy_type
|
||||||
|
>::type
|
||||||
|
> result_type;
|
||||||
|
|
||||||
// Get the intersection point (or two points)
|
// Get the intersection point (or two points)
|
||||||
bg::segment_intersection_points<P> is
|
result_type is
|
||||||
= bg::strategy::intersection::relate_cartesian_segments
|
= bg::strategy::intersection::relate_cartesian_segments
|
||||||
<
|
<
|
||||||
bg::policies::relate::segments_intersection_points
|
bg::policies::relate::segments_intersection_points<result_type>
|
||||||
<
|
>::apply(s12, s34, rescale_policy, p1, p2, p3, p4);
|
||||||
segment_type,
|
|
||||||
segment_type,
|
|
||||||
bg::segment_intersection_points<P>
|
|
||||||
>
|
|
||||||
>::apply(s12, s34, p1, p2, p3, p4);
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(is.count, 2u);
|
BOOST_CHECK_EQUAL(is.count, 2u);
|
||||||
BOOST_CHECK_EQUAL(is.fractions[0].robust_ra, expected_a1);
|
BOOST_CHECK_EQUAL(is.fractions[0].robust_ra, expected_a1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user