boost::geometry::ever_circling_iterator的使用及测试程序
boost::geometry::ever_circling_iterator是boost几何库中的一个迭代器,用于绕过一个区域无限循环。它可以用于在多边形内部或周围迭代,而不必担心越界或停止迭代。
下面我们来看一个简单的测试程序,用于展示如何使用boost::geometry::ever_circling_iterator。
#include <iostream>
#include <vector>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
// 设置别名
using boost::geometry::model::d2::point_xy;
using boost::geometry::model::polygon;
int main()
{
// 创建一个多边形
polygon<point_xy<double>> poly;
boost::geometry::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0))", poly);
// 创建一个ever_circling_iterator对象
auto it = boost::geometry::ever_circling_it
本文介绍了boost几何库中的ever_circling_iterator,这是一个无限循环的迭代器,适用于多边形内部或周围的点迭代。通过一个简单的测试程序展示了如何创建并使用该迭代器,以及其在处理多边形边界问题上的优势。
订阅专栏 解锁全文
404

被折叠的 条评论
为什么被折叠?



