Subject: CGAL users discussion list
List archive
- From: weihy1984 <>
- To: cgal-discuss <>
- Subject: [cgal-discuss] how to write the surface triangle mesh data into a txt file?
- Date: Thu, 14 May 2009 12:12:21 +0800 (CST)
Hello, Dear Sir,
I'm a newbee of CGAL. I use CGAL to compute a trianglular mesh approximation a sphere surface. The code like following:
typedef CGAL::Surface_mesh_default_triangulation_3 Tr;
typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3;
typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3;
...
Tr tr; // 3D-Delaunay triangulation
C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation
// defining the surface
Surface_3 surface(sphere_function, // pointer to function
Sphere_3(CGAL::ORIGIN, 2.)); // bounding sphere
C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation
// defining the surface
Surface_3 surface(sphere_function, // pointer to function
Sphere_3(CGAL::ORIGIN, 2.)); // bounding sphere
// defining meshing criteria
CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30., // angular bound
0.1, // radius bound
0.1); // distance bound
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());
CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30., // angular bound
0.1, // radius bound
0.1); // distance bound
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());
And I want to write the triangle data into a txt file with the format like following:
869 1245 # 869-the number of vertexs, 1245-the number of triangles
-0.506148 0.516938 0.691199 # the coordiantes of the vertexs for 1 to 869
-0.159281 0.795975 -0.584997
-0.734812 -0.219062 -0.642831
-0.506148 0.516938 0.691199 # the coordiantes of the vertexs for 1 to 869
-0.159281 0.795975 -0.584997
-0.734812 -0.219062 -0.642831
....
0.407604 -0.658104 -0.633976
376 599 378 # the three vertexes indexes of a triangle.
....
28 301 112
28 301 112
what should I about it? I can get useful information from the CGAL manual, please help me. Thanks very much.
Best wishes
Huayi Wei
穿越地震带 纪念汶川地震一周年
- [cgal-discuss] how to write the surface triangle mesh data into a txt file?, weihy1984, 05/14/2009
Archive powered by MHonArc 2.6.16.