gpt4 book ai didi

c++ - 试图访问 CGAL 多面体顶点

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:25:42 25 4
gpt4 key购买 nike

我希望访问 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

系统说我要加一些评论,所以这里是一些无意义的评论

最佳答案

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

关于c++ - 试图访问 CGAL 多面体顶点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19621188/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com