当前位置: 首页>>代码示例>>C++>>正文


C++ Polygon_2::vertices_circulator方法代码示例

本文整理汇总了C++中Polygon_2::vertices_circulator方法的典型用法代码示例。如果您正苦于以下问题:C++ Polygon_2::vertices_circulator方法的具体用法?C++ Polygon_2::vertices_circulator怎么用?C++ Polygon_2::vertices_circulator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Polygon_2的用法示例。


在下文中一共展示了Polygon_2::vertices_circulator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: remove_collinear

Polygon_2 remove_collinear(const Polygon_2& p, Number_type epsilon)
{
  static log4cplus::Logger logger = log4cplus::Logger::getInstance("polygon_utils.remove_collinear");

  LOG4CPLUS_TRACE(logger, pp(p));

  if (!p.is_simple()) {
    stringstream ss;
    ss << "Polygon is not simple in remove_collinear: " << pp(p);
    throw logic_error(ss.str());
  }

  Polygon_2::Vertex_circulator start = p.vertices_circulator();
  Polygon_2::Vertex_circulator c = start;
  Polygon_2::Vertex_circulator n = c;
  Polygon_2::Vertex_circulator prev = c;
  ++n;
  --prev;
  Polygon_2 newp;
  do
  {
    Triangle_2 t(*prev, *c, *n);
    Number_type a = abs(t.area());
    if (a > epsilon)
//     if (!CGAL::collinear(*prev, *c, *n))
      newp.push_back(*c);
    else
      LOG4CPLUS_TRACE(logger, "Removing collinearity at " << pp(*c) << " area = " << a);
    ++prev;
    ++c;
    ++n;
  } while (c != start);

  return newp;
}
开发者ID:SoumyajitG,项目名称:VolRoverN,代码行数:35,代码来源:polygon_utils.cpp

示例2: centre

static Point_2 centroid(const Polygon_2& poly)
{
  assert(poly.size() >= 3);

  Polygon_2::Vertex_circulator vcir = poly.vertices_circulator();
  Polygon_2::Vertex_circulator vend = vcir;
  Polygon_2::Vertex_circulator vnext = vcir; ++vnext;

  Vector_2 centre(0, 0);
  NT a(0), asum(0);
  do {
    a = (vcir->x() * vnext->y()) - (vnext->x() * vcir->y());
    centre = centre + a * ((*vcir - CGAL::ORIGIN) + (*vnext - CGAL::ORIGIN)); // slow...
    asum += a;
    vcir = vnext;
    ++vnext;
  } while(vcir != vend);
  centre = centre / (asum * 3);
  return CGAL::ORIGIN + centre;
}
开发者ID:gunyarakun,项目名称:nicotagmap,代码行数:20,代码来源:vorotree.cpp

示例3: is_strictly_convex

bool is_strictly_convex(const Polygon_2& polygon, 
			const boost::unordered_map<Point_3, boost::unordered_set<Segment_3_undirected> >& point2edges)
{
  Polygon_2::Vertex_circulator start = polygon.vertices_circulator();
  Polygon_2::Vertex_circulator c = start;
  Polygon_2::Vertex_circulator p = c;
  Polygon_2::Vertex_circulator n = c;
  --p;
  ++n;
  do
  {
    if (!CGAL::left_turn(*p, *c, *n) || 
	!is_legal(*p, *c, *n, point2edges))
      return false;

    ++p;
    ++c;
    ++n;
  } while (c != start);
  return true;
}
开发者ID:SoumyajitG,项目名称:VolRoverN,代码行数:21,代码来源:polygon_utils.cpp


注:本文中的Polygon_2::vertices_circulator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。