Selaa lähdekoodia

Building a CGAL polyhedron via a float-type Eigen matrix.

The origin version only accepts Eigen::MatrixXd as vertices.
Wesley Ranger 6 vuotta sitten
vanhempi
commit
7c66185d74

+ 3 - 2
include/igl/copyleft/cgal/mesh_to_polyhedron.cpp

@@ -10,9 +10,9 @@
 #include <CGAL/Polyhedron_incremental_builder_3.h>
 #include <CGAL/Polyhedron_incremental_builder_3.h>
 
 
 
 
-template <typename Polyhedron>
+template <typename Polyhedron, typename DerivedV>
 IGL_INLINE bool igl::copyleft::cgal::mesh_to_polyhedron(
 IGL_INLINE bool igl::copyleft::cgal::mesh_to_polyhedron(
-  const Eigen::MatrixXd & V,
+  const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixXi & F,
   const Eigen::MatrixXi & F,
   Polyhedron & poly)
   Polyhedron & poly)
 {
 {
@@ -51,4 +51,5 @@ IGL_INLINE bool igl::copyleft::cgal::mesh_to_polyhedron(
 #include <CGAL/Simple_cartesian.h>
 #include <CGAL/Simple_cartesian.h>
 #include <CGAL/Polyhedron_items_with_id_3.h>
 #include <CGAL/Polyhedron_items_with_id_3.h>
 template bool igl::copyleft::cgal::mesh_to_polyhedron<CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> > >(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> >&);
 template bool igl::copyleft::cgal::mesh_to_polyhedron<CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> > >(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> >&);
+template bool igl::copyleft::cgal::mesh_to_polyhedron<CGAL::Polyhedron_3<CGAL::Simple_cartesian<float>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> > >(Eigen::Matrix<float, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, CGAL::Polyhedron_3<CGAL::Simple_cartesian<float>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> >&);
 #endif
 #endif

+ 2 - 2
include/igl/copyleft/cgal/mesh_to_polyhedron.h

@@ -27,9 +27,9 @@ namespace igl
       //   poly  cgal polyhedron
       //   poly  cgal polyhedron
       // Returns true only if (V,F) can be converted to a valid polyhedron (i.e. if
       // Returns true only if (V,F) can be converted to a valid polyhedron (i.e. if
       // (V,F) is vertex and edge manifold).
       // (V,F) is vertex and edge manifold).
-      template <typename Polyhedron>
+      template <typename Polyhedron, typename DerivedV>
       IGL_INLINE bool mesh_to_polyhedron(
       IGL_INLINE bool mesh_to_polyhedron(
-        const Eigen::MatrixXd & V,
+        const Eigen::MatrixBase<DerivedV> & V,
         const Eigen::MatrixXi & F,
         const Eigen::MatrixXi & F,
         Polyhedron & poly);
         Polyhedron & poly);
     }
     }