0

我正在尝试在多边形中找到交叉点。具体来说,我对共线交叉点感兴趣,其中两个线段彼此重叠并在所有公共部分相交。我认为这与政策有关,但不确定如何定义正确的政策。将不胜感激任何帮助。

namespace bgi = boost::geometry::index;
  namespace bg = boost::geometry;
  using namespace std;
  typedef bg::model::d2::point_xy<double> point_2d;
  typedef bg::model::polygon<boost::geometry::model::d2::point_xy<double> > Polygon;
  Polygon poly;
  poly.outer().push_back(point_2d(0, 10));
  poly.outer().push_back(point_2d(5, 10));
  poly.outer().push_back(point_2d(5, 5));
  poly.outer().push_back(point_2d(2.5, 15));
  poly.outer().push_back(point_2d(0, 5));
  poly.outer().push_back(point_2d(0, 10));
  poly.outer().push_back(point_2d(0, 20));
  poly.outer().push_back(point_2d(0, 10));



  typedef bg::point_type<Polygon>::type point_type;
  typedef bg::detail::overlay::traversal_turn_info
   <point_type,typename bg::segment_ratio_type<point_type, bg::detail::no_rescale_policy>::type> turn_info;

  bg::detail::self_get_turn_points::no_interrupt_policy noInteruptPolicy;
  bg::detail::no_rescale_policy robust_policy;
  std::vector<turn_info> turns;
  bg::self_turns<bg::detail::overlay::assign_null_policy>(
    poly, robust_policy, turns, noInteruptPolicy);
4

0 回答 0