【问题标题】:CGAL: Identify convex hull facets when iterating over finite facetsCGAL:在迭代有限面时识别凸包面
【发布时间】:2020-12-16 08:46:57
【问题描述】:

我想知道在迭代 Delaunay 3D 三角剖分的有限面时是否有任何方法可以识别凸包中的面

【问题讨论】:

    标签: cgal


    【解决方案1】:

    在 CGAL 中,凸包上的面都入射到无限顶点。因此,您只需查看与刻面相对的两个顶点,并检查其中一个是否为无限顶点。

    【讨论】:

      【解决方案2】:

      这是一些示例代码,用于从所有有限面中识别凸包上的面。每个 facet 都是一个 cell-vertex 对,mirror_facet 函数提供了另一个 cell-vertex 对来标识相同的 facet。然后您可以检查任一单元格(或任一顶点)是否为无限大,以确定刻面是否在凸包上。

      #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
      #include <CGAL/Delaunay_triangulation_3.h>
      
      #include <fstream>
      
      typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
      
      typedef CGAL::Delaunay_triangulation_3<K>  Triangulation;
      typedef Triangulation::Point               Point;
      
      int main( )
      {
        // read some points from a file
        std::ifstream in("data/threed.cin");
        std::istream_iterator<Point> begin(in);
        std::istream_iterator<Point> end;
      
        // form the Delaunay triangulation of the points
        Triangulation T;
        T.insert(begin, end);
      
        // check each finite face to identify those on the convex hull    
        for (auto facet: T.finite_facets())
        {
          if (T.is_infinite(facet.first) ||
              T.is_infinite(T.mirror_facet(facet).first))
          {
            // this facet is on the convex hull
          }
          else
          {
            // this facet is not on the convex hull
          }
        }
      
        return 0;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-02-16
        • 2012-03-15
        • 2017-09-26
        • 1970-01-01
        • 2016-02-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多