尝试访问 CGAL 多面体顶点
Trying to access CGAL Polyhedron vertex
我希望访问 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
这个系统说我必须添加更多评论,所以这里有一些毫无意义的评论
认为我从互联网上尝试的版本已经过时了。在示例目录中发现了非常相似但不同的代码,这工作正常。
你能试试这些类型吗:
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;
相关文章:
- 如何循环打印顶点结构
- D3D11-将混合权重和索引传递到顶点着色器
- 从返回的顶点缓冲区查询顶点结构
- Vulkan 中的动态顶点缓冲区格式设置
- 在顶点着色器中使用 OpenGl 的未声明标识符,我在顶点着色器中绘制三角形时遇到问题
- 如何将一半传递给顶点着色器?
- 在 DirectX 11 中从 GPU 读回顶点缓冲区(并获取顶点)
- QT QOpenGLWidget:如何在不使用数据块复制的情况下修改VBO中的单个顶点值?
- 使用 OpenGL 4.5 更改所选顶点的颜色
- Direct3D 11 - HLSL - 获取顶点索引 ID
- 创建异构顶点数据数组的可移植方法
- 使用 glvertex4i 传递网格面索引时的顶点着色器错误
- 无法从 cso 文件创建顶点着色器(从 fx 文件创建)
- OpenGL 相机移动程序顶点着色器问题
- 使用 std::list 存储顶点并使用 SFML 绘制它们
- 为什么顶点数组对象会导致错误?
- 从 CGAL 3D 网格生成中获取顶点坐标的 -6.27744e+66:mesh_implicit_sphere示例
- 从拉伸多边形构建多面体
- 将顶点位置从顶点传递到片段着色器 - 仅在使用 Nsight 进行调试时有效
- 尝试访问 CGAL 多面体顶点