gpt4 book ai didi

c++ - CGAL 仿射变换的语法错误

转载 作者:太空狗 更新时间:2023-10-29 23:50:28 25 4
gpt4 key购买 nike

我正在尝试使用 CGAL 库进行简单的 3D 转换,但显然我对语法感到困惑,因为无论我尝试什么,我都会遇到相同的编译时错误。这是一个最小的“非工作”示例:

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Vector_3.h>
#include <CGAL/Aff_transformation_3.h>
#include <CGAL/Aff_transformation_tags.h>

typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef Kernel::Vector_3 Vector_3;
typedef CGAL::Aff_transformation_3<Kernel> Aff_transformation_3;

int main(void)
{
Polyhedron P;
P.make_tetrahedron();

const Vector_3 transvec(-1,0,2);

Aff_transformation_3 transl(CGAL::Translation, transvec);
transform(P.points_begin(),P.points_end(),P.points_begin(),transl);
}

我尝试编译

g++ -O2 -frounding-math -I/usr/local/include -I/opt/local/include mwe.cc -Wl, -lCGAL -lCGAL_Core -lCGAL_ImageIO -lmpfr -lgmp -lm -o mwe

我总是收到这个错误:

mwe.cc:19:52: error: unknown type name 'transvec'
Aff_transformation_3 transl(CGAL::Translation, transvec);

最佳答案

CGAL::Translation 是一个类的名称——您需要 CGAL::TRANSLATION,这是该类实例的名称。

关于c++ - CGAL 仿射变换的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30039937/

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