Browse Source

templates

Former-commit-id: 3aa4208a0465d9c8b73d43dcf08d462c5304ace2
Alec Jacobson 8 years ago
parent
commit
eaad1457d4

+ 9 - 4
include/igl/copyleft/cgal/polyhedron_to_mesh.cpp

@@ -8,11 +8,14 @@
 #include "polyhedron_to_mesh.h"
 #include <CGAL/Polyhedron_3.h>
 
-template <typename Polyhedron>
+template <
+  typename Polyhedron,
+  typename DerivedV,
+  typename DerivedF>
 IGL_INLINE void igl::copyleft::cgal::polyhedron_to_mesh(
   const Polyhedron & poly,
-  Eigen::MatrixXd & V,
-  Eigen::MatrixXi & F)
+  Eigen::PlainObjectBase<DerivedV> & V,
+  Eigen::PlainObjectBase<DerivedF> & F)
 {
   using namespace std;
   V.resize(poly.size_of_vertices(),3);
@@ -59,6 +62,8 @@ IGL_INLINE void igl::copyleft::cgal::polyhedron_to_mesh(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 #include <CGAL/Simple_cartesian.h>
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
 #include <CGAL/Polyhedron_items_with_id_3.h>
-template void igl::copyleft::cgal::polyhedron_to_mesh<CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> > >(CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> > const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);
+template void igl::copyleft::cgal::polyhedron_to_mesh<CGAL::Polyhedron_3<CGAL::Epick, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::__1::allocator<int> >, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(CGAL::Polyhedron_3<CGAL::Epick, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::__1::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::copyleft::cgal::polyhedron_to_mesh<CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>,CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::__1::allocator<int> >, Eigen::Matrix<double, -1, -1, 0,-1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>,CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::__1::allocator<int> > const&,Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0,-1, -1> >&);
 #endif

+ 6 - 3
include/igl/copyleft/cgal/polyhedron_to_mesh.h

@@ -25,11 +25,14 @@ namespace igl
       // Outputs:
       //   V  #V by 3 list of vertex positions
       //   F  #F by 3 list of triangle indices
-      template <typename Polyhedron>
+      template <
+        typename Polyhedron,
+        typename DerivedV,
+        typename DerivedF>
       IGL_INLINE void polyhedron_to_mesh(
         const Polyhedron & poly,
-        Eigen::MatrixXd & V,
-        Eigen::MatrixXi & F);
+        Eigen::PlainObjectBase<DerivedV> & V,
+        Eigen::PlainObjectBase<DerivedF> & F);
     }
   }
 }