Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Export mesh

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Export mesh


Chronological Thread 
  • From: Laurent Rineau <>
  • To:
  • Subject: Re: [cgal-discuss] Export mesh
  • Date: Wed, 22 Oct 2008 14:55:59 +0200

On Wednesday 22 October 2008 14:19:13

wrote:
> Hello!
>
> I'm a very new beginner in CGAL and I'm trying to visualize the generated
> mesh with a free software like Paraview. For doing that, I need to export
> the mesh generated by the command
>
> CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());
>
> I tried to directly write the content of c2t3 into a file but I can't
> visualize the result. According to that, I have the following question:
>
> I there a simple way for exporting meshes created by cgal in current
> formats like STL, PLY or OBJ for example? I couldn't find the answer in the
> manual, or perhaps I missed it.....
>
>
> Thank you very much in advance for your help......
>
> Yann

Yann, there is an undocumented piece of code that outputs the c2t3 to an OFF
file (can be viewed with Geomview, and maybe other software). Here it is:

#include <fstream>
#include <CGAL/IO/Complex_2_in_triangulation_3_file_writer.h>


// Output the 2D complex to an OFF file.
std::ofstream out("out.off");
CGAL::output_surface_facets_to_off (out, c2t3);

If you want to output the mesh to another file format, you will need to write
a similar piece of code. The function output_surface_facets_to_off is defined
in <CGAL/IO/Complex_2_in_triangulation_3_file_writer.h>.

Be warned that the surface mesh is not oriented. If your 3D viewer take the
orientation of facets into account, you will see glitches, unless you use a
propagating algorithm to orient the mesh yourself.

--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/



Archive powered by MHonArc 2.6.16.

Top of Page