Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] CGAL-Bindings (Python): Mesh_3 examples

Subject: CGAL users discussion list

List archive

[cgal-discuss] CGAL-Bindings (Python): Mesh_3 examples


Chronological Thread 
  • From: Joaquin Correa <>
  • To: cgal-discuss <>
  • Subject: [cgal-discuss] CGAL-Bindings (Python): Mesh_3 examples
  • Date: Thu, 21 May 2015 02:21:52 -0700

Hi folks, is there a cgal-python-bindings implementation for Mesh_3 examples, particularly http://doc.cgal.org/latest/Mesh_3/Mesh_3_2mesh_3D_image_8cpp-example.html? I've been trying to get started on it but it seems that not all classes are exposed via swig, Exact_predicates_inexact_constructions_kernel and Mesh_Domain have to be defined but are not part of the CGAL.CGAL_Mesh_3 module. Thank you.

mesh_3D_image.cpp:

    #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>        
    #include <CGAL/Mesh_triangulation_3.h>
    #include <CGAL/Mesh_complex_3_in_triangulation_3.h>
    #include <CGAL/Mesh_criteria_3.h>

    #include <CGAL/Labeled_image_mesh_domain_3.h>
    #include <CGAL/make_mesh_3.h>
    #include <CGAL/Image_3.h>

    // Domain
    typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
    typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;

    // Triangulation
    #ifdef CGAL_CONCURRENT_MESH_3
      typedef CGAL::Mesh_triangulation_3<
        Mesh_domain,
        CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
        CGAL::Parallel_tag                        // Tag to activate parallelism
      >::type Tr;
    #else
      typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
    #endif
    typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;

    // Criteria
    typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;

    // To avoid verbose function and named parameters call
    using namespace CGAL::parameters;

    int main()
    {
      // Loads image
      CGAL::Image_3 image;
      image.read("data/liver.inr.gz");

      // Domain
      Mesh_domain domain(image);

      // Mesh criteria
      Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=4,
                             cell_radius_edge_ratio=3, cell_size=8);

      // Meshing
      C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);

      // Output
      std::ofstream medit_file("out.mesh");
      c3t3.output_to_medit(medit_file);

      return 0;
    }




Archive powered by MHonArc 2.6.18.

Top of Page