2013-10-27 7 views
1

CGAL 다면체 버텍스의 x, y, z 값에 액세스하려고합니다.CGAL 다면체 버텍스에 액세스하려고 시도합니다.

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; 
:

내가 찾은 가장 가까운 코드는이 시스템은 좀 더 설명을 추가 할 필요가 말한다이

// 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 

, 그래서 여기에 당신이 이러한 유형을 시도 할 수있는 몇 가지 의미가 의견

+0

''는 (는) CGAL의 헤더가 아닙니다. 복사 한 코드를 어디에서 찾았습니까? – lrineau

답변

0

입니다
1

인터넷에서 시도한 버전이 오래되었다고 생각하십시오. 예제 디렉토리에서 매우 비슷하지만 다른 코드를 발견했으며이 코드는 정상적으로 작동했습니다.

+0

자기 대답 옆에있는 틱을 클릭하여 대답을 수락하면 질문을 "대답"으로 분류 할 수 있습니다. – lrineau

관련 문제