- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在尝试使用 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
这是错误还是我忘记了什么?
最佳答案
这个问题有点老,但另一个答案不是很好。我的解决方案是将它们都转换成线串,然后找出它们是否相交(如果你考虑一下结果应该是相同的,但它不适用于相交)
#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;
}
关于c++ - boost::geometry::intersects 不适用于不同的几何类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21408977/
我有四个返回整数的查询。 select listOfIntegers from [something]... (编辑结果为 ROWS) 需要一种方法来做 select ... intersect se
我尝试过 Area.intersect(),并且想知道是否有一种方法可以使用 Path2D 创建与此类似的方法,因为我注意到使用 Path2D 作为形状时性能有所提升。换句话说,获取大 Path2D
我在使用 MARIADB 语言进行此查询时遇到问题。此查询不返回任何内容,但此查询应返回一行。我该怎么做才能让它发挥作用? `SELECT c.Raza, c.Nombre FROM caballos
为什么在 Groovy 中,当我创建 2 个列表时,如果我执行 a.intersect(b) 和 b.intersect(a) 会有区别: def list1 = ["hello", "world",
我需要在 MS Access 中交叉多个子查询。遗憾的是,Access-SQL 不支持 INTERSECT 关键字。我明白,我们如何使用两个表的 INNER JOIN 来获得我们想要的交集。但是我怎样
I have 5 equations and I've to take combination of 3 equations at a time to check if I'm getting
使用基本运算符,导出额外的运算符交集。 R ∩ S = ? 我认为可能是:(R ∪ S) - ((R -S) ∪ (S -R)) 但我也认为可能有更简单的方法吗? 最佳答案 A 与 B 相交等于 A
我有一个向量 A 定义为:(Ao+t∗Ad) 我还有一个圆锥体,其顶点(圆锥尖)V、轴方向D、底半径R 和高度H . 如何找到矢量和圆锥体之间的交点?我正在使用 glm 进行数学运算。 这是一个简单的
我正在寻找合适的加速结构来进行射线球相交测试(在游戏中)。适用以下条件: - 每帧大约有 100 个球体和 100 条光线可以相互测试 - 球体在每一帧中移动,光线也是如此 - 可以在每一帧中添加/删
我有两个代理集。是否有查找功能: 两个(相交)中都存在的代理的代理集 一个而不是另一个中存在的代理的代理集 我发现手动执行此操作非常困难,尤其是在三重ask内部需要它时 理想的用法类似于with语法:
如何测试交叉射线和三角形,如果存在如何获得从射线原点到交点的距离?如果在我的程序中我必须检查 1 条射线到 ~10000 个三角形,我可以使用什么优化?? 最佳答案 单个多边形射线相交测试很简单,只涉
我们如何使用交集方法组合两个 dfa? 最佳答案 使用叉积结构,正式解释here . 本质上,您将每个状态中的状态集交叉乘积,以获得与每台机器的任意状态组合相对应的元状态列表。如果两者都接受,这允许您
我的问题是关于 python pandas 的。我有两个系列,每个系列都有如下字符串元素:为了简化,我在 DataFrame 中连接了两个系列。 import pandas as pd import
我有两个表:P 和 PC(主要/详细信息由列 Id 连接) Table P: Id integer Name varchar(12) Table PC: Id integer Code varch
我正在使用Intersection Observer API,我想知道: 如何消除或限制Intersection Observer API? 如果我想提高性能,是否建议使用防抖或 throttle 功
可能真正的问题是“是否有人关心”,但这是不一致的地方: intersect(c(),1:3) integer(0) intersect(1:3,c()) NULL 同样的事情发生在 setdiff 上
我正在从事一个涉及 Neo4J Db 的项目,但我遇到了一个我自己无法解决的问题。 我们正在处理图中的 Acl。每个 Acl 都链接到一组元数据。项目也链接到这些元数据。当链接到项目的所有元数据也链接
我正在尝试在具有一个障碍物(暂时)的昆虫(蟑螂)社会中实现一种碰撞检测算法(极限环方法),为此障碍物(红色)被一圈包围影响(绿色),在这里,一旦检测到“roach”和“影响圈”之间的交叉点,我将计算每
我正在做题 Find all students who do not appear in the Likes table (as a student who likes or is liked) an
我有两个结果,希望得到这两个结果的最佳“顺序”。示例: 我们有一场比赛,一场比赛有 5 人,另一场比赛有 7 人。结果是:比赛 1. 1. Karl 2. Fred 3. John 4. Peter
我是一名优秀的程序员,十分优秀!