فهرست منبع

Merge remote-tracking branch 'upstream/master'

Former-commit-id: 2b231444a5e30a37b83fe0bfa92539f66fc7a737
Qingnan Zhou 9 سال پیش
والد
کامیت
d329a121d1
44فایلهای تغییر یافته به همراه709 افزوده شده و 523 حذف شده
  1. 70 38
      include/igl/copyleft/boolean/mesh_boolean.cpp
  2. 79 1
      include/igl/copyleft/boolean/mesh_boolean.h
  3. 1 1
      include/igl/copyleft/cgal/extract_cells.cpp
  4. 2 2
      include/igl/copyleft/cgal/mesh_to_cgal_triangle_list.cpp
  5. 1 1
      include/igl/copyleft/cgal/order_facets_around_edge.cpp
  6. 20 20
      include/igl/copyleft/cgal/order_facets_around_edges.h
  7. 0 3
      include/igl/copyleft/cgal/remesh_intersections.cpp
  8. 0 0
      include/igl/copyleft/tetgen/README
  9. 3 3
      include/igl/copyleft/tetgen/cdt.cpp
  10. 72 0
      include/igl/copyleft/tetgen/cdt.h
  11. 4 4
      include/igl/copyleft/tetgen/mesh_to_tetgenio.cpp
  12. 55 0
      include/igl/copyleft/tetgen/mesh_to_tetgenio.h
  13. 7 7
      include/igl/copyleft/tetgen/mesh_with_skeleton.cpp
  14. 72 0
      include/igl/copyleft/tetgen/mesh_with_skeleton.h
  15. 3 3
      include/igl/copyleft/tetgen/read_into_tetgenio.cpp
  16. 62 0
      include/igl/copyleft/tetgen/read_into_tetgenio.h
  17. 6 6
      include/igl/copyleft/tetgen/tetgenio_to_tetmesh.cpp
  18. 66 0
      include/igl/copyleft/tetgen/tetgenio_to_tetmesh.h
  19. 6 6
      include/igl/copyleft/tetgen/tetrahedralize.cpp
  20. 80 0
      include/igl/copyleft/tetgen/tetrahedralize.h
  21. 22 6
      include/igl/doublearea.cpp
  22. 1 8
      include/igl/doublearea.h
  23. 1 1
      include/igl/extract_manifold_patches.cpp
  24. 1 1
      include/igl/facet_components.cpp
  25. 13 0
      include/igl/file_contents_as_string.cpp
  26. 2 0
      include/igl/file_contents_as_string.h
  27. 9 5
      include/igl/internal_angles.cpp
  28. 2 2
      include/igl/opengl/init_render_to_texture.h
  29. 4 2
      include/igl/opengl/report_gl_error.cpp
  30. 3 2
      include/igl/per_vertex_normals.cpp
  31. 6 3
      include/igl/readOFF.cpp
  32. 1 1
      include/igl/signed_distance.cpp
  33. 1 0
      include/igl/sort.cpp
  34. 0 69
      include/igl/tetgen/cdt.h
  35. 0 52
      include/igl/tetgen/mesh_to_tetgenio.h
  36. 0 69
      include/igl/tetgen/mesh_with_skeleton.h
  37. 0 57
      include/igl/tetgen/read_into_tetgenio.h
  38. 0 63
      include/igl/tetgen/tetgenio_to_tetmesh.h
  39. 0 77
      include/igl/tetgen/tetrahedralize.h
  40. 1 1
      include/igl/triangle_triangle_adjacency.cpp
  41. 1 1
      include/igl/unique_edge_map.cpp
  42. 1 1
      optional/CMakeLists.txt
  43. 29 5
      style-guidelines.md
  44. 2 2
      tutorial/605_Tetgen/main.cpp

+ 70 - 38
include/igl/copyleft/boolean/mesh_boolean.cpp

@@ -31,7 +31,7 @@ template <
   typename DerivedVC,
   typename DerivedFC,
   typename DerivedJ>
-IGL_INLINE void igl::copyleft::boolean::per_face_winding_number_binary_operation(
+IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
     const Eigen::PlainObjectBase<DerivedVA> & VA,
     const Eigen::PlainObjectBase<DerivedFA> & FA,
     const Eigen::PlainObjectBase<DerivedVB> & VB,
@@ -148,6 +148,7 @@ template <
   typename DerivedFA,
   typename DerivedVB,
   typename DerivedFB,
+  typename ResolveFunc,
   typename DerivedVC,
   typename DerivedFC,
   typename DerivedJ>
@@ -157,9 +158,11 @@ IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
     const Eigen::PlainObjectBase<DerivedVB > & VB,
     const Eigen::PlainObjectBase<DerivedFB > & FB,
     const MeshBooleanType & type,
+    const ResolveFunc& resolve_func,
     Eigen::PlainObjectBase<DerivedVC > & VC,
     Eigen::PlainObjectBase<DerivedFC > & FC,
-    Eigen::PlainObjectBase<DerivedJ > & J) {
+    Eigen::PlainObjectBase<DerivedJ > & J)
+{
   typedef CGAL::Epeck Kernel;
   typedef Kernel::FT ExactScalar;
   typedef Eigen::Matrix<
@@ -168,60 +171,30 @@ IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
     Eigen::Dynamic,
     DerivedVC::IsRowMajor> MatrixXES;
 
-  std::function<void(
-      const Eigen::PlainObjectBase<DerivedVA>&,
-      const Eigen::PlainObjectBase<DerivedFA>&,
-      Eigen::PlainObjectBase<MatrixXES>&,
-      Eigen::PlainObjectBase<DerivedFC>&,
-      Eigen::PlainObjectBase<DerivedJ>&)> resolve_func =
-    [](const Eigen::PlainObjectBase<DerivedVA>& V,
-        const Eigen::PlainObjectBase<DerivedFA>& F,
-        Eigen::PlainObjectBase<MatrixXES>& Vo,
-        Eigen::PlainObjectBase<DerivedFC>& Fo,
-        Eigen::PlainObjectBase<DerivedJ>& J) {
-      Eigen::VectorXi I;
-      igl::copyleft::cgal::RemeshSelfIntersectionsParam params;
-
-      MatrixXES Vr;
-      DerivedFC Fr;
-      Eigen::MatrixXi IF;
-      igl::copyleft::cgal::remesh_self_intersections(
-          V, F, params, Vr, Fr, IF, J, I);
-      assert(I.size() == Vr.rows());
-
-      // Merge coinciding vertices into non-manifold vertices.
-      std::for_each(Fr.data(), Fr.data()+Fr.size(),
-          [&I](typename DerivedFC::Scalar& a) { a=I[a]; });
-
-      // Remove unreferenced vertices.
-      Eigen::VectorXi UIM;
-      igl::remove_unreferenced(Vr, Fr, Vo, Fo, UIM);
-    };
-
   switch (type) {
     case MESH_BOOLEAN_TYPE_UNION:
-      igl::copyleft::boolean::per_face_winding_number_binary_operation(
+      igl::copyleft::boolean::mesh_boolean(
           VA, FA, VB, FB, igl::copyleft::boolean::BinaryUnion(),
           igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
       break;
     case MESH_BOOLEAN_TYPE_INTERSECT:
-      igl::copyleft::boolean::per_face_winding_number_binary_operation(
+      igl::copyleft::boolean::mesh_boolean(
           VA, FA, VB, FB, igl::copyleft::boolean::BinaryIntersect(),
           igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
       break;
     case MESH_BOOLEAN_TYPE_MINUS:
-      igl::copyleft::boolean::per_face_winding_number_binary_operation(
+      igl::copyleft::boolean::mesh_boolean(
           VA, FA, VB, FB, igl::copyleft::boolean::BinaryMinus(),
           igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
       break;
     case MESH_BOOLEAN_TYPE_XOR:
-      igl::copyleft::boolean::per_face_winding_number_binary_operation(
+      igl::copyleft::boolean::mesh_boolean(
           VA, FA, VB, FB, igl::copyleft::boolean::BinaryXor(),
           igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
       break;
     case MESH_BOOLEAN_TYPE_RESOLVE:
       //op = binary_resolve();
-      igl::copyleft::boolean::per_face_winding_number_binary_operation(
+      igl::copyleft::boolean::mesh_boolean(
           VA, FA, VB, FB, igl::copyleft::boolean::BinaryResolve(),
           igl::copyleft::boolean::KeepAll(), resolve_func, VC, FC, J);
       break;
@@ -236,7 +209,66 @@ template <
   typename DerivedVB,
   typename DerivedFB,
   typename DerivedVC,
-  typename DerivedFC>
+  typename DerivedFC,
+  typename DerivedJ>
+IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
+  const Eigen::PlainObjectBase<DerivedVA > & VA,
+  const Eigen::PlainObjectBase<DerivedFA > & FA,
+  const Eigen::PlainObjectBase<DerivedVB > & VB,
+  const Eigen::PlainObjectBase<DerivedFB > & FB,
+  const MeshBooleanType & type,
+  Eigen::PlainObjectBase<DerivedVC > & VC,
+  Eigen::PlainObjectBase<DerivedFC > & FC,
+  Eigen::PlainObjectBase<DerivedJ > & J)
+{
+  typedef CGAL::Epeck Kernel;
+  typedef Kernel::FT ExactScalar;
+  typedef Eigen::Matrix<
+    ExactScalar,
+    Eigen::Dynamic,
+    Eigen::Dynamic,
+    DerivedVC::IsRowMajor> MatrixXES;
+
+  std::function<void(
+      const Eigen::PlainObjectBase<DerivedVA>&,
+      const Eigen::PlainObjectBase<DerivedFA>&,
+      Eigen::PlainObjectBase<MatrixXES>&,
+      Eigen::PlainObjectBase<DerivedFC>&,
+      Eigen::PlainObjectBase<DerivedJ>&)> resolve_func =
+    [](const Eigen::PlainObjectBase<DerivedVA>& V,
+        const Eigen::PlainObjectBase<DerivedFA>& F,
+        Eigen::PlainObjectBase<MatrixXES>& Vo,
+        Eigen::PlainObjectBase<DerivedFC>& Fo,
+        Eigen::PlainObjectBase<DerivedJ>& J) {
+      Eigen::VectorXi I;
+      igl::copyleft::cgal::RemeshSelfIntersectionsParam params;
+
+      MatrixXES Vr;
+      DerivedFC Fr;
+      Eigen::MatrixXi IF;
+      igl::copyleft::cgal::remesh_self_intersections(
+          V, F, params, Vr, Fr, IF, J, I);
+      assert(I.size() == Vr.rows());
+
+      // Merge coinciding vertices into non-manifold vertices.
+      std::for_each(Fr.data(), Fr.data()+Fr.size(),
+          [&I](typename DerivedFC::Scalar& a) { a=I[a]; });
+
+      // Remove unreferenced vertices.
+      Eigen::VectorXi UIM;
+      igl::remove_unreferenced(Vr, Fr, Vo, Fo, UIM);
+    };
+
+  return mesh_boolean(VA,FA,VB,FB,type,resolve_func,VC,FC,J);
+}
+
+template <
+typename DerivedVA,
+typename DerivedFA,
+typename DerivedVB,
+typename DerivedFB,
+typename DerivedVC,
+typename DerivedFC>
 IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
     const Eigen::PlainObjectBase<DerivedVA > & VA,
     const Eigen::PlainObjectBase<DerivedFA > & FA,

+ 79 - 1
include/igl/copyleft/boolean/mesh_boolean.h

@@ -21,6 +21,27 @@ namespace igl
   {
     namespace boolean
     {
+      //  MESH_BOOLEAN Compute boolean csg operations on "solid", consistently
+      //  oriented meshes.
+      //
+      //  Inputs:
+      //    VA  #VA by 3 list of vertex positions of first mesh
+      //    FA  #FA by 3 list of triangle indices into VA
+      //    VB  #VB by 3 list of vertex positions of second mesh
+      //    FB  #FB by 3 list of triangle indices into VB
+      //    wind_num_op  function handle for filtering winding numbers from
+      //      tuples of integer values to [0,1] outside/inside values
+      //    keep  function handle for determining if a patch should be "kept"
+      //      in the output based on the winding number on either side
+      //    resolve_fun  function handle for computing resolve of a
+      //      self-intersections of a mesh and outputting the new mesh.
+      //  Outputs:
+      //    VC  #VC by 3 list of vertex positions of boolean result mesh
+      //    FC  #FC by 3 list of triangle indices into VC
+      //    J  #FC list of indices into [FA;FB] revealing "birth" facet
+      //
+      //  See also: mesh_boolean_cork, intersect_other,
+      //  remesh_self_intersections
       template <
         typename DerivedVA,
         typename DerivedFA,
@@ -32,7 +53,7 @@ namespace igl
         typename DerivedVC,
         typename DerivedFC,
         typename DerivedJ>
-      IGL_INLINE void per_face_winding_number_binary_operation(
+      IGL_INLINE void mesh_boolean(
           const Eigen::PlainObjectBase<DerivedVA> & VA,
           const Eigen::PlainObjectBase<DerivedFA> & FA,
           const Eigen::PlainObjectBase<DerivedVB> & VB,
@@ -44,11 +65,27 @@ namespace igl
           Eigen::PlainObjectBase<DerivedFC > & FC,
           Eigen::PlainObjectBase<DerivedJ > & J);
 
+      //  Inputs:
+      //    VA  #VA by 3 list of vertex positions of first mesh
+      //    FA  #FA by 3 list of triangle indices into VA
+      //    VB  #VB by 3 list of vertex positions of second mesh
+      //    FB  #FB by 3 list of triangle indices into VB
+      //    type  type of boolean operation
+      //    resolve_fun  function handle for computing resolve of a
+      //      self-intersections of a mesh and outputting the new mesh.
+      //  Outputs:
+      //    VC  #VC by 3 list of vertex positions of boolean result mesh
+      //    FC  #FC by 3 list of triangle indices into VC
+      //    J  #FC list of indices into [FA;FB] revealing "birth" facet
+      //
+      //  See also: mesh_boolean_cork, intersect_other,
+      //  remesh_self_intersections
       template <
         typename DerivedVA,
         typename DerivedFA,
         typename DerivedVB,
         typename DerivedFB,
+        typename ResolveFunc,
         typename DerivedVC,
         typename DerivedFC,
         typename DerivedJ>
@@ -58,10 +95,51 @@ namespace igl
           const Eigen::PlainObjectBase<DerivedVB > & VB,
           const Eigen::PlainObjectBase<DerivedFB > & FB,
           const MeshBooleanType & type,
+        const ResolveFunc& resolve_func,
           Eigen::PlainObjectBase<DerivedVC > & VC,
           Eigen::PlainObjectBase<DerivedFC > & FC,
           Eigen::PlainObjectBase<DerivedJ > & J);
 
+      //  Inputs:
+      //    VA  #VA by 3 list of vertex positions of first mesh
+      //    FA  #FA by 3 list of triangle indices into VA
+      //    VB  #VB by 3 list of vertex positions of second mesh
+      //    FB  #FB by 3 list of triangle indices into VB
+      //    type  type of boolean operation
+      //  Outputs:
+      //    VC  #VC by 3 list of vertex positions of boolean result mesh
+      //    FC  #FC by 3 list of triangle indices into VC
+      //    J  #FC list of indices into [FA;FB] revealing "birth" facet
+      //
+      //  See also: mesh_boolean_cork, intersect_other,
+      //  remesh_self_intersections
+      template <
+        typename DerivedVA,
+        typename DerivedFA,
+        typename DerivedVB,
+        typename DerivedFB,
+        typename DerivedVC,
+        typename DerivedFC,
+        typename DerivedJ>
+      IGL_INLINE void mesh_boolean(
+        const Eigen::PlainObjectBase<DerivedVA > & VA,
+        const Eigen::PlainObjectBase<DerivedFA > & FA,
+        const Eigen::PlainObjectBase<DerivedVB > & VB,
+        const Eigen::PlainObjectBase<DerivedFB > & FB,
+        const MeshBooleanType & type,
+        Eigen::PlainObjectBase<DerivedVC > & VC,
+        Eigen::PlainObjectBase<DerivedFC > & FC,
+        Eigen::PlainObjectBase<DerivedJ > & J);
+
+      //  Inputs:
+      //    VA  #VA by 3 list of vertex positions of first mesh
+      //    FA  #FA by 3 list of triangle indices into VA
+      //    VB  #VB by 3 list of vertex positions of second mesh
+      //    FB  #FB by 3 list of triangle indices into VB
+      //    type  type of boolean operation
+      //  Outputs:
+      //    VC  #VC by 3 list of vertex positions of boolean result mesh
+      //    FC  #FC by 3 list of triangle indices into VC
       template <
         typename DerivedVA,
         typename DerivedFA,

+ 1 - 1
include/igl/copyleft/cgal/extract_cells.cpp

@@ -341,5 +341,5 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
 
 #ifdef IGL_STATIC_LIBRARY
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
-template unsigned long igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::__1::vector<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >, std::__1::allocator<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template unsigned long igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 2 - 2
include/igl/copyleft/cgal/mesh_to_cgal_triangle_list.cpp

@@ -60,6 +60,6 @@ template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<doub
 template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epick>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > >&);
 template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, CGAL::Epeck>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, std::vector<CGAL::Triangle_3<CGAL::Epeck>, std::allocator<CGAL::Triangle_3<CGAL::Epeck> > >&);
 template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, CGAL::Epick>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > >&);
-template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epick>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::__1::vector<CGAL::Triangle_3<CGAL::Epick>, std::__1::allocator<CGAL::Triangle_3<CGAL::Epick> > >&);
-template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::__1::vector<CGAL::Triangle_3<CGAL::Epeck>, std::__1::allocator<CGAL::Triangle_3<CGAL::Epeck> > >&);
+template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epick>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > >&);
+template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epeck>, std::allocator<CGAL::Triangle_3<CGAL::Epeck> > >&);
 #endif

+ 1 - 1
include/igl/copyleft/cgal/order_facets_around_edge.cpp

@@ -402,5 +402,5 @@ template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double
 template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, unsigned long, unsigned long, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, unsigned long, unsigned long, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, unsigned long, unsigned long, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, unsigned long, unsigned long, std::__1::vector<int, std::__1::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, unsigned long, unsigned long, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

+ 20 - 20
include/igl/copyleft/cgal/order_facets_around_edges.h

@@ -52,13 +52,13 @@ namespace igl
       typename std::enable_if<!std::is_same<typename DerivedV::Scalar,
       typename CGAL::Exact_predicates_exact_constructions_kernel::FT>::value, void>::type
       order_facets_around_edges(
-              const Eigen::PlainObjectBase<DerivedV>& V,
-              const Eigen::PlainObjectBase<DerivedF>& F,
-              const Eigen::PlainObjectBase<DerivedN>& N,
-              const Eigen::PlainObjectBase<DeriveduE>& uE,
-              const std::vector<std::vector<uE2EType> >& uE2E,
-              std::vector<std::vector<uE2oEType> >& uE2oE,
-              std::vector<std::vector<uE2CType > >& uE2C );
+        const Eigen::PlainObjectBase<DerivedV>& V,
+        const Eigen::PlainObjectBase<DerivedF>& F,
+        const Eigen::PlainObjectBase<DerivedN>& N,
+        const Eigen::PlainObjectBase<DeriveduE>& uE,
+        const std::vector<std::vector<uE2EType> >& uE2E,
+        std::vector<std::vector<uE2oEType> >& uE2oE,
+        std::vector<std::vector<uE2CType > >& uE2C );
 
       template<
           typename DerivedV,
@@ -72,13 +72,13 @@ namespace igl
       typename std::enable_if<std::is_same<typename DerivedV::Scalar,
       typename CGAL::Exact_predicates_exact_constructions_kernel::FT>::value, void>::type
       order_facets_around_edges(
-              const Eigen::PlainObjectBase<DerivedV>& V,
-              const Eigen::PlainObjectBase<DerivedF>& F,
-              const Eigen::PlainObjectBase<DerivedN>& N,
-              const Eigen::PlainObjectBase<DeriveduE>& uE,
-              const std::vector<std::vector<uE2EType> >& uE2E,
-              std::vector<std::vector<uE2oEType> >& uE2oE,
-              std::vector<std::vector<uE2CType > >& uE2C );
+        const Eigen::PlainObjectBase<DerivedV>& V,
+        const Eigen::PlainObjectBase<DerivedF>& F,
+        const Eigen::PlainObjectBase<DerivedN>& N,
+        const Eigen::PlainObjectBase<DeriveduE>& uE,
+        const std::vector<std::vector<uE2EType> >& uE2E,
+        std::vector<std::vector<uE2oEType> >& uE2oE,
+        std::vector<std::vector<uE2CType > >& uE2C );
 
       // Order faces around each edge. Only exact predicate is used in the algorithm.
       // Normal is not needed.
@@ -90,12 +90,12 @@ namespace igl
           typename uE2oEType,
           typename uE2CType >
       IGL_INLINE void order_facets_around_edges(
-              const Eigen::PlainObjectBase<DerivedV>& V,
-              const Eigen::PlainObjectBase<DerivedF>& F,
-              const Eigen::PlainObjectBase<DeriveduE>& uE,
-              const std::vector<std::vector<uE2EType> >& uE2E,
-              std::vector<std::vector<uE2oEType> >& uE2oE,
-              std::vector<std::vector<uE2CType > >& uE2C );
+        const Eigen::PlainObjectBase<DerivedV>& V,
+        const Eigen::PlainObjectBase<DerivedF>& F,
+        const Eigen::PlainObjectBase<DeriveduE>& uE,
+        const std::vector<std::vector<uE2EType> >& uE2E,
+        std::vector<std::vector<uE2oEType> >& uE2oE,
+        std::vector<std::vector<uE2CType > >& uE2C );
     }
   }
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 3
include/igl/copyleft/cgal/remesh_intersections.cpp


+ 0 - 0
include/igl/tetgen/README → include/igl/copyleft/tetgen/README


+ 3 - 3
include/igl/tetgen/cdt.cpp → include/igl/copyleft/tetgen/cdt.cpp

@@ -6,8 +6,8 @@
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "cdt.h"
-#include "../bounding_box.h"
-#include "../writeOBJ.h"
+#include "../../bounding_box.h"
+#include "../../writeOBJ.h"
 
 template <
   typename DerivedV, 
@@ -15,7 +15,7 @@ template <
   typename DerivedTV, 
   typename DerivedTT, 
   typename DerivedTF>
-IGL_INLINE bool igl::tetgen::cdt(
+IGL_INLINE bool igl::copyleft::tetgen::cdt(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedF>& F,
   const CDTParam & param,

+ 72 - 0
include/igl/copyleft/tetgen/cdt.h

@@ -0,0 +1,72 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_CDT_H
+#define IGL_COPYLEFT_TETGEN_CDT_H
+#include "../../igl_inline.h"
+
+#include <Eigen/Core>
+#include <string>
+#ifndef TETLIBRARY
+#  define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined REAL
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      struct CDTParam
+      {
+        // Tetgen can compute mesh of convex hull of input (i.e. "c") but often
+        // chokes. One workaround is to force it to mesh the entire bounding box.
+        // {false}
+        bool use_bounding_box = false;
+        // Scale the bounding box a bit so that vertices near it do not give tetgen
+        // problems. {1.01}
+        double bounding_box_scale = 1.01;
+        // Flags to tetgen. Do not include the "c" flag here! {"Y"}
+        std::string flags = "Y";
+      };
+      // Create a constrained delaunay tesselation containing convex hull of the
+      // given **non-selfintersecting** mesh.
+      //
+      // Inputs:
+      //    V  #V by 3 list of input mesh vertices
+      //    F  #F by 3 list of input mesh facets
+      //    param  see above
+      //    TV  #TV by 3 list of output mesh vertices (V come first)
+      //    TT  #TT by 3 list of tetrahedra indices into TV.
+      //    TF  #TF by 3 list of facets from F potentially subdivided.
+      // 
+      template <
+        typename DerivedV, 
+        typename DerivedF, 
+        typename DerivedTV, 
+        typename DerivedTT, 
+        typename DerivedTF>
+      IGL_INLINE bool cdt(
+        const Eigen::PlainObjectBase<DerivedV>& V,
+        const Eigen::PlainObjectBase<DerivedF>& F,
+        const CDTParam & param,
+        Eigen::PlainObjectBase<DerivedTV>& TV,
+        Eigen::PlainObjectBase<DerivedTT>& TT,
+        Eigen::PlainObjectBase<DerivedTF>& TF);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "cdt.cpp"
+#endif
+
+#endif
+
+

+ 4 - 4
include/igl/tetgen/mesh_to_tetgenio.cpp → include/igl/copyleft/tetgen/mesh_to_tetgenio.cpp

@@ -8,12 +8,12 @@
 #include "mesh_to_tetgenio.h"
 
 // IGL includes 
-#include <igl/matrix_to_list.h>
+#include "../../matrix_to_list.h"
 
 // STL includes
 #include <cassert>
 
-IGL_INLINE bool igl::tetgen::mesh_to_tetgenio(
+IGL_INLINE bool igl::copyleft::tetgen::mesh_to_tetgenio(
   const std::vector<std::vector<REAL > > & V, 
   const std::vector<std::vector<int> > & F, 
   tetgenio & in)
@@ -59,7 +59,7 @@ IGL_INLINE bool igl::tetgen::mesh_to_tetgenio(
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE bool igl::tetgen::mesh_to_tetgenio(
+IGL_INLINE bool igl::copyleft::tetgen::mesh_to_tetgenio(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedF>& F,
   tetgenio & in)
@@ -75,5 +75,5 @@ IGL_INLINE bool igl::tetgen::mesh_to_tetgenio(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template bool igl::tetgen::mesh_to_tetgenio<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, tetgenio&);
+template bool igl::copyleft::tetgen::mesh_to_tetgenio<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, tetgenio&);
 #endif

+ 55 - 0
include/igl/copyleft/tetgen/mesh_to_tetgenio.h

@@ -0,0 +1,55 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_MESH_TO_TETGENIO_H
+#define IGL_COPYLEFT_TETGEN_MESH_TO_TETGENIO_H
+#include "../../igl_inline.h"
+
+#ifndef TETLIBRARY
+#  define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined tetgenio, REAL
+#include <vector>
+#include <Eigen/Core>
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Load a vertex list and face list into a tetgenio object
+      // Inputs:
+      //   V  #V by 3 vertex position list
+      //   F  #F list of polygon face indices into V (0-indexed)
+      // Outputs:
+      //   in  tetgenio input object
+      // Returns true on success, false on error
+      IGL_INLINE bool mesh_to_tetgenio(
+        const std::vector<std::vector<REAL > > & V, 
+        const std::vector<std::vector<int> > & F, 
+        tetgenio & in);
+      
+      // Wrapper with Eigen types
+      // Templates:
+      //   DerivedV  real-value: i.e. from MatrixXd
+      //   DerivedF  integer-value: i.e. from MatrixXi
+      template <typename DerivedV, typename DerivedF>
+      IGL_INLINE bool mesh_to_tetgenio(
+        const Eigen::PlainObjectBase<DerivedV>& V,
+        const Eigen::PlainObjectBase<DerivedF>& F,
+        tetgenio & in);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "mesh_to_tetgenio.cpp"
+#endif
+
+#endif

+ 7 - 7
include/igl/tetgen/mesh_with_skeleton.cpp → include/igl/copyleft/tetgen/mesh_with_skeleton.cpp

@@ -6,19 +6,19 @@
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "mesh_with_skeleton.h"
+#include "tetrahedralize.h"
 
-#include <igl/sample_edges.h>
-#include <igl/cat.h>
-#include <igl/tetgen/tetrahedralize.h>
-#include <igl/writeOFF.h>
-#include <igl/writeOBJ.h>
+#include "../../sample_edges.h"
+#include "../../cat.h"
+#include "../../writeOFF.h"
+#include "../../writeOBJ.h"
 
 #include <iostream>
 // Default settings pq2Y tell tetgen to mesh interior of triangle mesh and
 // to produce a graded tet mesh
 const static std::string DEFAULT_TETGEN_FLAGS = "pq2Y";
 
-IGL_INLINE bool igl::tetgen::mesh_with_skeleton(
+IGL_INLINE bool igl::copyleft::tetgen::mesh_with_skeleton(
   const Eigen::MatrixXd & V,
   const Eigen::MatrixXi & F,
   const Eigen::MatrixXd & C,
@@ -85,7 +85,7 @@ IGL_INLINE bool igl::tetgen::mesh_with_skeleton(
   return true;
 }
 
-IGL_INLINE bool igl::tetgen::mesh_with_skeleton(
+IGL_INLINE bool igl::copyleft::tetgen::mesh_with_skeleton(
   const Eigen::MatrixXd & V,
   const Eigen::MatrixXi & F,
   const Eigen::MatrixXd & C,

+ 72 - 0
include/igl/copyleft/tetgen/mesh_with_skeleton.h

@@ -0,0 +1,72 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_MESH_WITH_SKELETON_H
+#define IGL_COPYLEFT_TETGEN_MESH_WITH_SKELETON_H
+#include "../../igl_inline.h"
+#include <Eigen/Dense>
+#include <string>
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Mesh the interior of a given surface with tetrahedra which are graded
+      // (tend to be small near the surface and large inside) and conform to the
+      // given handles and samplings thereof.
+      //
+      // Inputs:
+      //  V  #V by 3 list of mesh vertex positions
+      //  F  #F by 3 list of triangle indices
+      //  C  #C by 3 list of vertex positions
+      //  P  #P list of point handle indices
+      //  BE #BE by 2 list of bone-edge indices
+      //  CE #CE by 2 list of cage-edge indices
+      //  samples_per_bone  #samples to add per bone
+      //  tetgen_flags  flags to pass to tetgen {""-->"pq2Y"} otherwise you're on
+      //    your own and it's your funeral if you pass nonsense flags
+      // Outputs:
+      //  VV  #VV by 3 list of tet-mesh vertex positions
+      //  TT  #TT by 4 list of tetrahedra indices
+      //  FF  #FF by 3 list of surface triangle indices
+      // Returns true only on success
+      IGL_INLINE bool mesh_with_skeleton(
+        const Eigen::MatrixXd & V,
+        const Eigen::MatrixXi & F,
+        const Eigen::MatrixXd & C,
+        const Eigen::VectorXi & /*P*/,
+        const Eigen::MatrixXi & BE,
+        const Eigen::MatrixXi & CE,
+        const int samples_per_bone,
+        const std::string & tetgen_flags,
+        Eigen::MatrixXd & VV,
+        Eigen::MatrixXi & TT,
+        Eigen::MatrixXi & FF);
+      // Wrapper using default tetgen_flags
+      IGL_INLINE bool mesh_with_skeleton(
+        const Eigen::MatrixXd & V,
+        const Eigen::MatrixXi & F,
+        const Eigen::MatrixXd & C,
+        const Eigen::VectorXi & /*P*/,
+        const Eigen::MatrixXi & BE,
+        const Eigen::MatrixXi & CE,
+        const int samples_per_bone,
+        Eigen::MatrixXd & VV,
+        Eigen::MatrixXi & TT,
+        Eigen::MatrixXi & FF);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "mesh_with_skeleton.cpp"
+#endif
+
+#endif

+ 3 - 3
include/igl/tetgen/read_into_tetgenio.cpp → include/igl/copyleft/tetgen/read_into_tetgenio.cpp

@@ -9,13 +9,13 @@
 #include "mesh_to_tetgenio.h"
 
 // IGL includes
-#include <igl/pathinfo.h>
+#include "../../pathinfo.h"
 #ifndef IGL_NO_EIGEN
 #  define IGL_NO_EIGEN_WAS_NOT_ALREADY_DEFINED
 #  define IGL_NO_EIGEN
 #endif 
 // Include igl headers without including Eigen
-#include <igl/readOBJ.h>
+#include "../../readOBJ.h"
 #ifdef IGL_NO_EIGEN_WAS_NOT_ALREADY_DEFINED
 #  undef IGL_NO_EIGEN
 #endif
@@ -25,7 +25,7 @@
 #include <iostream>
 #include <vector>
 
-IGL_INLINE bool igl::tetgen::read_into_tetgenio(
+IGL_INLINE bool igl::copyleft::tetgen::read_into_tetgenio(
   const std::string & path,
   tetgenio & in)
 {

+ 62 - 0
include/igl/copyleft/tetgen/read_into_tetgenio.h

@@ -0,0 +1,62 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_READ_INTO_TETGENIO_H
+#define IGL_COPYLEFT_TETGEN_READ_INTO_TETGENIO_H
+#include "../../igl_inline.h"
+
+#include <string>
+#ifndef TETLIBRARY
+#define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined tetgenio, REAL
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Read a mesh or point set into tetgenio (input object for calling
+      // tetgen).  Many file formats are already supported by tetgen:
+      //   .off
+      //   .ply
+      //   .node
+      //   .ply
+      //   .medit
+      //   .vtk
+      //   etc.
+      // Noteably it does not support .obj which is loaded by hand here (also
+      // demonstrating how to load points/faces programatically)
+      //
+      // If the file extension is not recognized the filename is assumed to be
+      // the basename of a collection describe a tetmesh, (of which at least
+      // the .node file must exist):
+      //   [filename].node
+      //   [filename].ele
+      //   [filename].face
+      //   [filename].edge
+      //   [filename].vol
+      //
+      // Inputs:
+      //   path  path to file or basename to files
+      // Outputs:
+      //   in  tetgenio input object
+      // Returns true on success, false on error
+      IGL_INLINE bool read_into_tetgenio(
+        const std::string & path, 
+        tetgenio & in);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "read_into_tetgenio.cpp"
+#endif
+
+#endif

+ 6 - 6
include/igl/tetgen/tetgenio_to_tetmesh.cpp → include/igl/copyleft/tetgen/tetgenio_to_tetmesh.cpp

@@ -8,12 +8,12 @@
 #include "tetgenio_to_tetmesh.h"
 
 // IGL includes
-#include <igl/list_to_matrix.h>
+#include "../../list_to_matrix.h"
 
 // STL includes
 #include <iostream>
 
-IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
+IGL_INLINE bool igl::copyleft::tetgen::tetgenio_to_tetmesh(
   const tetgenio & out,
   std::vector<std::vector<REAL > > & V, 
   std::vector<std::vector<int> > & T,
@@ -84,7 +84,7 @@ IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
   return true;
 }
 
-IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
+IGL_INLINE bool igl::copyleft::tetgen::tetgenio_to_tetmesh(
   const tetgenio & out,
   std::vector<std::vector<REAL > > & V, 
   std::vector<std::vector<int> > & T)
@@ -94,7 +94,7 @@ IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
 }
 
 template <typename DerivedV, typename DerivedT, typename DerivedF>
-IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
+IGL_INLINE bool igl::copyleft::tetgen::tetgenio_to_tetmesh(
   const tetgenio & out,
   Eigen::PlainObjectBase<DerivedV>& V,
   Eigen::PlainObjectBase<DerivedT>& T,
@@ -125,7 +125,7 @@ IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
 }
 
 template <typename DerivedV, typename DerivedT>
-IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
+IGL_INLINE bool igl::copyleft::tetgen::tetgenio_to_tetmesh(
   const tetgenio & out,
   Eigen::PlainObjectBase<DerivedV>& V,
   Eigen::PlainObjectBase<DerivedT>& T)
@@ -136,5 +136,5 @@ IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template bool igl::tetgen::tetgenio_to_tetmesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(tetgenio const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template bool igl::copyleft::tetgen::tetgenio_to_tetmesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(tetgenio const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 66 - 0
include/igl/copyleft/tetgen/tetgenio_to_tetmesh.h

@@ -0,0 +1,66 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_TETGENIO_TO_TETMESH_H
+#define IGL_COPYLEFT_TETGEN_TETGENIO_TO_TETMESH_H
+#include "../../igl_inline.h"
+
+#ifndef TETLIBRARY
+#define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined tetgenio, REAL
+#include <vector>
+#include <Eigen/Core>
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Extract a tetrahedral mesh from a tetgenio object
+      // Inputs:
+      //   out tetgenio output object
+      // Outputs:
+      //   V  #V by 3 vertex position list
+      //   T  #T by 4 list of tetrahedra indices into V
+      //   F  #F by 3 list of marked facets
+      // Returns true on success, false on error
+      IGL_INLINE bool tetgenio_to_tetmesh(
+        const tetgenio & out,
+        std::vector<std::vector<REAL > > & V, 
+        std::vector<std::vector<int> > & T,
+        std::vector<std::vector<int> > & F);
+      IGL_INLINE bool tetgenio_to_tetmesh(
+        const tetgenio & out,
+        std::vector<std::vector<REAL > > & V, 
+        std::vector<std::vector<int> > & T);
+      
+      // Wrapper with Eigen types
+      // Templates:
+      //   DerivedV  real-value: i.e. from MatrixXd
+      //   DerivedT  integer-value: i.e. from MatrixXi
+      template <typename DerivedV, typename DerivedT, typename DerivedF>
+      IGL_INLINE bool tetgenio_to_tetmesh(
+        const tetgenio & out,
+        Eigen::PlainObjectBase<DerivedV>& V,
+        Eigen::PlainObjectBase<DerivedT>& T,
+        Eigen::PlainObjectBase<DerivedF>& F);
+      template <typename DerivedV, typename DerivedT>
+      IGL_INLINE bool tetgenio_to_tetmesh(
+        const tetgenio & out,
+        Eigen::PlainObjectBase<DerivedV>& V,
+        Eigen::PlainObjectBase<DerivedT>& T);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "tetgenio_to_tetmesh.cpp"
+#endif
+
+#endif

+ 6 - 6
include/igl/tetgen/tetrahedralize.cpp → include/igl/copyleft/tetgen/tetrahedralize.cpp

@@ -10,15 +10,15 @@
 #include "tetgenio_to_tetmesh.h"
 
 // IGL includes 
-#include <igl/matrix_to_list.h>
-#include <igl/list_to_matrix.h>
-#include <igl/boundary_facets.h>
+#include "../../matrix_to_list.h"
+#include "../../list_to_matrix.h"
+#include "../../boundary_facets.h"
 
 // STL includes
 #include <cassert>
 #include <iostream>
 
-IGL_INLINE int igl::tetgen::tetrahedralize(
+IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
   const std::vector<std::vector<REAL > > & V, 
   const std::vector<std::vector<int> > & F, 
   const std::string switches,
@@ -65,7 +65,7 @@ template <
   typename DerivedTV, 
   typename DerivedTT, 
   typename DerivedTF>
-IGL_INLINE int igl::tetgen::tetrahedralize(
+IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedF>& F,
   const std::string switches,
@@ -103,5 +103,5 @@ IGL_INLINE int igl::tetgen::tetrahedralize(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template int igl::tetgen::tetrahedralize<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template int igl::copyleft::tetgen::tetrahedralize<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 80 - 0
include/igl/copyleft/tetgen/tetrahedralize.h

@@ -0,0 +1,80 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_TETRAHEDRALIZE_H
+#define IGL_COPYLEFT_TETGEN_TETRAHEDRALIZE_H
+#include "../../igl_inline.h"
+
+#include <vector>
+#include <string>
+#include <Eigen/Core>
+#ifndef TETLIBRARY
+#define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined REAL
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Mesh the interior of a surface mesh (V,F) using tetgen
+      //
+      // Inputs:
+      //   V  #V by 3 vertex position list
+      //   F  #F list of polygon face indices into V (0-indexed)
+      //   switches  string of tetgen options (See tetgen documentation) e.g.
+      //     "pq1.414a0.01" tries to mesh the interior of a given surface with
+      //       quality and area constraints
+      //     "" will mesh the convex hull constrained to pass through V (ignores F)
+      // Outputs:
+      //   TV  #V by 3 vertex position list
+      //   TT  #T by 4 list of tet face indices
+      //   TF  #F by 3 list of triangle face indices
+      // Returns status:
+      //   0 success
+      //   1 tetgen threw exception
+      //   2 tetgen did not crash but could not create any tets (probably there are
+      //     holes, duplicate faces etc.)
+      //   -1 other error
+      IGL_INLINE int tetrahedralize(
+        const std::vector<std::vector<REAL > > & V, 
+        const std::vector<std::vector<int> > & F, 
+        const std::string switches,
+        std::vector<std::vector<REAL > > & TV, 
+        std::vector<std::vector<int > > & TT, 
+        std::vector<std::vector<int> > & TF);
+      
+      // Wrapper with Eigen types
+      // Templates:
+      //   DerivedV  real-value: i.e. from MatrixXd
+      //   DerivedF  integer-value: i.e. from MatrixXi
+      template <
+        typename DerivedV, 
+        typename DerivedF, 
+        typename DerivedTV, 
+        typename DerivedTT, 
+        typename DerivedTF>
+      IGL_INLINE int tetrahedralize(
+        const Eigen::PlainObjectBase<DerivedV>& V,
+        const Eigen::PlainObjectBase<DerivedF>& F,
+        const std::string switches,
+        Eigen::PlainObjectBase<DerivedTV>& TV,
+        Eigen::PlainObjectBase<DerivedTT>& TT,
+        Eigen::PlainObjectBase<DerivedTF>& TF);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "tetrahedralize.cpp"
+#endif
+
+#endif
+

+ 22 - 6
include/igl/doublearea.cpp

@@ -85,14 +85,30 @@ IGL_INLINE void igl::doublearea(
   const Eigen::PlainObjectBase<DerivedC> & C,
   Eigen::PlainObjectBase<DerivedD> & D)
 {
-  assert(A.cols() == 2 && "corners should be 2d");
-  assert(B.cols() == 2 && "corners should be 2d");
-  assert(C.cols() == 2 && "corners should be 2d");
+  assert((B.cols() == A.cols()) && "dimensions of A and B should match");
+  assert((C.cols() == A.cols()) && "dimensions of A and C should match");
   assert(A.rows() == B.rows() && "corners should have same length");
   assert(A.rows() == C.rows() && "corners should have same length");
-  const auto & R = A-C;
-  const auto & S = B-C;
-  D = R.col(0).array()*S.col(1).array() - R.col(1).array()*S.col(0).array();
+  switch(A.cols())
+  {
+    case 2:
+    {
+      // For 2d compute signed area
+      const auto & R = A-C;
+      const auto & S = B-C;
+      D = R.col(0).array()*S.col(1).array() - R.col(1).array()*S.col(0).array();
+      break;
+    }
+    default:
+    {
+      Eigen::Matrix<typename DerivedD::Scalar,DerivedD::RowsAtCompileTime,3> 
+        uL(A.rows(),3);
+      uL.col(0) = (B-C).rowwise().norm();
+      uL.col(1) = (C-A).rowwise().norm();
+      uL.col(2) = (A-B).rowwise().norm();
+      doublearea(uL,D);
+    }
+  }
 }
 
 template <

+ 1 - 8
include/igl/doublearea.h

@@ -33,7 +33,7 @@ namespace igl
     const Eigen::PlainObjectBase<DerivedV> & V,
     const Eigen::PlainObjectBase<DerivedF> & F,
     Eigen::PlainObjectBase<DeriveddblA> & dblA);
-  // Stream of triangles
+  // Stream of triangles, computes signed area...
   template <
     typename DerivedA,
     typename DerivedB,
@@ -56,13 +56,6 @@ namespace igl
     const Eigen::PlainObjectBase<DerivedB> & B,
     const Eigen::PlainObjectBase<DerivedC> & C);
   // Same as above but use instrinsic edge lengths rather than (V,F) mesh
-  // Templates:
-  //   DerivedV  derived type of eigen matrix for V (e.g. derived from
-  //     MatrixXd)
-  //   DerivedF  derived type of eigen matrix for F (e.g. derived from
-  //     MatrixXi)
-  //   DeriveddblA  derived type of eigen matrix for dblA (e.g. derived from
-  //     MatrixXd)
   // Inputs:
   //   l  #F by dim list of edge lengths using
   //     for triangles, columns correspond to edges 23,31,12

+ 1 - 1
include/igl/extract_manifold_patches.cpp

@@ -68,5 +68,5 @@ IGL_INLINE size_t igl::extract_manifold_patches(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-template unsigned long igl::extract_manifold_patches<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::__1::vector<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >, std::__1::allocator<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template unsigned long igl::extract_manifold_patches<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

+ 1 - 1
include/igl/facet_components.cpp

@@ -87,5 +87,5 @@ IGL_INLINE void igl::facet_components(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template void igl::facet_components<long, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(std::vector<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >, std::allocator<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
-template void igl::facet_components<int, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::__1::vector<std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > >, std::__1::allocator<std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::facet_components<int, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

+ 13 - 0
include/igl/file_contents_as_string.cpp

@@ -9,6 +9,7 @@
 
 #include <fstream>
 #include <cstdio>
+#include <cassert>
 
 IGL_INLINE bool igl::file_contents_as_string(
   const std::string file_name,
@@ -30,3 +31,15 @@ IGL_INLINE bool igl::file_contents_as_string(
     (std::istreambuf_iterator<char>()));
   return true;
 }
+
+IGL_INLINE std::string igl::file_contents_as_string(
+  const std::string file_name)
+{
+  std::string content;
+#ifndef NDEBUG
+  bool ret = 
+#endif
+    file_contents_as_string(file_name,content);
+  assert(ret && "file_contents_as_string failed to read string from file");
+  return content;
+}

+ 2 - 0
include/igl/file_contents_as_string.h

@@ -21,6 +21,8 @@ namespace igl
   IGL_INLINE bool file_contents_as_string(
     const std::string file_name,
     std::string & content);
+  IGL_INLINE std::string file_contents_as_string(
+    const std::string file_name);
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 9 - 5
include/igl/internal_angles.cpp

@@ -18,11 +18,12 @@ IGL_INLINE void igl::internal_angles(
 {
   using namespace Eigen;
   using namespace std;
+  typedef typename DerivedV::Scalar Scalar;
   if(F.cols() == 3)
   {
     // Edge lengths
     Matrix<
-      typename DerivedV::Scalar,
+      Scalar,
       DerivedF::RowsAtCompileTime,
       DerivedF::ColsAtCompileTime> L;
     edge_lengths(V,F,L);
@@ -38,11 +39,12 @@ IGL_INLINE void igl::internal_angles(
       const Eigen::PlainObjectBase<DerivedV>& y, 
       const Eigen::PlainObjectBase<DerivedV>& z)
     {
-      Eigen::RowVector3d v1 = (x-y).normalized();
-      Eigen::RowVector3d v2 = (z-y).normalized();
+      typedef Eigen::Matrix<Scalar,1,3> RowVector3S;
+      RowVector3S v1 = (x-y).normalized();
+      RowVector3S v2 = (z-y).normalized();
       // http://stackoverflow.com/questions/10133957/signed-angle-between-two-vectors-without-a-reference-plane
-      double s = v1.cross(v2).norm();
-      double c = v1.dot(v2);
+      Scalar s = v1.cross(v2).norm();
+      Scalar c = v1.dot(v2);
       return atan2(s, c);
     };
     for(unsigned i=0; i<F.rows(); ++i)
@@ -97,4 +99,6 @@ IGL_INLINE void igl::internal_angles(
 template void igl::internal_angles<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::internal_angles<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::internal_angles<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::internal_angles<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
+template void igl::internal_angles<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 #endif

+ 2 - 2
include/igl/opengl/init_render_to_texture.h

@@ -14,8 +14,8 @@ namespace igl
 {
   namespace opengl
   {
-    // Create a texture+framebuffer+depthbuffer triplet bound for rendering into
-    // the texture;
+    // Create a frame buffer that renders color to a RGBA texture a depth to a
+    // "render buffer".
     //
     // Inputs:
     //   width  image width

+ 4 - 2
include/igl/opengl/report_gl_error.cpp

@@ -29,14 +29,16 @@ IGL_INLINE GLenum igl::opengl::report_gl_error(const std::string id)
         return "invalid value";
       case GL_INVALID_OPERATION:
         return "invalid operation";
+#ifndef GL_VERSION_3_0
       case GL_STACK_OVERFLOW:
         return "stack overflow";
       case GL_STACK_UNDERFLOW:
         return "stack underflow";
-      case GL_OUT_OF_MEMORY:
-        return "out of memory";
       case GL_TABLE_TOO_LARGE:
         return "table too large";
+#endif
+      case GL_OUT_OF_MEMORY:
+        return "out of memory";
 #ifdef GL_EXT_framebuffer_object
       case GL_INVALID_FRAMEBUFFER_OPERATION_EXT:
         return "invalid framebuffer operation";

+ 3 - 2
include/igl/per_vertex_normals.cpp

@@ -45,7 +45,8 @@ IGL_INLINE void igl::per_vertex_normals(
   // Resize for output
   N.setZero(V.rows(),3);
 
-  Eigen::MatrixXd W(F.rows(),3);
+  Eigen::Matrix<typename DerivedN::Scalar,DerivedF::RowsAtCompileTime,3> 
+    W(F.rows(),3);
   switch(weighting)
   {
     case PER_VERTEX_NORMALS_WEIGHTING_TYPE_UNIFORM:
@@ -56,7 +57,7 @@ IGL_INLINE void igl::per_vertex_normals(
     case PER_VERTEX_NORMALS_WEIGHTING_TYPE_DEFAULT:
     case PER_VERTEX_NORMALS_WEIGHTING_TYPE_AREA:
     {
-      Eigen::VectorXd A;
+      Eigen::Matrix<typename DerivedN::Scalar,DerivedF::RowsAtCompileTime,1> A;
       doublearea(V,F,A);
       W = A.replicate(1,3);
       break;

+ 6 - 3
include/igl/readOFF.cpp

@@ -89,9 +89,12 @@ IGL_INLINE bool igl::readOFF(
       fscanf(off_file,"%[^\n]",comment);
     }else
     {
-      printf("Error: bad line in %s\n",off_file_name.c_str());
-      fclose(off_file);
-      return false;
+      printf("Error: bad line (%d) in %s\n",i,off_file_name.c_str());
+      if(feof(off_file))
+      {
+        fclose(off_file);
+        return false;
+      }
     }
   }
   // Read faces

+ 1 - 1
include/igl/signed_distance.cpp

@@ -28,7 +28,7 @@ IGL_INLINE void igl::signed_distance(
   using namespace std;
   const int dim = V.cols();
   assert((V.cols() == 3||V.cols() == 2) && "V should have 3d or 2d positions");
-  assert((P.cols() == 3||V.cols() == 2) && "P should have 3d or 2d positions");
+  assert((P.cols() == 3||P.cols() == 2) && "P should have 3d or 2d positions");
   assert(V.cols() == P.cols() && "V should have same dimension as P");
   // Only unsigned distance is supported for non-triangles
   if(sign_type != SIGNED_DISTANCE_TYPE_UNSIGNED)

+ 1 - 0
include/igl/sort.cpp

@@ -232,6 +232,7 @@ template void igl::sort<Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<in
 template void igl::sort<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template void igl::sort<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template void igl::sort<Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::sort<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif
 
 #ifdef _WIN32

+ 0 - 69
include/igl/tetgen/cdt.h

@@ -1,69 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_CDT_H
-#define IGL_TETGEN_CDT_H
-#include "../igl_inline.h"
-
-#include <Eigen/Core>
-#include <string>
-#ifndef TETLIBRARY
-#  define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined REAL
-
-namespace igl
-{
-  namespace tetgen
-  {
-    struct CDTParam
-    {
-      // Tetgen can compute mesh of convex hull of input (i.e. "c") but often
-      // chokes. One workaround is to force it to mesh the entire bounding box.
-      // {false}
-      bool use_bounding_box = false;
-      // Scale the bounding box a bit so that vertices near it do not give tetgen
-      // problems. {1.01}
-      double bounding_box_scale = 1.01;
-      // Flags to tetgen. Do not include the "c" flag here! {"Y"}
-      std::string flags = "Y";
-    };
-    // Create a constrained delaunay tesselation containing convex hull of the
-    // given **non-selfintersecting** mesh.
-    //
-    // Inputs:
-    //    V  #V by 3 list of input mesh vertices
-    //    F  #F by 3 list of input mesh facets
-    //    param  see above
-    //    TV  #TV by 3 list of output mesh vertices (V come first)
-    //    TT  #TT by 3 list of tetrahedra indices into TV.
-    //    TF  #TF by 3 list of facets from F potentially subdivided.
-    // 
-    template <
-      typename DerivedV, 
-      typename DerivedF, 
-      typename DerivedTV, 
-      typename DerivedTT, 
-      typename DerivedTF>
-    IGL_INLINE bool cdt(
-      const Eigen::PlainObjectBase<DerivedV>& V,
-      const Eigen::PlainObjectBase<DerivedF>& F,
-      const CDTParam & param,
-      Eigen::PlainObjectBase<DerivedTV>& TV,
-      Eigen::PlainObjectBase<DerivedTT>& TT,
-      Eigen::PlainObjectBase<DerivedTF>& TF);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "cdt.cpp"
-#endif
-
-#endif
-
-

+ 0 - 52
include/igl/tetgen/mesh_to_tetgenio.h

@@ -1,52 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_MESH_TO_TETGENIO_H
-#define IGL_TETGEN_MESH_TO_TETGENIO_H
-#include "../igl_inline.h"
-
-#ifndef TETLIBRARY
-#  define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined tetgenio, REAL
-#include <vector>
-#include <Eigen/Core>
-
-namespace igl
-{
-  namespace tetgen
-  {
-    // Load a vertex list and face list into a tetgenio object
-    // Inputs:
-    //   V  #V by 3 vertex position list
-    //   F  #F list of polygon face indices into V (0-indexed)
-    // Outputs:
-    //   in  tetgenio input object
-    // Returns true on success, false on error
-    IGL_INLINE bool mesh_to_tetgenio(
-      const std::vector<std::vector<REAL > > & V, 
-      const std::vector<std::vector<int> > & F, 
-      tetgenio & in);
-    
-    // Wrapper with Eigen types
-    // Templates:
-    //   DerivedV  real-value: i.e. from MatrixXd
-    //   DerivedF  integer-value: i.e. from MatrixXi
-    template <typename DerivedV, typename DerivedF>
-    IGL_INLINE bool mesh_to_tetgenio(
-      const Eigen::PlainObjectBase<DerivedV>& V,
-      const Eigen::PlainObjectBase<DerivedF>& F,
-      tetgenio & in);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "mesh_to_tetgenio.cpp"
-#endif
-
-#endif

+ 0 - 69
include/igl/tetgen/mesh_with_skeleton.h

@@ -1,69 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_MESH_WITH_SKELETON_H
-#define IGL_TETGEN_MESH_WITH_SKELETON_H
-#include "../igl_inline.h"
-#include <Eigen/Dense>
-#include <string>
-
-namespace igl
-{
-  namespace tetgen
-  {
-    // Mesh the interior of a given surface with tetrahedra which are graded
-    // (tend to be small near the surface and large inside) and conform to the
-    // given handles and samplings thereof.
-    //
-    // Inputs:
-    //  V  #V by 3 list of mesh vertex positions
-    //  F  #F by 3 list of triangle indices
-    //  C  #C by 3 list of vertex positions
-    //  P  #P list of point handle indices
-    //  BE #BE by 2 list of bone-edge indices
-    //  CE #CE by 2 list of cage-edge indices
-    //  samples_per_bone  #samples to add per bone
-    //  tetgen_flags  flags to pass to tetgen {""-->"pq2Y"} otherwise you're on
-    //    your own and it's your funeral if you pass nonsense flags
-    // Outputs:
-    //  VV  #VV by 3 list of tet-mesh vertex positions
-    //  TT  #TT by 4 list of tetrahedra indices
-    //  FF  #FF by 3 list of surface triangle indices
-    // Returns true only on success
-    IGL_INLINE bool mesh_with_skeleton(
-      const Eigen::MatrixXd & V,
-      const Eigen::MatrixXi & F,
-      const Eigen::MatrixXd & C,
-      const Eigen::VectorXi & /*P*/,
-      const Eigen::MatrixXi & BE,
-      const Eigen::MatrixXi & CE,
-      const int samples_per_bone,
-      const std::string & tetgen_flags,
-      Eigen::MatrixXd & VV,
-      Eigen::MatrixXi & TT,
-      Eigen::MatrixXi & FF);
-    // Wrapper using default tetgen_flags
-    IGL_INLINE bool mesh_with_skeleton(
-      const Eigen::MatrixXd & V,
-      const Eigen::MatrixXi & F,
-      const Eigen::MatrixXd & C,
-      const Eigen::VectorXi & /*P*/,
-      const Eigen::MatrixXi & BE,
-      const Eigen::MatrixXi & CE,
-      const int samples_per_bone,
-      Eigen::MatrixXd & VV,
-      Eigen::MatrixXi & TT,
-      Eigen::MatrixXi & FF);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "mesh_with_skeleton.cpp"
-#endif
-
-#endif

+ 0 - 57
include/igl/tetgen/read_into_tetgenio.h

@@ -1,57 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_READ_INTO_TETGENIO_H
-#define IGL_TETGEN_READ_INTO_TETGENIO_H
-#include "../igl_inline.h"
-
-#include <string>
-#ifndef TETLIBRARY
-#define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined tetgenio, REAL
-
-namespace igl
-{
-  namespace tetgen
-  {
-    // Read a mesh or point set into tetgenio (input object for calling tetgen).
-    // Many file formats are already supported by tetgen:
-    //   .off
-    //   .ply
-    //   .node
-    //   .ply
-    //   .medit
-    //   .vtk
-    //   etc.
-    // Noteably it does not support .obj which is loaded by hand here (also
-    // demonstrating how to load points/faces programatically)
-    //
-    // If the file extension is not recognized the filename is assumed to be the
-    // basename of a collection describe a tetmesh, (of which at least the .node
-    // file must exist):
-    //   [filename].node
-    //   [filename].ele
-    //   [filename].face
-    //   [filename].edge
-    //   [filename].vol
-    //
-    // Inputs:
-    //   path  path to file or basename to files
-    // Outputs:
-    //   in  tetgenio input object
-    // Returns true on success, false on error
-    IGL_INLINE bool read_into_tetgenio(const std::string & path, tetgenio & in);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "read_into_tetgenio.cpp"
-#endif
-
-#endif

+ 0 - 63
include/igl/tetgen/tetgenio_to_tetmesh.h

@@ -1,63 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_TETGENIO_TO_TETMESH_H
-#define IGL_TETGEN_TETGENIO_TO_TETMESH_H
-#include "../igl_inline.h"
-
-#ifndef TETLIBRARY
-#define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined tetgenio, REAL
-#include <vector>
-#include <Eigen/Core>
-namespace igl
-{
-  namespace tetgen
-  {
-    // Extract a tetrahedral mesh from a tetgenio object
-    // Inputs:
-    //   out tetgenio output object
-    // Outputs:
-    //   V  #V by 3 vertex position list
-    //   T  #T by 4 list of tetrahedra indices into V
-    //   F  #F by 3 list of marked facets
-    // Returns true on success, false on error
-    IGL_INLINE bool tetgenio_to_tetmesh(
-      const tetgenio & out,
-      std::vector<std::vector<REAL > > & V, 
-      std::vector<std::vector<int> > & T,
-      std::vector<std::vector<int> > & F);
-    IGL_INLINE bool tetgenio_to_tetmesh(
-      const tetgenio & out,
-      std::vector<std::vector<REAL > > & V, 
-      std::vector<std::vector<int> > & T);
-    
-    // Wrapper with Eigen types
-    // Templates:
-    //   DerivedV  real-value: i.e. from MatrixXd
-    //   DerivedT  integer-value: i.e. from MatrixXi
-    template <typename DerivedV, typename DerivedT, typename DerivedF>
-    IGL_INLINE bool tetgenio_to_tetmesh(
-      const tetgenio & out,
-      Eigen::PlainObjectBase<DerivedV>& V,
-      Eigen::PlainObjectBase<DerivedT>& T,
-      Eigen::PlainObjectBase<DerivedF>& F);
-    template <typename DerivedV, typename DerivedT>
-    IGL_INLINE bool tetgenio_to_tetmesh(
-      const tetgenio & out,
-      Eigen::PlainObjectBase<DerivedV>& V,
-      Eigen::PlainObjectBase<DerivedT>& T);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "tetgenio_to_tetmesh.cpp"
-#endif
-
-#endif

+ 0 - 77
include/igl/tetgen/tetrahedralize.h

@@ -1,77 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_TETRAHEDRALIZE_H
-#define IGL_TETGEN_TETRAHEDRALIZE_H
-#include "../igl_inline.h"
-
-#include <vector>
-#include <string>
-#include <Eigen/Core>
-#ifndef TETLIBRARY
-#define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined REAL
-
-namespace igl
-{
-  namespace tetgen
-  {
-    // Mesh the interior of a surface mesh (V,F) using tetgen
-    //
-    // Inputs:
-    //   V  #V by 3 vertex position list
-    //   F  #F list of polygon face indices into V (0-indexed)
-    //   switches  string of tetgen options (See tetgen documentation) e.g.
-    //     "pq1.414a0.01" tries to mesh the interior of a given surface with
-    //       quality and area constraints
-    //     "" will mesh the convex hull constrained to pass through V (ignores F)
-    // Outputs:
-    //   TV  #V by 3 vertex position list
-    //   TT  #T by 4 list of tet face indices
-    //   TF  #F by 3 list of triangle face indices
-    // Returns status:
-    //   0 success
-    //   1 tetgen threw exception
-    //   2 tetgen did not crash but could not create any tets (probably there are
-    //     holes, duplicate faces etc.)
-    //   -1 other error
-    IGL_INLINE int tetrahedralize(
-      const std::vector<std::vector<REAL > > & V, 
-      const std::vector<std::vector<int> > & F, 
-      const std::string switches,
-      std::vector<std::vector<REAL > > & TV, 
-      std::vector<std::vector<int > > & TT, 
-      std::vector<std::vector<int> > & TF);
-    
-    // Wrapper with Eigen types
-    // Templates:
-    //   DerivedV  real-value: i.e. from MatrixXd
-    //   DerivedF  integer-value: i.e. from MatrixXi
-    template <
-      typename DerivedV, 
-      typename DerivedF, 
-      typename DerivedTV, 
-      typename DerivedTT, 
-      typename DerivedTF>
-    IGL_INLINE int tetrahedralize(
-      const Eigen::PlainObjectBase<DerivedV>& V,
-      const Eigen::PlainObjectBase<DerivedF>& F,
-      const std::string switches,
-      Eigen::PlainObjectBase<DerivedTV>& TV,
-      Eigen::PlainObjectBase<DerivedTT>& TT,
-      Eigen::PlainObjectBase<DerivedTF>& TF);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "tetrahedralize.cpp"
-#endif
-
-#endif
-

+ 1 - 1
include/igl/triangle_triangle_adjacency.cpp

@@ -241,5 +241,5 @@ template void igl::triangle_triangle_adjacency<Eigen::Matrix<double, -1, -1, 0,
 template void igl::triangle_triangle_adjacency<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
 template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long, long, long>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > const&, bool, std::vector<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >, std::allocator<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > > >&, std::vector<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >, std::allocator<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > > >&);
-template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned long, int, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::__1::vector<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >, std::__1::allocator<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > > > const&, bool, std::__1::vector<std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > >, std::__1::allocator<std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > > >&, std::__1::vector<std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > >, std::__1::allocator<std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > > >&);
+template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned long, int, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, bool, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&);
 #endif

+ 1 - 1
include/igl/unique_edge_map.cpp

@@ -51,5 +51,5 @@ template void igl::unique_edge_map<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen:
 template void igl::unique_edge_map<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
 template void igl::unique_edge_map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&);
 template void igl::unique_edge_map<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
-template void igl::unique_edge_map<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned long>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, std::__1::vector<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >, std::__1::allocator<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > > >&);
+template void igl::unique_edge_map<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned long>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&);
 #endif 

+ 1 - 1
optional/CMakeLists.txt

@@ -283,7 +283,7 @@ endif (PNG_FOUND AND YIMG_FOUND AND OPENGL_FOUND)
 #### Compile the tetgen part
 if (TETGEN_FOUND)
   file(GLOB SOURCES_TETGEN
-    "${PROJECT_SOURCE_DIR}/../include/igl/tetgen/*.cpp"
+    "${PROJECT_SOURCE_DIR}/../include/igl/copyleft/tetgen/*.cpp"
   )
 
   add_library(igltetgen STATIC ${SOURCES_TETGEN})

+ 29 - 5
style-guidelines.md

@@ -171,8 +171,8 @@ Eigen and stl. These functions should have the `igl::` namespace.
 
 Functions with other dependencies should be placed into
 appropriate sub-directories (e.g. if `myfunction` depends on tetgen then create
-`igl/tetgen/myfunction.h` and `igl/tetgen/myfunction.cpp` and give the function
-the namespace `igl::tetgen::myfunction`.
+`igl/copyleft/tetgen/myfunction.h` and `igl/copyleft/tetgen/myfunction.cpp` and give the function
+the namespace `igl::copyleft::tetgen::myfunction`.
 
 ### copyleft subdirectory/namespace 
 
@@ -192,11 +192,11 @@ assert(m < n && "m must be less than n");
 
 Every header file should be wrapped in an `#ifndef` compiler directive. The
 name of the guard should be in direct correspondence with the path of the .h
-file. For example, `include/igl/tetgen/tetrahedralize.h` should be
+file. For example, `include/igl/copyleft/tetgen/tetrahedralize.h` should be
 
 ```cpp
-#ifndef IGL_TETGEN_TETRAHEDRALIZE_H
-#define IGL_TETGEN_TETRAHEDRALIZE_H
+#ifndef IGL_COPYLEFT_TETGEN_TETRAHEDRALIZE_H
+#define IGL_COPYLEFT_TETGEN_TETRAHEDRALIZE_H
 ...
 #endif
 ```
@@ -210,6 +210,30 @@ Do not use tabs. Use 2 spaces for each indentation level.
 Limit lines to 80 characters. Break up long lines into many operations (this
 also helps performance).
 
+## Include order
+
+`#include` directives at the top of a .h or .cpp file should be sorted
+according to a simple principle: place headers of files most likely to be
+edited by you first. This means for
+`include/igl/copyleft/tetgen/tetrahedralize.cpp` you might see
+
+```cpp
+// [Includes of headers in this directory]
+#include "tetrahedralize.h"
+#include "mesh_to_tetgenio.h"
+#include "tetgenio_to_tetmesh.h"
+// [Includes of headers in this project]
+#include "../../matrix_to_list.h"
+#include "../../list_to_matrix.h"
+#include "../../boundary_facets.h"
+// [Includes of headers of related projects]
+#include <Eigen/Core>
+// [Includes of headers of standard libraries]
+#include <cassert>
+#include <iostream>
+```
+
 ## Eigen templates
 
 
+

+ 2 - 2
tutorial/605_Tetgen/main.cpp

@@ -1,5 +1,5 @@
 #include <igl/viewer/Viewer.h>
-#include <igl/tetgen/tetrahedralize.h>
+#include <igl/copyleft/tetgen/tetrahedralize.h>
 #include <igl/readOFF.h>
 #include <igl/barycenter.h>
 
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
   igl::readOFF(TUTORIAL_SHARED_PATH "/fertility.off",V,F);
 
   // Tetrahedralize the interior
-  igl::tetgen::tetrahedralize(V,F,"pq1.414Y", TV,TT,TF);
+  igl::copyleft::tetgen::tetrahedralize(V,F,"pq1.414Y", TV,TT,TF);
 
   // Compute barycenters
   igl::barycenter(TV,TT,B);

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است