For example consider this code:
    
    
    ++
    // 
https://doc.cgal.org/latest/Triangulation_2/index.html#Section_2D_Triangulations_Constrained_Delaunay
    
    #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
    #include <CGAL/Constrained_Delaunay_triangulation_2.h>
    #include <cassert>
    #include <iostream>
    typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
    typedef CGAL::Exact_predicates_tag                               Itag;
    typedef CGAL::Constrained_Delaunay_triangulation_2<K, CGAL::Default, Itag> 
CDT;
    typedef CDT::Point          Point;
    int
    main( )
    {
      CDT cdt;
      std::cout << "Inserting a grid of 5x5 constraints " << std::endl;
      for (int i = 1; i < 6; ++i)
        cdt.insert_constraint( Point(0,i), Point(6,i));
      for (int j = 1; j < 6; ++j)
        cdt.insert_constraint( Point(j,0), Point(j,6));
      assert(cdt.is_valid());
      int count = 0;
      for (CDT::Finite_edges_iterator eit = cdt.finite_edges_begin();
           eit != cdt.finite_edges_end();
           ++eit)
        if (cdt.is_constrained(*eit)) ++count;
      std::cout << "The number of resulting constrained edges is  ";
      std::cout <<  count << std::endl;
      return 0;
    }
    
    

I can compile this with
    
    
    cgal_create_CMakeLists -s executable
    cmake -DCGAL_DIR=/usr/lib64/cmake .
    make
    

or with a plain 
    
    
    g++ -lCGAL -lgmp executable.cpp
    
    

I have used CGAL and BOOST some years ago from Ruby, which was some work, but I 
can not remember details currently. I think for Nim the ordinary wrapper 
approach with c2nim makes not much sense because CGAL is using so many C++ 
templates. So I guess I have to use emit and/or importcpp and compile the whole 
project to C++? Or maybe wrap the C++ code in plain C functions before calling 
it from Nim? 

Reply via email to