CGAL仿射变换的语法错误

时间:2015-05-04 21:03:45

标签: c++ cgal

我正在尝试使用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);

1 个答案:

答案 0 :(得分:7)

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