boost :: geometry :: intersects не работает для разных типов геометрии?

Я пытаюсь использовать boost::geometry::intersects проверить, пересекает ли отрезок многоугольник. Следующий код работает хорошо:

#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/intersects.hpp>
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/io/wkt/read.hpp>
#include <iostream>

namespace bg = boost::geometry;

int main(int argc, char** argv) {
typedef bg::model::point<double, 2, bg::cs::cartesian> Point;
bg::model::ring<Point> poly1, poly2;
bg::model::segment<Point> s1, s2;

bg::read_wkt("POLYGON((0.0 0.0, 1.0 1.0, 0.0 2.0, 2.0 1.0))", poly1);
bg::correct(poly1);

bg::read_wkt("POLYGON((1.5 0.0, 1.5 2.0, 3.0 1.0))", poly2);
bg::correct(poly2);

bg::read_wkt("SEGMENT(0.0 0.0,0.0 2.0)", s1);
bg::read_wkt("SEGMENT(-1.0 1.0,2.0 1.0)", s2);

std::cout << "Polygons intersect " << bg::intersects(poly1, poly2) << std::endl;
std::cout << "Segments intersect " << bg::intersects(s1, s2) << std::endl;
//std::cout << "Polygon and segment intersect " << bg::intersects(poly1, s1) << std::endl;

return 0;
}

Однако, если я раскомментирую строку с bg::intersects(poly1, s1) Я получаю следующие ошибки компиляции:

g++    -c -g -I/opt/local/include -MMD -MP -MF build/Debug/GNU-MacOSX/main.o.d -o build/Debug/GNU-MacOSX/main.o main.cpp
In file included from main.cpp:8:
In file included from /opt/local/include/boost/geometry/algorithms/correct.hpp:36:
In file included from /opt/local/include/boost/geometry/algorithms/disjoint.hpp:33:
In file included from /opt/local/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp:56:
/opt/local/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp:542:5: error: no matching function for call to 'assertion_failed'
BOOST_MPL_ASSERT_MSG
^~~~~~~~~~~~~~~~~~~~
/opt/local/include/boost/mpl/assert.hpp:434:48: note: expanded from macro 'BOOST_MPL_ASSERT_MSG'
#define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
^
/opt/local/include/boost/mpl/assert.hpp:428:9: note: expanded from macro '\
BOOST_MPL_ASSERT_MSG_IMPL'
boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/boost/mpl/assert.hpp:59:58: note: expanded from macro '\
BOOST_MPL_AUX_ASSERT_CONSTANT'
#   define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
^
/opt/local/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp:661:5: note: in instantiation of template class 'boost::geometry::dispatch::sectionalize<boost::geometry::segment_tag, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, false, boost::geometry::sections<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2>, 2, 10>' requested here
sectionalizer_type::apply(geometry, sections, ring_id);
^
/opt/local/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp:453:9: note: in instantiation of function template specialization 'boost::geometry::sectionalize<false, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::sections<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2> >' requested here
geometry::sectionalize<Reverse1>(geometry1, sec1, 0);
^
/opt/local/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp:877:18: note: in instantiation of member function 'boost::geometry::detail::get_turns::get_turns_generic<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, false, false, std::__1::deque<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> >, std::__1::allocator<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> > > >, boost::geometry::detail::overlay::get_turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> >, boost::geometry::detail::disjoint::assign_disjoint_policy>, boost::geometry::detail::disjoint::disjoint_interrupt_policy>::apply' requested here
>::type::apply(
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:118:9: note: in instantiation of function template specialization 'boost::geometry::get_turns<false, false, boost::geometry::detail::disjoint::assign_disjoint_policy, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, std::__1::deque<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> >, std::__1::allocator<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> > > >, boost::geometry::detail::disjoint::disjoint_interrupt_policy>' requested here
geometry::get_turns
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:159:54: note: in instantiation of member function 'boost::geometry::detail::disjoint::disjoint_linear<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator> >::apply' requested here
if (! disjoint_linear<Geometry1, Geometry2>::apply(geometry1, geometry2))
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:261:16: note: in instantiation of member function 'boost::geometry::detail::disjoint::general_areal<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator> >::apply' requested here
>::apply(g2, g1);
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:344:54: note: in instantiation of member function 'boost::geometry::dispatch::disjoint<boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2, boost::geometry::ring_tag, boost::geometry::segment_tag, true>::apply' requested here
return dispatch::disjoint<Geometry1, Geometry2>::apply(geometry1, geometry2);
^
/opt/local/include/boost/geometry/algorithms/intersects.hpp:99:14: note: in instantiation of function template specialization 'boost::geometry::disjoint<boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >' requested here
return ! geometry::disjoint(geometry1, geometry2);
^
main.cpp:49:52: note: in instantiation of function template specialization 'boost::geometry::intersects<boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >' requested here
std::cout << "Polygon and segment intersect " << bg::intersects(poly1,s1) << std::endl;
^
/opt/local/include/boost/mpl/assert.hpp:82:5: note: candidate function [with C = false] not viable: no known conversion from 'boost::mpl::failed ************(boost::geometry::dispatch::sectionalize<boost::geometry::segment_tag, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, false, boost::geometry::sections<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2>, 2, 10>::NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE::************)(types<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >)' to 'typename assert<false>::type' (aka 'mpl_::assert<false>') for 1st argument
int assertion_failed( typename assert<C>::type );
^
In file included from main.cpp:8:
In file included from /opt/local/include/boost/geometry/algorithms/correct.hpp:36:
In file included from /opt/local/include/boost/geometry/algorithms/disjoint.hpp:33:
In file included from /opt/local/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp:35:
/opt/local/include/boost/geometry/views/detail/range_type.hpp:39:5: error: no matching function for call to 'assertion_failed'
BOOST_MPL_ASSERT_MSG
^~~~~~~~~~~~~~~~~~~~
/opt/local/include/boost/mpl/assert.hpp:434:48: note: expanded from macro 'BOOST_MPL_ASSERT_MSG'
#define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
^
/opt/local/include/boost/mpl/assert.hpp:428:9: note: expanded from macro '\
BOOST_MPL_ASSERT_MSG_IMPL'
boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/boost/mpl/assert.hpp:59:58: note: expanded from macro '\
BOOST_MPL_AUX_ASSERT_CONSTANT'
#   define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
^
/opt/local/include/boost/geometry/views/detail/range_type.hpp:94:32: note: in instantiation of template class 'boost::geometry::dispatch::range_type<boost::geometry::segment_tag, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >' requested here
typedef typename dispatch::range_type
^
/opt/local/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp:104:22: note: in instantiation of template class 'boost::geometry::detail::range_type<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >' requested here
typename range_type<Geometry1>::type const,
^
/opt/local/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp:408:20: note: in instantiation of template class 'boost::geometry::detail::get_turns::get_turns_in_sections<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, false, false, boost::geometry::section<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2>, boost::geometry::section<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2>, std::__1::deque<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> >, std::__1::allocator<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> > > >, boost::geometry::detail::overlay::get_turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> >, boost::geometry::detail::disjoint::assign_disjoint_policy>, boost::geometry::detail::disjoint::disjoint_interrupt_policy>' requested here
return get_turns_in_sections
^
/opt/local/include/boost/geometry/algorithms/detail/partition.hpp:415:29: note: in instantiation of function template specialization 'boost::geometry::detail::get_turns::section_visitor<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, false, false, std::__1::deque<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> >, std::__1::allocator<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> > > >, boost::geometry::detail::overlay::get_turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> >, boost::geometry::detail::disjoint::assign_disjoint_policy>, boost::geometry::detail::disjoint::disjoint_interrupt_policy>::apply<boost::geometry::section<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2> >' requested here
visitor.apply(*it1, *it2);
^
/opt/local/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp:464:9: note: in instantiation of function template specialization 'boost::geometry::partition<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::detail::get_turns::get_section_box, boost::geometry::detail::get_turns::ovelaps_section_box, boost::geometry::visit_no_policy>::apply<boost::geometry::sections<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2>, boost::geometry::detail::get_turns::section_visitor<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, false, false, std::__1::deque<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> >, std::__1::allocator<boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> > > >, boost::geometry::detail::overlay::get_turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_info<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, boost::geometry::detail::overlay::turn_operation, boost::array<boost::geometry::detail::overlay::turn_operation, 2> >, boost::geometry::detail::disjoint::assign_disjoint_policy>, boost::geometry::detail::disjoint::disjoint_interrupt_policy> >' requested here
geometry::partition
^
/opt/local/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp:877:18: note: (skipping 2 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
>::type::apply(
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:159:54: note: in instantiation of member function 'boost::geometry::detail::disjoint::disjoint_linear<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator> >::apply' requested here
if (! disjoint_linear<Geometry1, Geometry2>::apply(geometry1, geometry2))
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:261:16: note: in instantiation of member function 'boost::geometry::detail::disjoint::general_areal<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator> >::apply' requested here
>::apply(g2, g1);
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:344:54: note: in instantiation of member function 'boost::geometry::dispatch::disjoint<boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2, boost::geometry::ring_tag, boost::geometry::segment_tag, true>::apply' requested here
return dispatch::disjoint<Geometry1, Geometry2>::apply(geometry1, geometry2);
^
/opt/local/include/boost/geometry/algorithms/intersects.hpp:99:14: note: in instantiation of function template specialization 'boost::geometry::disjoint<boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >' requested here
return ! geometry::disjoint(geometry1, geometry2);
^
main.cpp:49:52: note: in instantiation of function template specialization 'boost::geometry::intersects<boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >' requested here
std::cout << "Polygon and segment intersect " << bg::intersects(poly1,s1) << std::endl;
^
/opt/local/include/boost/mpl/assert.hpp:82:5: note: candidate function [with C = false] not viable: no known conversion from 'boost::mpl::failed ************(boost::geometry::dispatch::range_type<boost::geometry::segment_tag, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >::NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE::************)(types<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >)' to 'typename assert<false>::type' (aka 'mpl_::assert<false>') for 1st argument
int assertion_failed( typename assert<C>::type );
^
In file included from main.cpp:8:
In file included from /opt/local/include/boost/geometry/algorithms/correct.hpp:23:
In file included from /opt/local/include/boost/range.hpp:26:
In file included from /opt/local/include/boost/range/functions.hpp:18:
In file included from /opt/local/include/boost/range/begin.hpp:24:
In file included from /opt/local/include/boost/range/iterator.hpp:23:
/opt/local/include/boost/mpl/eval_if.hpp:60:26: error: no type named 'type' in 'boost::range_const_iterator<int>'
typedef typename f_::type type;
~~~~~~~~~~~~~^~~~
/opt/local/include/boost/range/iterator.hpp:61:18: note: in instantiation of template class 'boost::mpl::eval_if_c<true, boost::range_const_iterator<int>, boost::range_mutable_iterator<const int> >' requested here
mpl::eval_if_c< is_const<C>::value,
^
/opt/local/include/boost/geometry/views/identity_view.hpp:38:29: note: in instantiation of template class 'boost::range_iterator<const int>' requested here
typedef typename boost::range_iterator<Range const>::type const_iterator;
^
/opt/local/include/boost/range/const_iterator.hpp:36:9: note: in instantiation of template class 'boost::geometry::identity_view<const int>' requested here
BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( const_iterator )
^
/opt/local/include/boost/range/detail/extract_optional_type.hpp:45:82: note: expanded from macro 'BOOST_RANGE_EXTRACT_OPTIONAL_TYPE'
, BOOST_DEDUCED_TYPENAME boost::range_detail::exists< BOOST_DEDUCED_TYPENAME C::a_typedef >::type \
^
/opt/local/include/boost/range/const_iterator.hpp:36:9: note: during template argument deduction for class template partial specialization 'extract_const_iterator<type-parameter-0-0, typename exists<typename type-parameter-0-0::const_iterator>::type>' [with C = boost::geometry::identity_view<const int>]
BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( const_iterator )
^
/opt/local/include/boost/range/detail/extract_optional_type.hpp:44:12: note: expanded from macro 'BOOST_RANGE_EXTRACT_OPTIONAL_TYPE'
struct extract_ ## a_typedef< C                                            \
^
<scratch space>:16:1: note: expanded from here
extract_const_iterator
^
/opt/local/include/boost/mpl/eval_if.hpp:60:22: note: in instantiation of template class 'boost::range_const_iterator<boost::geometry::identity_view<const int> >' requested here
typedef typename f_::type type;
^
/opt/local/include/boost/range/iterator.hpp:61:18: note: (skipping 7 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
mpl::eval_if_c< is_const<C>::value,
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:159:54: note: in instantiation of member function 'boost::geometry::detail::disjoint::disjoint_linear<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator> >::apply' requested here
if (! disjoint_linear<Geometry1, Geometry2>::apply(geometry1, geometry2))
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:261:16: note: in instantiation of member function 'boost::geometry::detail::disjoint::general_areal<boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator> >::apply' requested here
>::apply(g2, g1);
^
/opt/local/include/boost/geometry/algorithms/disjoint.hpp:344:54: note: in instantiation of member function 'boost::geometry::dispatch::disjoint<boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, 2, boost::geometry::ring_tag, boost::geometry::segment_tag, true>::apply' requested here
return dispatch::disjoint<Geometry1, Geometry2>::apply(geometry1, geometry2);
^
/opt/local/include/boost/geometry/algorithms/intersects.hpp:99:14: note: in instantiation of function template specialization 'boost::geometry::disjoint<boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >' requested here
return ! geometry::disjoint(geometry1, geometry2);
^
main.cpp:49:52: note: in instantiation of function template specialization 'boost::geometry::intersects<boost::geometry::model::ring<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>, true, true, std::vector, std::allocator>, boost::geometry::model::segment<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> > >' requested here
std::cout << "Polygon and segment intersect " << bg::intersects(poly1,s1) << std::endl;
^
In file included from main.cpp:8:
In file included from /opt/local/include/boost/geometry/algorithms/correct.hpp:23:
In file included from /opt/local/include/boost/range.hpp:26:
In file included from /opt/local/include/boost/range/functions.hpp:18:
In file included from /opt/local/include/boost/range/begin.hpp:24:
In file included from /opt/local/include/boost/range/iterator.hpp:23:
/opt/local/include/boost/mpl/eval_if.hpp:60:26: error: no type named 'type' in 'boost::range_const_iterator<boost::geometry::identity_view<const int> >'
typedef typename f_::type type;
~~~~~~~~~~~~~^~~~
/opt/local/include/boost/range/iterator.hpp:61:18: note: in instantiation of template class 'boost::mpl::eval_if_c<true, boost::range_const_iterator<boost::geometry::identity_view<const int> >, boost::range_mutable_iterator<const boost::geometry::identity_view<const int> > >' requested here
mpl::eval_if_c< is_const<C>::value,
^
/opt/local/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp:124:29: note: in instantiation of template class 'boost::range_iterator<const boost::geometry::identity_view<const int> >' requested here
typedef typename boost::range_iterator
^
...

8 errors generated.
make[2]: *** [build/Debug/GNU-MacOSX/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

Это ошибка или я что-то забыл?

2

Решение

Кажется, ваша мысль, что «возможно, они не реализовали это для всех возможных пар», действительно является проблемой. boost::geometry::intersects звонки boost::geometry::disjoint под капотом, и действительно есть шаблонные специализации для тестирования, не связанные с различными типами моделей, в том числе Segment + Box а также Linestring + Box, но, кажется, не один для Segment + Ring (хотя есть и один для Linestring + Segmentи хотя шаблоны немного сложны для прохождения, представляется, что это шаблон-посредник, который переключит порядок параметров типа вокруг, чтобы соответствовать, что означает, что если у вас возникла проблема с этими двумя, может быть более глубокая проблема ).

1

Другие решения

Этот вопрос немного стар, но другой ответ не был отличным. Мое решение состоит в том, чтобы преобразовать их обе в строковые строки и затем выяснить, пересекаются ли они (если вы подумаете об этом, результат должен быть одинаковым, но он не будет работать для пересечения)

#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/intersects.hpp>
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/io/wkt/read.hpp>
#include <iostream>

namespace bg = boost::geometry;

int main(int argc, char** argv) {
typedef bg::model::point<double, 2, bg::cs::cartesian> Point;
typedef bg::model::linestring<Point> linestring;
bg::model::ring<Point> poly1, poly2;
bg::model::segment<Point> s1, s2;

bg::read_wkt("POLYGON((0.0 0.0, 1.0 1.0, 0.0 2.0, 2.0 1.0))", poly1);
bg::correct(poly1);

bg::read_wkt("POLYGON((1.5 0.0, 1.5 2.0, 3.0 1.0))", poly2);
bg::correct(poly2);

bg::read_wkt("SEGMENT(0.0 0.0,0.0 2.0)", s1);
bg::read_wkt("SEGMENT(-1.0 1.0,2.0 1.0)", s2);

std::cout << "Polygons intersect " << bg::intersects(poly1, poly2) << std::endl;
std::cout << "Segments intersect " << bg::intersects(s1, s2) << std::endl;
std::vector<Point> v{s1.first,s1.second};
std::cout << "Polygon and segment intersect " << bg::intersects(linestring(poly1.begin(),poly1.end()), linestring(v.begin(),v.end())) << std::endl;

return 0;
}
2

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector