【问题标题】:Trying to access CGAL Polyhedron vertex尝试访问 CGAL 多面体顶点
【发布时间】:2013-10-27 17:38:55
【问题描述】:

我希望访问 CGAL 多面体顶点的 x,y,z 值。

我找到的最近的代码是这个

// polyhedron_prog_tetra.C
// -----------------------------------------------------------
#include <CGAL/Cartesian.h>
#include <iostream>
#include <CGAL/Halfedge_data_structure_polyhedron_default_3.h>
#include <CGAL/Polyhedron_default_traits_3.h>
#include <CGAL/Polyhedron_3.h>

typedef CGAL::Cartesian<double>                               R;
typedef CGAL::Halfedge_data_structure_polyhedron_default_3<R> HDS;
typedef CGAL::Polyhedron_default_traits_3<R>                  Traits;
typedef CGAL::Polyhedron_3<Traits,HDS>                        Polyhedron;
typedef Polyhedron::Point                                     Point;
typedef Polyhedron::Vertex_iterator                           Vertex_iterator;

int main() {
    Point p( 1.0, 0.0, 0.0);
    Point q( 0.0, 1.0, 0.0);
    Point r( 0.0, 0.0, 1.0);
    Point s( 0.0, 0.0, 0.0);

 Polyhedron P;
 P.make_tetrahedron( p, q, r, s);
 CGAL::set_ascii_mode( std::cout);
 Vertex_iterator begin = P.vertices_begin();
 for ( ; begin != P.vertices_end(); ++begin)
     std::cout << "(" << begin->point() << ") ";
    std::cout << std::endl;
 return 0;
 }

But when I try and compile I get a errors
/usr/lib/freecad/Mod/OpenSCAD/CGAL/CallCGAL.cpp:60: error: expected initializer before ‘<’ token
/usr/lib/freecad/Mod/OpenSCAD/CGAL/CallCGAL.cpp:61: error: expected initializer before ‘<’ token
/usr/lib/freecad/Mod/OpenSCAD/CGAL/CallCGAL.cpp:62: error: ‘Traits’ was not declared in this scope
/usr/lib/freecad/Mod/OpenSCAD/CGAL/CallCGAL.cpp:62: error: ‘HDS’ was not declared in this scope
/usr/lib/freecad/Mod/OpenSCAD/CGAL/CallCGAL.cpp:62: error: template argument 1 is invalid
/usr/lib/freecad/Mod/OpenSCAD/CGAL/CallCGAL.cpp:62: error: template argument 2 is invalid
/usr/lib/freecad/Mod/OpenSCAD/CGAL/CallCGAL.cpp:62: error: invalid type in declaration before ‘;’ token
/usr/lib/freecad/Mod/OpenSCAD/CGAL/CallCGAL.cpp:63: error: ‘Polyhedron’ is not a class type
/usr/lib/freecad/Mod/OpenSCAD/CGAL/CallCGAL.cpp:63: error: ‘Polyhedron’ is not a class type

这个系统说我要多加一些cmets,所以这里是一些无意义的cmets

【问题讨论】:

  • &lt;CGAL/Halfedge_data_structure_polyhedron_default_3.h&gt; 不是来自 CGAL 的标头。您在哪里找到复制粘贴的代码?

标签: c++ cgal


【解决方案1】:

认为我从互联网上尝试的版本已经过时了。在示例目录中发现了非常相似但不同的代码,这工作正常。

【讨论】:

  • 请点击您自我回答旁边的勾,接受您的回答,以便问题归类为“已回答”。
【解决方案2】:

你能试试这些类型吗:

typedef CGAL::Cartesian< double > Kernel;
typedef Kernel::Vector_3  Vector;
typedef Kernel::Point_3  Point;
typedef CGAL::Polyhedron_3< Kernel > Polyhedron;
typedef Polyhedron::Vertex  Vertex;
typedef Polyhedron::Vertex_iterator  Vertex_iterator;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多