#include "triangulate.h" #include "assign_scalar.h" #include "../../list_to_matrix.h" #include #include #include #include #include #include template < typename Kernel, typename DerivedV, typename DerivedE, typename DerivedH, typename DerivedV2, typename DerivedF2> IGL_INLINE void igl::copyleft::cgal::triangulate( const Eigen::MatrixBase & V, const Eigen::MatrixBase & E, const Eigen::MatrixBase & H, const bool retain_convex_hull, Eigen::PlainObjectBase & TV, Eigen::PlainObjectBase & TF) { struct FaceInfo2 { FaceInfo2(){} bool visited = false; bool in_domain = true; }; typedef Eigen::Index Index; //typedef CGAL::Epeck Kernel; typedef CGAL::Point_2 Point_2; typedef CGAL::Triangulation_vertex_base_2 TVB_2; typedef CGAL::Triangulation_face_base_with_info_2 TFB_2; typedef CGAL::Constrained_triangulation_face_base_2 CTFB_2; typedef CGAL::Triangulation_data_structure_2 TDS_2; typedef CGAL::Exact_intersections_tag Itag; typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; typedef CGAL::Constrained_triangulation_plus_2 CDT_plus_2; typedef typename CDT_plus_2::Face_handle Face_handle; CDT_plus_2 cdt; // Insert all points std::vector points;points.reserve(V.rows()); for(Eigen::Index i = 0;i queue; queue.push(start); while(!queue.empty()) { Face_handle fh = queue.front(); queue.pop(); if(!fh->info().visited) { fh->info().visited = true; fh->info().in_domain = false; for(int i = 0; i < 3; i++) { typename CDT_plus_2::Edge e(fh,i); Face_handle n = fh->neighbor(i); if(!n->info().visited && !cdt.is_constrained(e)) { queue.push(n); } } } } }; // If _not_ meshsing convex hull, remove anything connected to infinite face if(!retain_convex_hull) { remove_cc(cdt.infinite_face()); } // remove holes for(Eigen::Index h = 0;h > vertices; std::vector > faces; // Read off vertices of the cdt, remembering index std::map v2i; size_t count=0; for ( auto itr = cdt.finite_vertices_begin(); itr != cdt.finite_vertices_end(); itr++) { vertices.push_back(itr->point()); v2i[itr] = count; count++; } // Read off faces and store index triples for ( auto itr = cdt.finite_faces_begin(); itr != cdt.finite_faces_end(); itr++) { if(itr->info().in_domain) { faces.push_back( { v2i[itr->vertex(0)], v2i[itr->vertex(1)], v2i[itr->vertex(2)] }); } } TV.resize(vertices.size(),2); for(int v = 0;v, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::triangulate, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif