0
我是boost::geometry
的新用戶。我嘗試使用for_each_point訪問boost::segment
中的點,但它不起作用。我也嘗試使用segment_view
來訪問它,但點的輸出很奇怪。
是否有任何機制可以遍歷boost:: segment
中的每個點?問:如何訪問boost :: segment中點的座標?
namespace bg = boost::geometry;
typedef bg::model::d2::point_xy<int> CleanPoint;
typedef boost::geometry::model::segment<CleanPoint> CleanSegment;
typedef boost::geometry::segment_view<CleanSegment> CleanSegmentView;
BOOST_FOREACH(CleanSegment seg, frontier_cells_){
CleanSegmentView view(seg);
//Iterating over the points of this segment
for (boost::range_iterator<CleanSegmentView const>::type it = boost::begin(view);
it != boost::end(view); ++it)
{
std::cout << " Point = " << boost::geometry::dsv(*it)<<'\n';
}
}