Sfoglia il codice sorgente

Merge remote-tracking branch 'upstream/master' into develop

Former-commit-id: 1bf934d7a3d56e81b9fb2adc1f4a5ad1d1fce813
Qingnan Zhou 9 anni fa
parent
commit
5bbec3847e
84 ha cambiato i file con 932 aggiunte e 794 eliminazioni
  1. 11 0
      include/igl/Singular_Value_Decomposition_Preamble.hpp
  2. 2 2
      include/igl/active_set.cpp
  3. 1 0
      include/igl/angle_bound_frame_fields.cpp
  4. 3 5
      include/igl/arap_dof.cpp
  5. 8 10
      include/igl/average_onto_vertices.cpp
  6. 5 6
      include/igl/average_onto_vertices.h
  7. 3 3
      include/igl/boundary_loop.cpp
  8. 2 1
      include/igl/comb_cross_field.cpp
  9. 1 1
      include/igl/comb_frame_field.cpp
  10. 3 1
      include/igl/comb_line_field.cpp
  11. 1 1
      include/igl/comiso/frame_field.cpp
  12. 1 1
      include/igl/comiso/miq.cpp
  13. 1 1
      include/igl/comiso/nrosy.cpp
  14. 1 1
      include/igl/compute_frame_field_bisectors.cpp
  15. 229 0
      include/igl/copyleft/boolean/minkowski_sum.cpp
  16. 71 0
      include/igl/copyleft/boolean/minkowski_sum.h
  17. 29 0
      include/igl/copyleft/cgal/piecewise_constant_winding_number.cpp
  18. 41 0
      include/igl/copyleft/cgal/piecewise_constant_winding_number.h
  19. 3 42
      include/igl/copyleft/cgal/propagate_winding_numbers.cpp
  20. 5 3
      include/igl/cross_field_missmatch.cpp
  21. 2 1
      include/igl/cut_mesh.cpp
  22. 2 1
      include/igl/cut_mesh_from_singularities.cpp
  23. 2 2
      include/igl/doublearea.cpp
  24. 15 6
      include/igl/embree/EmbreeIntersector.h
  25. 1 1
      include/igl/find_cross_field_singularities.cpp
  26. 0 21
      include/igl/fit_rigid.cpp
  27. 0 37
      include/igl/fit_rigid.h
  28. 0 44
      include/igl/full.cpp
  29. 0 41
      include/igl/full.h
  30. 2 3
      include/igl/grad.cpp
  31. 4 3
      include/igl/is_border_vertex.cpp
  32. 18 16
      include/igl/lim/lim.cpp
  33. 16 17
      include/igl/lim/lim.h
  34. 2 1
      include/igl/line_field_missmatch.cpp
  35. 26 55
      include/igl/list_to_matrix.cpp
  36. 13 11
      include/igl/list_to_matrix.h
  37. 0 159
      include/igl/lu_lagrange.cpp
  38. 0 67
      include/igl/lu_lagrange.h
  39. 16 27
      include/igl/matlab/prepare_lhs.cpp
  40. 2 4
      include/igl/min_quad_with_fixed.cpp
  41. 7 4
      include/igl/mod.cpp
  42. 1 1
      include/igl/mod.h
  43. 1 0
      include/igl/n_polyvector.cpp
  44. 1 0
      include/igl/n_polyvector_general.cpp
  45. 16 9
      include/igl/per_corner_normals.cpp
  46. 10 5
      include/igl/per_corner_normals.h
  47. 1 1
      include/igl/per_edge_normals.cpp
  48. 2 0
      include/igl/per_face_normals.cpp
  49. 1 1
      include/igl/per_vertex_normals.cpp
  50. 70 0
      include/igl/piecewise_constant_winding_number.cpp
  51. 49 0
      include/igl/piecewise_constant_winding_number.h
  52. 2 2
      include/igl/polar_dec.cpp
  53. 2 2
      include/igl/polar_svd.cpp
  54. 1 1
      include/igl/polar_svd3x3.cpp
  55. 1 1
      include/igl/polyvector_field_comb_from_matchings_and_cuts.cpp
  56. 1 1
      include/igl/polyvector_field_cut_mesh_with_singularities.cpp
  57. 2 1
      include/igl/polyvector_field_matchings.cpp
  58. 1 1
      include/igl/polyvector_field_singularities_from_matchings.cpp
  59. 9 9
      include/igl/project_to_line.cpp
  60. 9 9
      include/igl/project_to_line_segment.cpp
  61. 8 8
      include/igl/randperm.cpp
  62. 2 2
      include/igl/randperm.h
  63. 1 1
      include/igl/remove_duplicate_vertices.cpp
  64. 11 11
      include/igl/slice.cpp
  65. 7 2
      include/igl/slice.h
  66. 4 4
      include/igl/slice_mask.cpp
  67. 7 3
      include/igl/slice_mask.h
  68. 4 0
      include/igl/sort.cpp
  69. 36 65
      include/igl/triangle_triangle_adjacency.cpp
  70. 13 30
      include/igl/triangle_triangle_adjacency.h
  71. 1 1
      include/igl/unique.cpp
  72. 1 0
      include/igl/vertex_triangle_adjacency.cpp
  73. 3 2
      include/igl/viewer/Viewer.cpp
  74. 1 1
      include/igl/volume.cpp
  75. 76 3
      style-guidelines.md
  76. 12 8
      tutorial/106_ViewerMenu/main.cpp
  77. 1 1
      tutorial/510_Integrable/main.cpp
  78. 7 7
      tutorial/608_LIM/main.cpp
  79. 1 0
      tutorial/609_Boolean/CMakeLists.txt
  80. 1 0
      tutorial/610_CSGTree/CMakeLists.txt
  81. 1 1
      tutorial/610_CSGTree/main.cpp
  82. 1 0
      tutorial/CMakeLists.txt
  83. 3 0
      tutorial/cmake/FindLIM.cmake
  84. 1 1
      tutorial/tutorial.md.REMOVED.git-id

+ 11 - 0
include/igl/Singular_Value_Decomposition_Preamble.hpp

@@ -19,6 +19,17 @@
 #include <iostream>
 #include <iostream>
 #endif
 #endif
 
 
+// Prevent warnings
+#ifdef ENABLE_SCALAR_IMPLEMENTATION
+#  undef ENABLE_SCALAR_IMPLEMENTATION
+#endif
+#ifdef ENABLE_SSE_IMPLEMENTATION
+#  undef ENABLE_SSE_IMPLEMENTATION
+#endif
+#ifdef ENABLE_AVX_IMPLEMENTATION
+#  undef ENABLE_AVX_IMPLEMENTATION
+#endif
+
 #ifdef USE_SCALAR_IMPLEMENTATION
 #ifdef USE_SCALAR_IMPLEMENTATION
 #define ENABLE_SCALAR_IMPLEMENTATION(X) X
 #define ENABLE_SCALAR_IMPLEMENTATION(X) X
 #else
 #else

+ 2 - 2
include/igl/active_set.cpp

@@ -67,8 +67,8 @@ IGL_INLINE igl::SolverStatus igl::active_set(
   assert((Aieq.size() == 0 && Bieq.size() == 0) || Aieq.cols() == n);
   assert((Aieq.size() == 0 && Bieq.size() == 0) || Aieq.cols() == n);
   assert((Aieq.size() == 0 && Bieq.size() == 0) || Aieq.rows() == Bieq.rows());
   assert((Aieq.size() == 0 && Bieq.size() == 0) || Aieq.rows() == Bieq.rows());
   assert((Aieq.size() == 0 && Bieq.size() == 0) || Bieq.cols() == 1);
   assert((Aieq.size() == 0 && Bieq.size() == 0) || Bieq.cols() == 1);
-  Eigen::PlainObjectBase<Derivedlx> lx;
-  Eigen::PlainObjectBase<Derivedux> ux;
+  Eigen::Matrix<typename Derivedlx::Scalar,Eigen::Dynamic,1> lx;
+  Eigen::Matrix<typename Derivedux::Scalar,Eigen::Dynamic,1> ux;
   if(p_lx.size() == 0)
   if(p_lx.size() == 0)
   {
   {
     lx = Eigen::PlainObjectBase<Derivedlx>::Constant(
     lx = Eigen::PlainObjectBase<Derivedlx>::Constant(

+ 1 - 0
include/igl/angle_bound_frame_fields.cpp

@@ -38,6 +38,7 @@ namespace igl {
       Eigen::VectorXi indInteriorToFull;
       Eigen::VectorXi indInteriorToFull;
       Eigen::VectorXi indFullToInterior;
       Eigen::VectorXi indFullToInterior;
 
 
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
       Eigen::PlainObjectBase<DerivedV> B1, B2, FN;
       Eigen::PlainObjectBase<DerivedV> B1, B2, FN;
 
 
       //laplacians
       //laplacians

+ 3 - 5
include/igl/arap_dof.cpp

@@ -14,7 +14,6 @@
 #include "repmat.h"
 #include "repmat.h"
 #include "slice.h"
 #include "slice.h"
 #include "colon.h"
 #include "colon.h"
-#include "full.h"
 #include "is_sparse.h"
 #include "is_sparse.h"
 #include "mode.h"
 #include "mode.h"
 #include "is_symmetric.h"
 #include "is_symmetric.h"
@@ -203,9 +202,8 @@ IGL_INLINE bool igl::arap_dof_precomputation(
       if(is_sparse(CSMjM_i))
       if(is_sparse(CSMjM_i))
       {
       {
         // Convert to full
         // Convert to full
-        MatrixXd CSMjM_ifull;
         //printf("CSM_M(): full\n");
         //printf("CSM_M(): full\n");
-        full(CSMjM_i,CSMjM_ifull);
+        MatrixXd CSMjM_ifull(CSMjM_i);
 //        printf("CSM_M[%d]: %d %d\n",i,data.CSM_M[i].rows(),data.CSM_M[i].cols());
 //        printf("CSM_M[%d]: %d %d\n",i,data.CSM_M[i].rows(),data.CSM_M[i].cols());
 //        printf("CSM_M[%d].block(%d*%d=%d,0,%d,%d): %d %d\n",i,j,k,CSMjM_i.rows(),CSMjM_i.cols(),
 //        printf("CSM_M[%d].block(%d*%d=%d,0,%d,%d): %d %d\n",i,j,k,CSMjM_i.rows(),CSMjM_i.cols(),
 //            data.CSM_M[i].block(j*k,0,CSMjM_i.rows(),CSMjM_i.cols()).rows(),
 //            data.CSM_M[i].block(j*k,0,CSMjM_i.rows(),CSMjM_i.cols()).rows(),
@@ -546,8 +544,8 @@ IGL_INLINE bool igl::arap_dof_recomputation(
 
 
   // Compute dense solve matrix (alternative of matrix factorization)
   // Compute dense solve matrix (alternative of matrix factorization)
   //printf("min_quad_dense_precompute()\n");
   //printf("min_quad_dense_precompute()\n");
-  MatrixXd Qfull; full(*Q, Qfull);  
-  MatrixXd A_eqfull; full(A_eq, A_eqfull);
+  MatrixXd Qfull(*Q);
+  MatrixXd A_eqfull(A_eq);
   MatrixXd M_Solve;
   MatrixXd M_Solve;
 
 
   double timer0_start = get_seconds_hires();
   double timer0_start = get_seconds_hires();

+ 8 - 10
include/igl/average_onto_vertices.cpp

@@ -7,15 +7,15 @@
 // obtain one at http://mozilla.org/MPL/2.0/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "average_onto_vertices.h"
 #include "average_onto_vertices.h"
 
 
-template <typename T, typename I>
-IGL_INLINE void igl::average_onto_vertices(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &V,
-            const Eigen::Matrix<I, Eigen::Dynamic, Eigen::Dynamic> &F,
-            const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &S,
-            Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &SV)
+template<typename DerivedV,typename DerivedF,typename DerivedS>
+IGL_INLINE void igl::average_onto_vertices(const Eigen::MatrixBase<DerivedV> &V,
+  const Eigen::MatrixBase<DerivedF> &F,
+  const Eigen::MatrixBase<DerivedS> &S,
+  Eigen::MatrixBase<DerivedS> &SV)
 {
 {
-
-  SV = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>::Zero(V.rows(),S.cols());
-  Eigen::Matrix<T, Eigen::Dynamic, 1> COUNT = Eigen::Matrix<T, Eigen::Dynamic, 1>::Zero(V.rows());
+  SV = DerivedS::Zero(V.rows(),S.cols());
+  Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,1> COUNT(V.rows());
+  COUNT.setZero();
   for (int i = 0; i <F.rows(); ++i)
   for (int i = 0; i <F.rows(); ++i)
   {
   {
     for (int j = 0; j<F.cols(); ++j)
     for (int j = 0; j<F.cols(); ++j)
@@ -26,10 +26,8 @@ IGL_INLINE void igl::average_onto_vertices(const Eigen::Matrix<T, Eigen::Dynamic
   }
   }
   for (int i = 0; i <V.rows(); ++i)
   for (int i = 0; i <V.rows(); ++i)
     SV.row(i) /= COUNT[i];
     SV.row(i) /= COUNT[i];
-
 };
 };
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
-template void igl::average_onto_vertices<double, int>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
 #endif
 #endif

+ 5 - 6
include/igl/average_onto_vertices.h

@@ -21,12 +21,11 @@ namespace igl
   // 
   // 
   // Output:
   // Output:
   // SV: scalar field defined on vertices
   // SV: scalar field defined on vertices
-  template <typename T, typename I>
-  IGL_INLINE void average_onto_vertices(
-    const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &V,
-    const Eigen::Matrix<I, Eigen::Dynamic, Eigen::Dynamic> &F,
-    const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &S,
-    Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &SV);
+  template<typename DerivedV,typename DerivedF,typename DerivedS>
+  IGL_INLINE void average_onto_vertices(const Eigen::MatrixBase<DerivedV> &V,
+    const Eigen::MatrixBase<DerivedF> &F,
+    const Eigen::MatrixBase<DerivedS> &S,
+    Eigen::MatrixBase<DerivedS> &SV);
 }
 }
 
 
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY

+ 3 - 3
include/igl/boundary_loop.cpp

@@ -23,10 +23,10 @@ IGL_INLINE void igl::boundary_loop(
   if(F.rows() == 0)
   if(F.rows() == 0)
     return;
     return;
 
 
-  MatrixXd Vdummy(F.maxCoeff()+1,1);
-  MatrixXi TT,TTi;
+  VectorXd Vdummy(F.maxCoeff()+1,1);
+  DerivedF TT,TTi;
   vector<std::vector<int> > VF, VFi;
   vector<std::vector<int> > VF, VFi;
-  triangle_triangle_adjacency(Vdummy,F,TT,TTi);
+  triangle_triangle_adjacency(F,TT,TTi);
   vertex_triangle_adjacency(Vdummy,F,VF,VFi);
   vertex_triangle_adjacency(Vdummy,F,VF,VFi);
 
 
   vector<bool> unvisited = is_border_vertex(Vdummy,F);
   vector<bool> unvisited = is_border_vertex(Vdummy,F);

+ 2 - 1
include/igl/comb_cross_field.cpp

@@ -27,6 +27,7 @@ namespace igl {
     const Eigen::PlainObjectBase<DerivedF> &F;
     const Eigen::PlainObjectBase<DerivedF> &F;
     const Eigen::PlainObjectBase<DerivedV> &PD1;
     const Eigen::PlainObjectBase<DerivedV> &PD1;
     const Eigen::PlainObjectBase<DerivedV> &PD2;
     const Eigen::PlainObjectBase<DerivedV> &PD2;
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedV> N;
     Eigen::PlainObjectBase<DerivedV> N;
 
 
   private:
   private:
@@ -72,7 +73,7 @@ namespace igl {
     PD2(_PD2)
     PD2(_PD2)
     {
     {
       igl::per_face_normals(V,F,N);
       igl::per_face_normals(V,F,N);
-      igl::triangle_triangle_adjacency(V,F,TT,TTi);
+      igl::triangle_triangle_adjacency(F,TT,TTi);
     }
     }
     inline void comb(Eigen::PlainObjectBase<DerivedV> &PD1out,
     inline void comb(Eigen::PlainObjectBase<DerivedV> &PD1out,
               Eigen::PlainObjectBase<DerivedV> &PD2out)
               Eigen::PlainObjectBase<DerivedV> &PD2out)

+ 1 - 1
include/igl/comb_frame_field.cpp

@@ -24,7 +24,7 @@ IGL_INLINE void igl::comb_frame_field(const Eigen::PlainObjectBase<DerivedV> &V,
                                       Eigen::PlainObjectBase<DerivedP> &PD1_combed,
                                       Eigen::PlainObjectBase<DerivedP> &PD1_combed,
                                       Eigen::PlainObjectBase<DerivedP> &PD2_combed)
                                       Eigen::PlainObjectBase<DerivedP> &PD2_combed)
 {
 {
-  Eigen::PlainObjectBase<DerivedV> B1, B2, B3;
+  DerivedV B1, B2, B3;
   igl::local_basis(V,F,B1,B2,B3);
   igl::local_basis(V,F,B1,B2,B3);
 
 
   PD1_combed.resize(BIS1_combed.rows(),3);
   PD1_combed.resize(BIS1_combed.rows(),3);

+ 3 - 1
include/igl/comb_line_field.cpp

@@ -25,10 +25,12 @@ public:
     const Eigen::PlainObjectBase<DerivedV> &V;
     const Eigen::PlainObjectBase<DerivedV> &V;
     const Eigen::PlainObjectBase<DerivedF> &F;
     const Eigen::PlainObjectBase<DerivedF> &F;
     const Eigen::PlainObjectBase<DerivedV> &PD1;
     const Eigen::PlainObjectBase<DerivedV> &PD1;
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedV> N;
     Eigen::PlainObjectBase<DerivedV> N;
 
 
 private:
 private:
     // internal
     // internal
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedF> TT;
     Eigen::PlainObjectBase<DerivedF> TT;
     Eigen::PlainObjectBase<DerivedF> TTi;
     Eigen::PlainObjectBase<DerivedF> TTi;
 
 
@@ -65,7 +67,7 @@ public:
         PD1(_PD1)
         PD1(_PD1)
     {
     {
         igl::per_face_normals(V,F,N);
         igl::per_face_normals(V,F,N);
-        igl::triangle_triangle_adjacency(V,F,TT,TTi);
+        igl::triangle_triangle_adjacency(F,TT,TTi);
     }
     }
 
 
     inline void comb(Eigen::PlainObjectBase<DerivedV> &PD1out)
     inline void comb(Eigen::PlainObjectBase<DerivedV> &PD1out)

+ 1 - 1
include/igl/comiso/frame_field.cpp

@@ -115,7 +115,7 @@ FrameInterpolator::FrameInterpolator(const Eigen::MatrixXd& _V, const Eigen::Mat
 
 
 
 
   // Generate topological relations
   // Generate topological relations
-  igl::triangle_triangle_adjacency(V,F,TT,TTi);
+  igl::triangle_triangle_adjacency(F,TT,TTi);
   igl::edge_topology(V,F, EV, FE, EF);
   igl::edge_topology(V,F, EV, FE, EF);
 
 
   // Flag border edges
   // Flag border edges

+ 1 - 1
include/igl/comiso/miq.cpp

@@ -1191,7 +1191,7 @@ F(F_)
   igl::cut_mesh(V, F, Handle_Seams, Vcut, Fcut);
   igl::cut_mesh(V, F, Handle_Seams, Vcut, Fcut);
 
 
   igl::local_basis(V,F,B1,B2,B3);
   igl::local_basis(V,F,B1,B2,B3);
-  igl::triangle_triangle_adjacency(V,F,TT,TTi);
+  igl::triangle_triangle_adjacency(F,TT,TTi);
 
 
   // Prepare indexing for the linear system
   // Prepare indexing for the linear system
   VertexIndexing<DerivedV, DerivedF> VInd(V, F, Vcut, Fcut, TT, TTi, Handle_MMatch, Handle_Singular, Handle_Seams);
   VertexIndexing<DerivedV, DerivedF> VInd(V, F, Vcut, Fcut, TT, TTi, Handle_MMatch, Handle_Singular, Handle_Seams);

+ 1 - 1
include/igl/comiso/nrosy.cpp

@@ -165,7 +165,7 @@ igl::comiso::NRosyField::NRosyField(const Eigen::MatrixXd& _V, const Eigen::Matr
 
 
 
 
   // Generate topological relations
   // Generate topological relations
-  igl::triangle_triangle_adjacency(V,F,TT,TTi);
+  igl::triangle_triangle_adjacency(F,TT,TTi);
   igl::edge_topology(V,F, EV, FE, EF);
   igl::edge_topology(V,F, EV, FE, EF);
 
 
   // Flag border edges
   // Flag border edges

+ 1 - 1
include/igl/compute_frame_field_bisectors.cpp

@@ -70,7 +70,7 @@ IGL_INLINE void igl::compute_frame_field_bisectors(
                                                    Eigen::PlainObjectBase<DerivedV>& BIS1,
                                                    Eigen::PlainObjectBase<DerivedV>& BIS1,
                                                    Eigen::PlainObjectBase<DerivedV>& BIS2)
                                                    Eigen::PlainObjectBase<DerivedV>& BIS2)
 {
 {
-  Eigen::PlainObjectBase<DerivedV> B1, B2, B3;
+  DerivedV B1, B2, B3;
   igl::local_basis(V,F,B1,B2,B3);
   igl::local_basis(V,F,B1,B2,B3);
 
 
   compute_frame_field_bisectors( V, F, B1, B2, PD1, PD2, BIS1, BIS2);
   compute_frame_field_bisectors( V, F, B1, B2, PD1, PD2, BIS1, BIS2);

+ 229 - 0
include/igl/copyleft/boolean/minkowski_sum.cpp

@@ -0,0 +1,229 @@
+#include "minkowski_sum.h"
+#include "mesh_boolean.h"
+
+#include "../../slice_mask.h"
+#include "../../unique.h"
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+
+template <
+  typename DerivedVA,
+  typename DerivedFA,
+  typename Deriveds,
+  typename Derivedd,
+  typename DerivedW,
+  typename DerivedG,
+  typename DerivedJ>
+IGL_INLINE void igl::copyleft::boolean::minkowski_sum(
+  const Eigen::PlainObjectBase<DerivedVA> & VA,
+  const Eigen::PlainObjectBase<DerivedFA> & FA,
+  const Eigen::PlainObjectBase<Deriveds> & s,
+  const Eigen::PlainObjectBase<Derivedd> & d,
+  const bool resolve_overlaps, 
+  Eigen::PlainObjectBase<DerivedW> & W,
+  Eigen::PlainObjectBase<DerivedG> & G,
+  Eigen::PlainObjectBase<DerivedJ> & J)
+{
+  using namespace Eigen;
+  using namespace std;
+  // silly base case
+  if(FA.size() == 0)
+  {
+    W.resize(0,3);
+    G.resize(0,3);
+    return;
+  }
+  const int dim = VA.cols();
+  assert(dim == 3 && "dim must be 3D");
+  assert(s.size() == 3 && "s must be 3D point");
+  assert(d.size() == 3 && "d must be 3D point");
+  // segment vector
+  const CGAL::Vector_3<CGAL::Epeck> v(d(0)-s(0),d(1)-s(1),d(2)-s(2));
+  // number of vertices
+  const int n = VA.rows();
+  // duplicate vertices at s and d, we'll remove unreferernced later
+  DerivedW WW(2*n,dim);
+  for(int i = 0;i<n;i++)
+  {
+    for(int j = 0;j<dim;j++)
+    {
+      WW  (i,j) = VA(i,j) + s(j);
+      WW(i+n,j) = VA(i,j) + d(j);
+    }
+  }
+  // number of faces
+  const int m = FA.rows();
+  // Mask whether positive dot product, or negative: because of exactly zero,
+  // these are not necessarily complementary
+  Matrix<bool,Dynamic,1> P(m,1),N(m,1);
+  // loop over faces
+  int mp = 0,mn = 0;
+  for(int f = 0;f<m;f++)
+  {
+    const CGAL::Plane_3<CGAL::Epeck> plane(
+      CGAL::Point_3<CGAL::Epeck>(VA(FA(f,0),0),VA(FA(f,0),1),VA(FA(f,0),2)),
+      CGAL::Point_3<CGAL::Epeck>(VA(FA(f,1),0),VA(FA(f,1),1),VA(FA(f,1),2)),
+      CGAL::Point_3<CGAL::Epeck>(VA(FA(f,2),0),VA(FA(f,2),1),VA(FA(f,2),2)));
+    const auto normal = plane.orthogonal_vector();
+    const auto dt = normal * v;
+    if(dt > 0)
+    {
+      P(f) = true;
+      N(f) = false;
+      mp++;
+    }else if(dt < 0)
+    {
+      P(f) = false;
+      N(f) = true;
+      mn++;
+    }else
+    {
+      P(f) = false;
+      N(f) = false;
+    }
+  }
+
+  typedef Matrix<typename DerivedG::Scalar,Dynamic,Dynamic> MatrixXI;
+  typedef Matrix<typename DerivedG::Scalar,Dynamic,1> VectorXI;
+  MatrixXI GT(mp+mn,3);
+  GT<< slice_mask(FA,N,1), slice_mask((FA.array()+n).eval(),P,1);
+  // J indexes FA for parts at s and m+FA for parts at d
+  J = DerivedJ::LinSpaced(m,0,m-1);
+  DerivedJ JT(mp+mn);
+  JT << slice_mask(J,P,1), slice_mask(J,N,1);
+  JT.block(mp,0,mn,1).array()+=m;
+
+  // Original non-co-planar faces with positively oriented reversed
+  MatrixXI BA(mp+mn,3);
+  BA << slice_mask(FA,P,1).rowwise().reverse(), slice_mask(FA,N,1);
+  // Quads along **all** sides
+  MatrixXI GQ((mp+mn)*3,4);
+  GQ<< 
+    BA.col(1), BA.col(0), BA.col(0).array()+n, BA.col(1).array()+n,
+    BA.col(2), BA.col(1), BA.col(1).array()+n, BA.col(2).array()+n,
+    BA.col(0), BA.col(2), BA.col(2).array()+n, BA.col(0).array()+n;
+
+  MatrixXI uGQ;
+  VectorXI S,sI,sJ;
+  //const auto & total_signed_distance = 
+  [](
+      const MatrixXI & F,
+      VectorXI & S,
+      MatrixXI & uF,
+      VectorXI & I,
+      VectorXI & J)
+  {
+    const int m = F.rows();
+    const int d = F.cols();
+    MatrixXI sF = F;
+    const auto MN = sF.rowwise().minCoeff().eval();
+    // rotate until smallest index is first
+    for(int p = 0;p<d;p++)
+    {
+      for(int f = 0;f<m;f++)
+      {
+        if(sF(f,0) != MN(f))
+        {
+          for(int r = 0;r<d-1;r++)
+          {
+            std::swap(sF(f,r),sF(f,r+1));
+          }
+        }
+      }
+    }
+    // swap orienation
+    for(int f = 0;f<m;f++)
+    {
+      if(sF(f,d-1) < sF(f,1))
+      {
+        sF.block(f,1,1,d-1) = sF.block(f,1,1,d-1).reverse().eval();
+      }
+    }
+    Matrix<bool,Dynamic,1> M = Matrix<bool,Dynamic,1>::Zero(m,1);
+    {
+      VectorXI P = VectorXI::LinSpaced(d,0,d-1);
+      for(int p = 0;p<d;p++)
+      {
+        for(int f = 0;f<m;f++)
+        {
+          bool all = true;
+          for(int r = 0;r<d;r++)
+          {
+            all = all && (sF(f,P(r)) == F(f,r));
+          }
+          M(f) = M(f) || all;
+        }
+        for(int r = 0;r<d-1;r++)
+        {
+          std::swap(P(r),P(r+1));
+        }
+      }
+    }
+    unique_rows(sF,uF,I,J);
+    S = VectorXI::Zero(uF.rows(),1);
+    assert(m == J.rows());
+    for(int f = 0;f<m;f++)
+    {
+      S(J(f)) += M(f) ? 1 : -1;
+    }
+  }(MatrixXI(GQ),S,uGQ,sI,sJ);
+  assert(S.rows() == uGQ.rows());
+  const int nq = (S.array().abs()==2).count();
+  GQ.resize(nq,4);
+  {
+    int k = 0;
+    for(int q = 0;q<uGQ.rows();q++)
+    {
+      switch(S(q))
+      {
+        case -2:
+          GQ.row(k++) = uGQ.row(q).reverse().eval();
+          break;
+        case 2:
+          GQ.row(k++) = uGQ.row(q);
+          break;
+        default:
+        // do not add
+          break;
+      }
+    }
+    assert(nq == k);
+  }
+
+  MatrixXI GG(GT.rows()+2*GQ.rows(),3);
+  GG<< 
+    GT,
+    GQ.col(0), GQ.col(1), GQ.col(2), 
+    GQ.col(0), GQ.col(2), GQ.col(3);
+  J.resize(JT.rows()+2*GQ.rows(),1);
+  J<<JT,DerivedJ::Constant(2*GQ.rows(),1,2*m+1);
+  if(resolve_overlaps)
+  {
+    DerivedJ SJ;
+    mesh_boolean(
+      WW,GG,
+      Matrix<typename DerivedVA::Scalar,Dynamic,Dynamic>(),MatrixXI(),
+      MESH_BOOLEAN_TYPE_UNION,
+      W,G,SJ);
+    J = slice(DerivedJ(J),SJ,1);
+  }
+}
+
+template <
+  typename DerivedVA,
+  typename DerivedFA,
+  typename Deriveds,
+  typename Derivedd,
+  typename DerivedW,
+  typename DerivedG,
+  typename DerivedJ>
+IGL_INLINE void igl::copyleft::boolean::minkowski_sum(
+  const Eigen::PlainObjectBase<DerivedVA> & VA,
+  const Eigen::PlainObjectBase<DerivedFA> & FA,
+  const Eigen::PlainObjectBase<Deriveds> & s,
+  const Eigen::PlainObjectBase<Derivedd> & d,
+  Eigen::PlainObjectBase<DerivedW> & W,
+  Eigen::PlainObjectBase<DerivedG> & G,
+  Eigen::PlainObjectBase<DerivedJ> & J)
+{
+  return minkowski_sum(VA,FA,s,d,true,W,G,J);
+}

+ 71 - 0
include/igl/copyleft/boolean/minkowski_sum.h

@@ -0,0 +1,71 @@
+#ifndef IGL_COPYLEFT_CGAL_MINKOWSKI_SUM_H
+#define IGL_COPYLEFT_CGAL_MINKOWSKI_SUM_H
+
+#include "../../igl_inline.h"
+#include <Eigen/Core>
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace boolean
+    {
+      // Compute the Minkowski sum of a closed triangle mesh (V,F) and a
+      // segment [s,d] in 3D.
+      //
+      // Inputs:
+      //   VA  #VA by 3 list of mesh vertices in 3D
+      //   FA  #FA by 3 list of triangle indices into VA
+      //   s  segment source endpoint in 3D
+      //   d  segment source endpoint in 3D
+      //   resolve_overlaps  whether or not to resolve self-union. If false
+      //     then result may contain self-intersections if input mesh is
+      //     non-convex.
+      // Outputs:
+      //   W  #W by 3 list of mesh vertices in 3D
+      //   G  #G by 3 list of triangle indices into W
+      //   J  #G list of indices into [F;#V+F;[s d]] of birth parents
+      //
+      template <
+        typename DerivedVA,
+        typename DerivedFA,
+        typename Deriveds,
+        typename Derivedd,
+        typename DerivedW,
+        typename DerivedG,
+        typename DerivedJ>
+      IGL_INLINE void minkowski_sum(
+        const Eigen::PlainObjectBase<DerivedVA> & VA,
+        const Eigen::PlainObjectBase<DerivedFA> & FA,
+        const Eigen::PlainObjectBase<Deriveds> & s,
+        const Eigen::PlainObjectBase<Derivedd> & d,
+        const bool resolve_overlaps,
+        Eigen::PlainObjectBase<DerivedW> & W,
+        Eigen::PlainObjectBase<DerivedG> & G,
+        Eigen::PlainObjectBase<DerivedJ> & J);
+      template <
+        typename DerivedVA,
+        typename DerivedFA,
+        typename Deriveds,
+        typename Derivedd,
+        typename DerivedW,
+        typename DerivedG,
+        typename DerivedJ>
+      IGL_INLINE void minkowski_sum(
+        const Eigen::PlainObjectBase<DerivedVA> & VA,
+        const Eigen::PlainObjectBase<DerivedFA> & FA,
+        const Eigen::PlainObjectBase<Deriveds> & s,
+        const Eigen::PlainObjectBase<Derivedd> & d,
+        Eigen::PlainObjectBase<DerivedW> & W,
+        Eigen::PlainObjectBase<DerivedG> & G,
+        Eigen::PlainObjectBase<DerivedJ> & J);
+
+    }
+  }
+}
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "minkowski_sum.cpp"
+#endif
+
+#endif

+ 29 - 0
include/igl/copyleft/cgal/piecewise_constant_winding_number.cpp

@@ -0,0 +1,29 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 Alec Jacobson
+// 
+// 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/.
+#include "piecewise_constant_winding_number.h"
+#include "../../piecewise_constant_winding_number.h"
+#include "remesh_self_intersections.h"
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+#include <algorithm>
+
+template < typename DerivedV, typename DerivedF>
+IGL_INLINE bool igl::piecewise_constant_winding_number(
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::PlainObjectBase<DerivedF> & F)
+{
+  Eigen::Matrix<CGAL::Epeck::FT,Eigen::Dynamic,3> VV;
+  Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,3> FF;
+  Eigen::Matrix<typename DerivedF::Index,Eigen::Dynamic,2> IF;
+  Eigen::Matrix<typename DerivedF::Index,Eigen::Dynamic,1> J;
+  Eigen::Matrix<typename DerivedV::Index,Eigen::Dynamic,1> UIM,IM;
+  // resolve intersections
+  remesh_self_intersections(V,F,{},VV,FF,IF,J,IM);
+  // _apply_ duplicate vertex mapping IM to FF
+  for_each(FF.data(),FF.data()+FF.size(),[&IM](int & a){a=IM(a);});
+  return piecewise_constant_winding_number(FF);
+}

+ 41 - 0
include/igl/copyleft/cgal/piecewise_constant_winding_number.h

@@ -0,0 +1,41 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 Alec Jacobson
+// 
+// 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_CGAL_PIECEWISE_CONSTANT_WINDING_NUMBER_H
+#define IGL_COPYLEFT_CGAL_PIECEWISE_CONSTANT_WINDING_NUMBER_H
+#include "../../igl_inline.h"
+#include <Eigen/Core>
+#include <vector>
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace cgal
+    {
+      // PIECEWISE_CONSTANT_WINDING_NUMBER Determine if a given mesh induces a
+      // piecewise constant winding number field: Is this mesh valid input to
+      // solid set operations.
+      // 
+      // Inputs:
+      //   V  #V by 3 list of mesh vertex positions
+      //   F  #F by 3 list of triangle indices into V
+      // Returns true if the mesh _combinatorially_ induces a piecewise
+      // constant winding number field.
+      template <
+        typename DerivedV,
+        typename DerivedF>
+      IGL_INLINE bool piecewise_constant_winding_number(
+        const Eigen::PlainObjectBase<DerivedV> & V,
+        const Eigen::PlainObjectBase<DerivedF>& F);
+    }
+  }
+}
+#ifndef IGL_STATIC_LIBRARY
+#  include "piecewise_constant_winding_number.cpp"
+#endif
+#endif
+

+ 3 - 42
include/igl/copyleft/cgal/propagate_winding_numbers.cpp

@@ -11,6 +11,7 @@
 #include "../../extract_non_manifold_edge_curves.h"
 #include "../../extract_non_manifold_edge_curves.h"
 #include "../../facet_components.h"
 #include "../../facet_components.h"
 #include "../../unique_edge_map.h"
 #include "../../unique_edge_map.h"
+#include "../../piecewise_constant_winding_number.h"
 #include "../../writeOBJ.h"
 #include "../../writeOBJ.h"
 #include "../../writePLY.h"
 #include "../../writePLY.h"
 #include "../../get_seconds.h"
 #include "../../get_seconds.h"
@@ -28,47 +29,6 @@
 
 
 #define PROPAGATE_WINDING_NUMBER_TIMING
 #define PROPAGATE_WINDING_NUMBER_TIMING
 
 
-namespace propagate_winding_numbers_helper {
-  template<
-    typename DerivedF,
-    typename DeriveduE,
-    typename uE2EType >
-  bool is_orientable(
-      const Eigen::PlainObjectBase<DerivedF>& F,
-      const Eigen::PlainObjectBase<DeriveduE>& uE,
-      const std::vector<std::vector<uE2EType> >& uE2E) {
-    const size_t num_faces = F.rows();
-    const size_t num_edges = uE.rows();
-    auto edge_index_to_face_index = [&](size_t ei) {
-      return ei % num_faces;
-    };
-    auto is_consistent = [&](size_t fid, size_t s, size_t d) {
-      if ((size_t)F(fid, 0) == s && (size_t)F(fid, 1) == d) return true;
-      if ((size_t)F(fid, 1) == s && (size_t)F(fid, 2) == d) return true;
-      if ((size_t)F(fid, 2) == s && (size_t)F(fid, 0) == d) return true;
-
-      if ((size_t)F(fid, 0) == d && (size_t)F(fid, 1) == s) return false;
-      if ((size_t)F(fid, 1) == d && (size_t)F(fid, 2) == s) return false;
-      if ((size_t)F(fid, 2) == d && (size_t)F(fid, 0) == s) return false;
-      throw "Invalid face!!";
-    };
-    for (size_t i=0; i<num_edges; i++) {
-      const size_t s = uE(i,0);
-      const size_t d = uE(i,1);
-      int count=0;
-      for (const auto& ei : uE2E[i]) {
-        const size_t fid = edge_index_to_face_index(ei);
-        if (is_consistent(fid, s, d)) count++;
-        else count--;
-      }
-      if (count != 0) {
-        return false;
-      }
-    }
-    return true;
-  }
-}
-
 template<
 template<
   typename DerivedV,
   typename DerivedV,
   typename DerivedF,
   typename DerivedF,
@@ -100,7 +60,8 @@ IGL_INLINE void igl::copyleft::cgal::propagate_winding_numbers(
   Eigen::VectorXi EMAP;
   Eigen::VectorXi EMAP;
   std::vector<std::vector<size_t> > uE2E;
   std::vector<std::vector<size_t> > uE2E;
   igl::unique_edge_map(F, E, uE, EMAP, uE2E);
   igl::unique_edge_map(F, E, uE, EMAP, uE2E);
-  if (!propagate_winding_numbers_helper::is_orientable(F, uE, uE2E)) {
+  if (!piecewise_constant_winding_number(F, uE, uE2E)) 
+  {
     std::cerr << "Input mesh is not orientable!" << std::endl;
     std::cerr << "Input mesh is not orientable!" << std::endl;
   }
   }
 
 

+ 5 - 3
include/igl/cross_field_missmatch.cpp

@@ -28,6 +28,7 @@ namespace igl {
     const Eigen::PlainObjectBase<DerivedF> &F;
     const Eigen::PlainObjectBase<DerivedF> &F;
     const Eigen::PlainObjectBase<DerivedV> &PD1;
     const Eigen::PlainObjectBase<DerivedV> &PD1;
     const Eigen::PlainObjectBase<DerivedV> &PD2;
     const Eigen::PlainObjectBase<DerivedV> &PD2;
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedV> N;
     Eigen::PlainObjectBase<DerivedV> N;
 
 
   private:
   private:
@@ -35,6 +36,7 @@ namespace igl {
     std::vector<bool> V_border; // bool
     std::vector<bool> V_border; // bool
     std::vector<std::vector<int> > VF;
     std::vector<std::vector<int> > VF;
     std::vector<std::vector<int> > VFi;
     std::vector<std::vector<int> > VFi;
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedF> TT;
     Eigen::PlainObjectBase<DerivedF> TT;
     Eigen::PlainObjectBase<DerivedF> TTi;
     Eigen::PlainObjectBase<DerivedF> TTi;
 
 
@@ -88,7 +90,7 @@ public:
     igl::per_face_normals(V,F,N);
     igl::per_face_normals(V,F,N);
     V_border = igl::is_border_vertex(V,F);
     V_border = igl::is_border_vertex(V,F);
     igl::vertex_triangle_adjacency(V,F,VF,VFi);
     igl::vertex_triangle_adjacency(V,F,VF,VFi);
-    igl::triangle_triangle_adjacency(V,F,TT,TTi);
+    igl::triangle_triangle_adjacency(F,TT,TTi);
   }
   }
 
 
   inline void calculateMissmatch(Eigen::PlainObjectBase<DerivedF> &Handle_MMatch)
   inline void calculateMissmatch(Eigen::PlainObjectBase<DerivedF> &Handle_MMatch)
@@ -116,8 +118,8 @@ IGL_INLINE void igl::cross_field_missmatch(const Eigen::PlainObjectBase<DerivedV
                                            const bool isCombed,
                                            const bool isCombed,
                                            Eigen::PlainObjectBase<DerivedF> &missmatch)
                                            Eigen::PlainObjectBase<DerivedF> &missmatch)
 {
 {
-  Eigen::PlainObjectBase<DerivedV> PD1_combed;
-  Eigen::PlainObjectBase<DerivedV> PD2_combed;
+  DerivedV PD1_combed;
+  DerivedV PD2_combed;
 
 
   if (!isCombed)
   if (!isCombed)
     igl::comb_cross_field(V,F,PD1,PD2,PD1_combed,PD2_combed);
     igl::comb_cross_field(V,F,PD1,PD2,PD1_combed,PD2_combed);

+ 2 - 1
include/igl/cut_mesh.cpp

@@ -29,6 +29,7 @@ namespace igl {
     int num_scalar_variables;
     int num_scalar_variables;
 
 
     // per face indexes of vertex in the solver
     // per face indexes of vertex in the solver
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedF> HandleS_Index;
     Eigen::PlainObjectBase<DerivedF> HandleS_Index;
 
 
     // per vertex variable indexes
     // per vertex variable indexes
@@ -308,7 +309,7 @@ IGL_INLINE void igl::cut_mesh(
   Eigen::MatrixXd Vt = V;
   Eigen::MatrixXd Vt = V;
   Eigen::MatrixXi Ft = F;
   Eigen::MatrixXi Ft = F;
   Eigen::MatrixXi TT, TTi;
   Eigen::MatrixXi TT, TTi;
-  igl::triangle_triangle_adjacency(Vt,Ft,TT,TTi);
+  igl::triangle_triangle_adjacency(Ft,TT,TTi);
 
 
   std::vector<bool> V_border = igl::is_border_vertex(V,F);
   std::vector<bool> V_border = igl::is_border_vertex(V,F);
 
 

+ 2 - 1
include/igl/cut_mesh_from_singularities.cpp

@@ -30,6 +30,7 @@ namespace igl {
     const Eigen::PlainObjectBase<DerivedM> &Handle_MMatch;
     const Eigen::PlainObjectBase<DerivedM> &Handle_MMatch;
 
 
     Eigen::VectorXi F_visited;
     Eigen::VectorXi F_visited;
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedF> TT;
     Eigen::PlainObjectBase<DerivedF> TT;
     Eigen::PlainObjectBase<DerivedF> TTi;
     Eigen::PlainObjectBase<DerivedF> TTi;
 
 
@@ -147,7 +148,7 @@ namespace igl {
     F(F_),
     F(F_),
     Handle_MMatch(Handle_MMatch_)
     Handle_MMatch(Handle_MMatch_)
     {
     {
-      triangle_triangle_adjacency(V,F,TT,TTi);
+      triangle_triangle_adjacency(F,TT,TTi);
       edge_topology(V,F,E,F2E,E2F);
       edge_topology(V,F,E,F2E,E2F);
     };
     };
 
 

+ 2 - 2
include/igl/doublearea.cpp

@@ -25,7 +25,7 @@ IGL_INLINE void igl::doublearea(
   assert(F.cols() == 3);
   assert(F.cols() == 3);
   const size_t m = F.rows();
   const size_t m = F.rows();
   // Compute edge lengths
   // Compute edge lengths
-  Eigen::PlainObjectBase<DerivedV> l;
+  Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 3> l;
   // "Lecture Notes on Geometric Robustness" Shewchuck 09, Section 3.1
   // "Lecture Notes on Geometric Robustness" Shewchuck 09, Section 3.1
   // http://www.cs.berkeley.edu/~jrs/meshpapers/robnotes.pdf
   // http://www.cs.berkeley.edu/~jrs/meshpapers/robnotes.pdf
 
 
@@ -140,7 +140,7 @@ IGL_INLINE void igl::doublearea(
   assert(ul.cols() == 3);
   assert(ul.cols() == 3);
   // Number of triangles
   // Number of triangles
   const Index m = ul.rows();
   const Index m = ul.rows();
-  Eigen::PlainObjectBase<Derivedl> l;
+  Eigen::Matrix<typename Derivedl::Scalar, Eigen::Dynamic, 3> l;
   MatrixXi _;
   MatrixXi _;
   sort(ul,2,false,l,_);
   sort(ul,2,false,l,_);
   // semiperimeters
   // semiperimeters

+ 15 - 6
include/igl/embree/EmbreeIntersector.h

@@ -57,11 +57,13 @@ namespace igl
       // Inputs:
       // Inputs:
       //   V  #V by 3 list of vertex positions
       //   V  #V by 3 list of vertex positions
       //   F  #F by 3 list of Oriented triangles
       //   F  #F by 3 list of Oriented triangles
+      //   isStatic  scene is optimized for static geometry
       // Side effects:
       // Side effects:
       //   The first time this is ever called the embree engine is initialized.
       //   The first time this is ever called the embree engine is initialized.
       inline void init(
       inline void init(
         const PointMatrixType& V,
         const PointMatrixType& V,
-        const FaceMatrixType& F);
+        const FaceMatrixType& F,
+        bool isStatic = false);
 
 
       // Initialize with a given mesh.
       // Initialize with a given mesh.
       //
       //
@@ -69,12 +71,14 @@ namespace igl
       //   V  vector of #V by 3 list of vertex positions for each geometry
       //   V  vector of #V by 3 list of vertex positions for each geometry
       //   F  vector of #F by 3 list of Oriented triangles for each geometry
       //   F  vector of #F by 3 list of Oriented triangles for each geometry
       //   masks  a 32 bit mask to identify active geometries.
       //   masks  a 32 bit mask to identify active geometries.
+      //   isStatic  scene is optimized for static geometry
       // Side effects:
       // Side effects:
       //   The first time this is ever called the embree engine is initialized.
       //   The first time this is ever called the embree engine is initialized.
       inline void init(
       inline void init(
         const std::vector<const PointMatrixType*>& V,
         const std::vector<const PointMatrixType*>& V,
         const std::vector<const FaceMatrixType*>& F,
         const std::vector<const FaceMatrixType*>& F,
-        const std::vector<int>& masks);
+        const std::vector<int>& masks,
+        bool isStatic = false);
 
 
       // Deinitialize embree datasctructures for current mesh.  Also called on
       // Deinitialize embree datasctructures for current mesh.  Also called on
       // destruction: no need to call if you just want to init() once and
       // destruction: no need to call if you just want to init() once and
@@ -252,7 +256,8 @@ inline igl::embree::EmbreeIntersector & igl::embree::EmbreeIntersector::operator
 
 
 inline void igl::embree::EmbreeIntersector::init(
 inline void igl::embree::EmbreeIntersector::init(
   const PointMatrixType& V,
   const PointMatrixType& V,
-  const FaceMatrixType& F)
+  const FaceMatrixType& F,
+  bool isStatic)
 {
 {
   std::vector<const PointMatrixType*> Vtemp;
   std::vector<const PointMatrixType*> Vtemp;
   std::vector<const FaceMatrixType*> Ftemp;
   std::vector<const FaceMatrixType*> Ftemp;
@@ -260,13 +265,14 @@ inline void igl::embree::EmbreeIntersector::init(
   Vtemp.push_back(&V);
   Vtemp.push_back(&V);
   Ftemp.push_back(&F);
   Ftemp.push_back(&F);
   masks.push_back(0xFFFFFFFF);
   masks.push_back(0xFFFFFFFF);
-  init(Vtemp,Ftemp,masks);
+  init(Vtemp,Ftemp,masks,isStatic);
 }
 }
 
 
 inline void igl::embree::EmbreeIntersector::init(
 inline void igl::embree::EmbreeIntersector::init(
   const std::vector<const PointMatrixType*>& V,
   const std::vector<const PointMatrixType*>& V,
   const std::vector<const FaceMatrixType*>& F,
   const std::vector<const FaceMatrixType*>& F,
-  const std::vector<int>& masks)
+  const std::vector<int>& masks,
+  bool isStatic)
 {
 {
 
 
   if(initialized)
   if(initialized)
@@ -282,7 +288,10 @@ inline void igl::embree::EmbreeIntersector::init(
   }
   }
 
 
   // create a scene
   // create a scene
-  scene = rtcNewScene(RTC_SCENE_ROBUST | RTC_SCENE_HIGH_QUALITY,RTC_INTERSECT1);
+  RTCSceneFlags flags = RTC_SCENE_ROBUST | RTC_SCENE_HIGH_QUALITY;
+  if(isStatic)
+    flags = flags | RTC_SCENE_STATIC;
+  scene = rtcNewScene(flags,RTC_INTERSECT1);
 
 
   for(int g=0;g<(int)V.size();g++)
   for(int g=0;g<(int)V.size();g++)
   {
   {

+ 1 - 1
include/igl/find_cross_field_singularities.cpp

@@ -71,7 +71,7 @@ IGL_INLINE void igl::find_cross_field_singularities(const Eigen::PlainObjectBase
   // Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > Handle_MMatch;
   // Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > Handle_MMatch;
   // Eigen::PlainObjectBase<Eigen::Matrix<int,  Eigen::Dynamic, 3> > Handle_MMatch;
   // Eigen::PlainObjectBase<Eigen::Matrix<int,  Eigen::Dynamic, 3> > Handle_MMatch;
   // Eigen::Matrix<int, Eigen::Dynamic, 3> Handle_MMatch;
   // Eigen::Matrix<int, Eigen::Dynamic, 3> Handle_MMatch;
-  Eigen::PlainObjectBase<DerivedF> Handle_MMatch;
+  Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, 3> Handle_MMatch;
   // Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, 3> Handle_MMatch;
   // Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, 3> Handle_MMatch;
   // Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, Eigen::Dynamic> Handle_MMatch;
   // Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, Eigen::Dynamic> Handle_MMatch;
   igl::cross_field_missmatch<DerivedV, DerivedF>(V, F, PD1, PD2, isCombed, Handle_MMatch);
   igl::cross_field_missmatch<DerivedV, DerivedF>(V, F, PD1, PD2, isCombed, Handle_MMatch);

+ 0 - 21
include/igl/fit_rigid.cpp

@@ -1,21 +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/.
-#include "fit_rigid.h"
-#include "procrustes.h"
-
-IGL_INLINE void igl::fit_rigid(
-  const Eigen::MatrixXd & A,
-  const Eigen::MatrixXd & B,
-  Eigen::Rotation2Dd & R,
-  Eigen::RowVector2d & t)
-{
-  using namespace Eigen;
-  Matrix2d Rmat;
-  procrustes(A,B,Rmat,t);
-  R.fromRotationMatrix(Rmat);
-}

+ 0 - 37
include/igl/fit_rigid.h

@@ -1,37 +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_FIT_RIGID_H
-#define IGL_FIT_RIGID_H
-
-#if defined(_WIN32)
-  #pragma message("Deprecated. Use igl/procrustes.h instead")
-#else
-  #warning "Deprecated. Use igl/procrustes.h instead"
-#endif
-
-#include "igl_inline.h"
-#include <Eigen/Core>
-#include <Eigen/Geometry>
-
-namespace igl
-{
-  // Deprecated: please use procrustes(...) instead.
-  // Fit a rigid 
-  IGL_INLINE void fit_rigid(
-    const Eigen::MatrixXd & A,
-    const Eigen::MatrixXd & B,
-    Eigen::Rotation2Dd & R,
-    Eigen::RowVector2d & t);
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "fit_rigid.cpp"
-#endif
-
-#endif
-

+ 0 - 44
include/igl/full.cpp

@@ -1,44 +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/.
-#include "full.h"
-
-template <typename T,typename DerivedB>
-IGL_INLINE void igl::full(
-  const Eigen::SparseMatrix<T> & A,
-  Eigen::PlainObjectBase<DerivedB>& B)
-{
-  assert(false && "Obsolete. Just call B = Matrix(A)");
-  using namespace Eigen;
-  B = PlainObjectBase<DerivedB >::Zero(A.rows(),A.cols());
-  // Iterate over outside
-  for(int k=0; k<A.outerSize(); ++k)
-  {
-    // Iterate over inside
-    for(typename SparseMatrix<T>::InnerIterator it (A,k); it; ++it)
-    {
-      B(it.row(),it.col()) = it.value();
-    }
-  }
-}
-
-template <typename DerivedA,typename DerivedB>
-IGL_INLINE void igl::full(
-  const Eigen::PlainObjectBase<DerivedA>& A,
-  Eigen::PlainObjectBase<DerivedB>& B)
-{
-  assert(false && "Obsolete. Just call B = Matrix(A)");
-  B = A;
-}
-
-#ifdef IGL_STATIC_LIBRARY
-// Explicit template specialization
-// generated by autoexplicit.sh
-template void igl::full<Eigen::Matrix<double, -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<double, -1, -1, 0, -1, -1> >&);
-// generated by autoexplicit.sh
-template void igl::full<double, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-#endif

+ 0 - 41
include/igl/full.h

@@ -1,41 +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_FULL_H
-#define IGL_FULL_H
-#include "igl_inline.h"
-#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
-#include <Eigen/Dense>
-#include <Eigen/Sparse>
-namespace igl
-{
-  // This is totally unnecessary. You can just call MatrixXd B = MatrixXd(A);
-  //
-  // Convert a sparsematrix into a full one
-  //
-  // Templates:
-  //   T  should be a eigen sparse matrix primitive type like int or double
-  // Input:
-  //   A  m by n sparse matrix
-  // Output:
-  //   B  m by n dense/full matrix
-  template <typename T,typename DerivedB>
-  IGL_INLINE void full(
-    const Eigen::SparseMatrix<T> & A,
-    Eigen::PlainObjectBase<DerivedB> & B);
-  // If already full then this will just be a copy by assignment
-  template <typename DerivedA,typename DerivedB>
-  IGL_INLINE void full(
-    const Eigen::PlainObjectBase<DerivedA>& A,
-    Eigen::PlainObjectBase<DerivedB>& B);
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "full.cpp"
-#endif
-
-#endif

+ 2 - 3
include/igl/grad.cpp

@@ -14,9 +14,8 @@ IGL_INLINE void igl::grad(const Eigen::PlainObjectBase<DerivedV>&V,
                      const Eigen::PlainObjectBase<DerivedF>&F,
                      const Eigen::PlainObjectBase<DerivedF>&F,
                     Eigen::SparseMatrix<typename DerivedV::Scalar> &G)
                     Eigen::SparseMatrix<typename DerivedV::Scalar> &G)
 {
 {
-  Eigen::PlainObjectBase<DerivedV > eperp21, eperp13;
-  eperp21.resize(F.rows(),3);
-  eperp13.resize(F.rows(),3);
+  Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,3> 
+    eperp21(F.rows(),3), eperp13(F.rows(),3);
 
 
   for (int i=0;i<F.rows();++i)
   for (int i=0;i<F.rows();++i)
   {
   {

+ 4 - 3
include/igl/is_border_vertex.cpp

@@ -12,11 +12,11 @@
 
 
 template <typename DerivedV, typename DerivedF>
 template <typename DerivedV, typename DerivedF>
 IGL_INLINE std::vector<bool> igl::is_border_vertex(
 IGL_INLINE std::vector<bool> igl::is_border_vertex(
-    const Eigen::PlainObjectBase<DerivedV> &V, 
+    const Eigen::PlainObjectBase<DerivedV> &V,
     const Eigen::PlainObjectBase<DerivedF> &F)
     const Eigen::PlainObjectBase<DerivedF> &F)
 {
 {
-  Eigen::PlainObjectBase<DerivedF> FF;
-  igl::triangle_triangle_adjacency(V,F,FF);
+  DerivedF FF;
+  igl::triangle_triangle_adjacency(F,FF);
   std::vector<bool> ret(V.rows());
   std::vector<bool> ret(V.rows());
   for(unsigned i=0; i<ret.size();++i)
   for(unsigned i=0; i<ret.size();++i)
     ret[i] = false;
     ret[i] = false;
@@ -35,4 +35,5 @@ IGL_INLINE std::vector<bool> igl::is_border_vertex(
 // Explicit template specialization
 // Explicit template specialization
 template std::vector<bool, std::allocator<bool> > igl::is_border_vertex<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&);
 template std::vector<bool, std::allocator<bool> > igl::is_border_vertex<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&);
 template std::vector<bool, std::allocator<bool> > igl::is_border_vertex<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&);
 template std::vector<bool, std::allocator<bool> > igl::is_border_vertex<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&);
+template std::vector<bool, std::allocator<bool> > igl::is_border_vertex<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&);
 #endif
 #endif

+ 18 - 16
include/igl/lim/lim.cpp

@@ -8,37 +8,39 @@
 #include "lim.h"
 #include "lim.h"
 #include <LIMSolverInterface.h>
 #include <LIMSolverInterface.h>
 
 
-IGL_INLINE int igl::lim::lim(
+using namespace igl::lim;
+
+IGL_INLINE State lim(
   Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
   Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
   const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
   const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
   const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
   const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
   const Eigen::SparseMatrix<double>& constraintMatrix,
   const Eigen::SparseMatrix<double>& constraintMatrix,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
-  int energyType,
+  Energy energyType,
   double tolerance,
   double tolerance,
   int maxIteration,
   int maxIteration,
   bool findLocalMinima)
   bool findLocalMinima)
 {
 {
-  return ComputeLIM(
+  return (State)ComputeLIM(
     vertices,
     vertices,
     initialVertices,
     initialVertices,
     elements,
     elements,
     constraintMatrix,
     constraintMatrix,
     constraintTargets,
     constraintTargets,
-    energyType,
+    (EnergyType)energyType,
     tolerance,
     tolerance,
     maxIteration,
     maxIteration,
     findLocalMinima
     findLocalMinima
     );
     );
 }
 }
 
 
-IGL_INLINE int igl::lim(
+IGL_INLINE State igl::lim::lim(
   Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
   Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
   const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
   const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
   const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
   const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
   const Eigen::SparseMatrix<double>& constraintMatrix,
   const Eigen::SparseMatrix<double>& constraintMatrix,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
-  int energyType,
+  Energy energyType,
   double tolerance,
   double tolerance,
   int maxIteration,
   int maxIteration,
   bool findLocalMinima,
   bool findLocalMinima,
@@ -48,13 +50,13 @@ IGL_INLINE int igl::lim(
   double beta,
   double beta,
   double eps)
   double eps)
 {
 {
-  return ComputeLIM(
+  return (State)ComputeLIM(
     vertices,
     vertices,
     initialVertices,
     initialVertices,
     elements,
     elements,
     constraintMatrix,
     constraintMatrix,
     constraintTargets,
     constraintTargets,
-    energyType,
+    (EnergyType)energyType,
     tolerance,
     tolerance,
     maxIteration,
     maxIteration,
     findLocalMinima,
     findLocalMinima,
@@ -66,7 +68,7 @@ IGL_INLINE int igl::lim(
     );
     );
 }
 }
 
 
-IGL_INLINE int igl::lim(
+IGL_INLINE State igl::lim::lim(
   Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
   Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
   const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
   const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
   const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
   const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
@@ -74,12 +76,12 @@ IGL_INLINE int igl::lim(
   const Eigen::Matrix<double,Eigen::Dynamic,1>& gradients,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& gradients,
   const Eigen::SparseMatrix<double>& constraintMatrix,
   const Eigen::SparseMatrix<double>& constraintMatrix,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
-  int energyType,
+  Energy energyType,
   double tolerance,
   double tolerance,
   int maxIteration,
   int maxIteration,
   bool findLocalMinima)
   bool findLocalMinima)
 {
 {
-  return ComputeLIM(
+  return (State)ComputeLIM(
     vertices,
     vertices,
     initialVertices,
     initialVertices,
     elements,
     elements,
@@ -87,14 +89,14 @@ IGL_INLINE int igl::lim(
     gradients,
     gradients,
     constraintMatrix,
     constraintMatrix,
     constraintTargets,
     constraintTargets,
-    energyType,
+    (EnergyType)energyType,
     tolerance,
     tolerance,
     maxIteration,
     maxIteration,
     findLocalMinima
     findLocalMinima
     );
     );
 }
 }
 
 
-IGL_INLINE int igl::lim(
+IGL_INLINE State igl::lim::lim(
   Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
   Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
   const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
   const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
   const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
   const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
@@ -102,7 +104,7 @@ IGL_INLINE int igl::lim(
   const Eigen::Matrix<double,Eigen::Dynamic,1>& gradients,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& gradients,
   const Eigen::SparseMatrix<double>& constraintMatrix,
   const Eigen::SparseMatrix<double>& constraintMatrix,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
   const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
-  int energyType,
+  Energy energyType,
   double tolerance,
   double tolerance,
   int maxIteration,
   int maxIteration,
   bool findLocalMinima,
   bool findLocalMinima,
@@ -112,7 +114,7 @@ IGL_INLINE int igl::lim(
   double beta,
   double beta,
   double eps)
   double eps)
 {
 {
-  return ComputeLIM(
+  return (State)ComputeLIM(
     vertices,
     vertices,
     initialVertices,
     initialVertices,
     elements,
     elements,
@@ -120,7 +122,7 @@ IGL_INLINE int igl::lim(
     gradients,
     gradients,
     constraintMatrix,
     constraintMatrix,
     constraintTargets,
     constraintTargets,
-    energyType,
+    (EnergyType)energyType,
     tolerance,
     tolerance,
     maxIteration,
     maxIteration,
     findLocalMinima,
     findLocalMinima,

+ 16 - 17
include/igl/lim/lim.h

@@ -15,9 +15,6 @@ namespace igl
 {
 {
   namespace lim
   namespace lim
   {
   {
-    // Known issues: energy type should be a readable enum rather than magic
-    // ints.
-    //
     // Computes a locally injective mapping of a triangle or tet-mesh based on
     // Computes a locally injective mapping of a triangle or tet-mesh based on
     // a deformation energy subject to some provided linear positional
     // a deformation energy subject to some provided linear positional
     // constraints Cv-d.
     // constraints Cv-d.
@@ -39,7 +36,7 @@ namespace igl
     //                     y_2, ..., x_v,y_v])
     //                     y_2, ..., x_v,y_v])
     //   constraintTargets d: c vector target positions
     //   constraintTargets d: c vector target positions
     //   energyType        type of used energy:
     //   energyType        type of used energy:
-    //                     0=Dirichlet,1=Laplacian,2=Green,3=ARAP,4=LSCM
+    //                     Dirichlet, Laplacian, Green, ARAP, LSCM, Poisson (only 2D), UniformLaplacian, Identity
     //   tolerance         max squared positional constraints error
     //   tolerance         max squared positional constraints error
     //   maxIteration      max number of iterations
     //   maxIteration      max number of iterations
     //   findLocalMinima   iterating until a local minima is found. If not
     //   findLocalMinima   iterating until a local minima is found. If not
@@ -61,30 +58,32 @@ namespace igl
     //                   mesh
     //                   mesh
     //--------------------------------------------------------------------------
     //--------------------------------------------------------------------------
     // Return values:
     // Return values:
-    //  1 : Optimization deemed successful because either (a) it stagnated
-    //    (very step size) or (b) positional constraints were satisfied. (re:
-    //    https://github.com/libigl/libigl/issues/79 )
-    // -1 : Max iteration reached before tolerance was fulfilled
-    // -2 : not feasible -> has inverted elements (may want to decrease eps?)
+    //  Succeeded : Successful optimization with fulfilled tolerance
+    //  LocalMinima : Convergenged to a local minima / tolerance not fullfilled
+    //  IterationLimit : Max iteration reached before tolerance was fulfilled
+    //  Infeasible : not feasible -> has inverted elements (decrease eps?)
   
   
-    int lim(
+    enum Energy { Dirichlet = 0, Laplacian=1, Green=2, ARAP=3, LSCM=4, Poisson=5, UniformLaplacian=6, Identity=7 };
+    enum State { Uninitialized = -4, Infeasible = -3, IterationLimit = -2, LocalMinima = -1, Running = 0, Succeeded = 1 };
+
+    State lim(
       Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
       Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
       const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
       const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
       const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
       const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
       const Eigen::SparseMatrix<double>& constraintMatrix,
       const Eigen::SparseMatrix<double>& constraintMatrix,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
-      int energyType,
+      Energy energyType,
       double tolerance,
       double tolerance,
       int maxIteration,
       int maxIteration,
       bool findLocalMinima);
       bool findLocalMinima);
   
   
-    int lim(
+    State lim(
       Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
       Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
       const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
       const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
       const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
       const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
       const Eigen::SparseMatrix<double>& constraintMatrix,
       const Eigen::SparseMatrix<double>& constraintMatrix,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
-      int energyType,
+      Energy energyType,
       double tolerance,
       double tolerance,
       int maxIteration,
       int maxIteration,
       bool findLocalMinima,
       bool findLocalMinima,
@@ -94,7 +93,7 @@ namespace igl
       double beta,
       double beta,
       double eps);
       double eps);
   
   
-    int lim(
+    State lim(
       Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
       Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
       const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
       const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
       const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
       const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
@@ -102,12 +101,12 @@ namespace igl
       const Eigen::Matrix<double,Eigen::Dynamic,1>& gradients,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& gradients,
       const Eigen::SparseMatrix<double>& constraintMatrix,
       const Eigen::SparseMatrix<double>& constraintMatrix,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
-      int energyType,
+      Energy energyType,
       double tolerance,
       double tolerance,
       int maxIteration,
       int maxIteration,
       bool findLocalMinima);
       bool findLocalMinima);
   
   
-    int lim(
+    State lim(
       Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
       Eigen::Matrix<double,Eigen::Dynamic,3>& vertices,
       const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
       const Eigen::Matrix<double,Eigen::Dynamic,3>& initialVertices,
       const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
       const Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic>& elements,
@@ -115,7 +114,7 @@ namespace igl
       const Eigen::Matrix<double,Eigen::Dynamic,1>& gradients,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& gradients,
       const Eigen::SparseMatrix<double>& constraintMatrix,
       const Eigen::SparseMatrix<double>& constraintMatrix,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
       const Eigen::Matrix<double,Eigen::Dynamic,1>& constraintTargets,
-      int energyType,
+      Energy energyType,
       double tolerance,
       double tolerance,
       int maxIteration,
       int maxIteration,
       bool findLocalMinima,
       bool findLocalMinima,

+ 2 - 1
include/igl/line_field_missmatch.cpp

@@ -31,6 +31,7 @@ public:
     const Eigen::PlainObjectBase<DerivedF> &F;
     const Eigen::PlainObjectBase<DerivedF> &F;
     const Eigen::PlainObjectBase<DerivedV> &PD1;
     const Eigen::PlainObjectBase<DerivedV> &PD1;
     const Eigen::PlainObjectBase<DerivedV> &PD2;
     const Eigen::PlainObjectBase<DerivedV> &PD2;
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedV> N;
     Eigen::PlainObjectBase<DerivedV> N;
 
 
 private:
 private:
@@ -93,7 +94,7 @@ public:
         igl::per_face_normals(V,F,N);
         igl::per_face_normals(V,F,N);
         V_border = igl::is_border_vertex(V,F);
         V_border = igl::is_border_vertex(V,F);
         igl::vertex_triangle_adjacency(V,F,VF,VFi);
         igl::vertex_triangle_adjacency(V,F,VF,VFi);
-        igl::triangle_triangle_adjacency(V,F,TT,TTi);
+        igl::triangle_triangle_adjacency(F,TT,TTi);
     }
     }
 
 
     inline void calculateMissmatchLine(Eigen::PlainObjectBase<DerivedO> &Handle_MMatch)
     inline void calculateMissmatchLine(Eigen::PlainObjectBase<DerivedO> &Handle_MMatch)

+ 26 - 55
include/igl/list_to_matrix.cpp

@@ -15,8 +15,8 @@
 #include "max_size.h"
 #include "max_size.h"
 #include "min_size.h"
 #include "min_size.h"
 
 
-template <typename T, class Mat>
-IGL_INLINE bool igl::list_to_matrix(const std::vector<std::vector<T > > & V,Mat & M)
+template <typename T, typename Derived>
+IGL_INLINE bool igl::list_to_matrix(const std::vector<std::vector<T > > & V,Eigen::PlainObjectBase<Derived>& M)
 {
 {
   // number of rows
   // number of rows
   int m = V.size();
   int m = V.size();
@@ -48,12 +48,12 @@ IGL_INLINE bool igl::list_to_matrix(const std::vector<std::vector<T > > & V,Mat
   return true;
   return true;
 }
 }
 
 
-template <typename T, class Mat>
+template <typename T, typename Derived>
 IGL_INLINE bool igl::list_to_matrix(
 IGL_INLINE bool igl::list_to_matrix(
   const std::vector<std::vector<T > > & V,
   const std::vector<std::vector<T > > & V,
   const int n,
   const int n,
   const T & padding,
   const T & padding,
-  Mat & M)
+  Eigen::PlainObjectBase<Derived>& M)
 {
 {
   const int m = V.size();
   const int m = V.size();
   M.resize(m,n);
   M.resize(m,n);
@@ -77,8 +77,8 @@ IGL_INLINE bool igl::list_to_matrix(
   return true;
   return true;
 }
 }
 
 
-template <typename T, class Mat>
-IGL_INLINE bool igl::list_to_matrix(const std::vector<T > & V,Mat & M)
+template <typename T, typename Derived>
+IGL_INLINE bool igl::list_to_matrix(const std::vector<T > & V,Eigen::PlainObjectBase<Derived>& M)
 {
 {
   // number of rows
   // number of rows
   int m = V.size();
   int m = V.size();
@@ -86,10 +86,10 @@ IGL_INLINE bool igl::list_to_matrix(const std::vector<T > & V,Mat & M)
   {
   {
     //fprintf(stderr,"Error: list_to_matrix() list is empty()\n");
     //fprintf(stderr,"Error: list_to_matrix() list is empty()\n");
     //return false;
     //return false;
-    if(Mat::ColsAtCompileTime == 1)
+    if(Eigen::PlainObjectBase<Derived>::ColsAtCompileTime == 1)
     {
     {
       M.resize(0,1);
       M.resize(0,1);
-    }else if(Mat::RowsAtCompileTime == 1)
+    }else if(Eigen::PlainObjectBase<Derived>::RowsAtCompileTime == 1)
     {
     {
       M.resize(1,0);
       M.resize(1,0);
     }else
     }else
@@ -99,7 +99,7 @@ IGL_INLINE bool igl::list_to_matrix(const std::vector<T > & V,Mat & M)
     return true;
     return true;
   }
   }
   // Resize output
   // Resize output
-  if(Mat::RowsAtCompileTime == 1)
+  if(Eigen::PlainObjectBase<Derived>::RowsAtCompileTime == 1)
   {
   {
     M.resize(1,m);
     M.resize(1,m);
   }else
   }else
@@ -118,50 +118,21 @@ IGL_INLINE bool igl::list_to_matrix(const std::vector<T > & V,Mat & M)
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<unsigned int, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> > >(std::vector<std::vector<unsigned int, std::allocator<unsigned int> >, std::allocator<std::vector<unsigned int, std::allocator<unsigned int> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >&);
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<float, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > >(std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&);
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&);
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::vector<double, std::allocator<double> > const&, Eigen::Matrix<double, -1, 1, 0, -1, 1>&);
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<int, 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> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
-// generated by autoexplicit.sh
-template bool igl::list_to_matrix<double, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);
-template bool igl::list_to_matrix<bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template bool igl::list_to_matrix<bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template bool igl::list_to_matrix<int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template bool igl::list_to_matrix<int, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
-template bool igl::list_to_matrix<int, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::vector<int, std::allocator<int> > const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&);
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 1, -1, 2> > >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 1, -1, 2> >&);
-template bool igl::list_to_matrix<int, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> > >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> >&);
-template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::vector<int, std::allocator<int> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1>&);
-template bool igl::list_to_matrix<int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > >(std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
-template bool igl::list_to_matrix<int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
-template bool igl::list_to_matrix<double, Eigen::Matrix<double, 1, -1, 1, 1, -1> >(std::vector<double, std::allocator<double> > const&, Eigen::Matrix<double, 1, -1, 1, 1, -1>&);
-template bool igl::list_to_matrix<unsigned long, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > >(std::vector<unsigned long, std::allocator<unsigned long> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template bool igl::list_to_matrix<double, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::vector<double, std::allocator<double> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1>&);
-template bool igl::list_to_matrix<float, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > >(std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);
-template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, 2, 0, -1, 2> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::Matrix<double, -1, 2, 0, -1, 2>&);
-template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::Matrix<double, -1, 3, 0, -1, 3>&);
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> > >(std::vector<double, std::allocator<double> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >&);
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > >(std::vector<double, std::allocator<double> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> > >(std::vector<double, std::allocator<double> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >&);
-template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >(std::vector<double, std::allocator<double> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, 2, 0, -1, 2> >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::Matrix<int, -1, 2, 0, -1, 2>&);
-template bool igl::list_to_matrix<unsigned long long int,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,1,0,-1,1> > >(std::vector<unsigned long long int,std::allocator<unsigned long long int> > const &,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,1,0,-1,1> > &);
-template bool igl::list_to_matrix<bool, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1> > >(std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1> >&);
-template bool igl::list_to_matrix<bool, Eigen::PlainObjectBase<Eigen::Array<bool, -1, -1, 0, -1, -1> > >(std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > > const&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, -1, 0, -1, -1> >&);
+template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
+template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, 3, 1, -1, 3> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&);
+template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
+template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(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> >&);
+template bool igl::list_to_matrix<int, Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> >&);
+template bool igl::list_to_matrix<double, Eigen::Matrix<float, -1, 3, 1, -1, 3> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&);
+template bool igl::list_to_matrix<float, Eigen::Matrix<float, -1, 3, 1, -1, 3> >(std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&);
+template bool igl::list_to_matrix<unsigned int, Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >(std::vector<std::vector<unsigned int, std::allocator<unsigned int> >, std::allocator<std::vector<unsigned int, std::allocator<unsigned int> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >&);
+template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template bool igl::list_to_matrix<unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::vector<unsigned long, std::allocator<unsigned long> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template bool igl::list_to_matrix<float, Eigen::Matrix<float, -1, -1, 0, -1, -1> >(std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);
+template bool igl::list_to_matrix<bool, Eigen::Array<bool, -1, 1, 0, -1, 1> >(std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1> >&);
+template bool igl::list_to_matrix<bool, Eigen::Array<bool, -1, -1, 0, -1, -1> >(std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > > const&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, -1, 0, -1, -1> >&);
+template bool igl::list_to_matrix<bool, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template bool igl::list_to_matrix<bool, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::__1::vector<double, std::__1::allocator<double> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
 #endif
 #endif

+ 13 - 11
include/igl/list_to_matrix.h

@@ -1,18 +1,20 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
 // 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 
+//
+// 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_LIST_TO_MATRIX_H
 #ifndef IGL_LIST_TO_MATRIX_H
 #define IGL_LIST_TO_MATRIX_H
 #define IGL_LIST_TO_MATRIX_H
 #include "igl_inline.h"
 #include "igl_inline.h"
 #include <vector>
 #include <vector>
+#include <Eigen/Core>
+
 namespace igl
 namespace igl
 {
 {
   // Convert a list (std::vector) of row vectors of the same length to a matrix
   // Convert a list (std::vector) of row vectors of the same length to a matrix
-  // Template: 
+  // Template:
   //   T  type that can be safely cast to type in Mat via '='
   //   T  type that can be safely cast to type in Mat via '='
   //   Mat  Matrix type, must implement:
   //   Mat  Matrix type, must implement:
   //     .resize(m,n)
   //     .resize(m,n)
@@ -22,10 +24,10 @@ namespace igl
   // Outputs:
   // Outputs:
   //   M  an m by n matrix
   //   M  an m by n matrix
   // Returns true on success, false on errors
   // Returns true on success, false on errors
-  template <typename T, class Mat>
+  template <typename T, typename Derived>
   IGL_INLINE bool list_to_matrix(
   IGL_INLINE bool list_to_matrix(
     const std::vector<std::vector<T > > & V,
     const std::vector<std::vector<T > > & V,
-    Mat & M);
+    Eigen::PlainObjectBase<Derived>& M);
   // Convert a list of row vectors of `n` or less to a matrix and pad on
   // Convert a list of row vectors of `n` or less to a matrix and pad on
   // the right with `padding`:
   // the right with `padding`:
   //
   //
@@ -35,15 +37,15 @@ namespace igl
   //   padding  value to fill in from right for short rows
   //   padding  value to fill in from right for short rows
   // Outputs:
   // Outputs:
   //   M  an m by n matrix
   //   M  an m by n matrix
-  template <typename T, class Mat>
+  template <typename T, typename Derived>
   IGL_INLINE bool list_to_matrix(
   IGL_INLINE bool list_to_matrix(
     const std::vector<std::vector<T > > & V,
     const std::vector<std::vector<T > > & V,
     const int n,
     const int n,
     const T & padding,
     const T & padding,
-    Mat & M);
+    Eigen::PlainObjectBase<Derived>& M);
   // Vector wrapper
   // Vector wrapper
-  template <typename T, class Mat>
-  IGL_INLINE bool list_to_matrix(const std::vector<T > & V,Mat & M);
+  template <typename T, typename Derived>
+  IGL_INLINE bool list_to_matrix(const std::vector<T > & V,Eigen::PlainObjectBase<Derived>& M);
 }
 }
 
 
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY

+ 0 - 159
include/igl/lu_lagrange.cpp

@@ -1,159 +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/.
-#include "lu_lagrange.h"
-
-// Cholesky LLT decomposition for symmetric positive definite
-//#include <Eigen/SparseExtra>
-// Bug in unsupported/Eigen/SparseExtra needs iostream first
-#include <iostream>
-#include <unsupported/Eigen/SparseExtra>
-#include <cassert>
-#include <cstdio>
-#include "find.h"
-#include "sparse.h"
-
-template <typename T>
-IGL_INLINE bool igl::lu_lagrange(
-  const Eigen::SparseMatrix<T> & ATA,
-  const Eigen::SparseMatrix<T> & C,
-  Eigen::SparseMatrix<T> & L,
-  Eigen::SparseMatrix<T> & U)
-{
-#if EIGEN_VERSION_AT_LEAST(3,0,92)
-#if defined(_WIN32)
-  #pragma message("lu_lagrange has not yet been implemented for your Eigen Version")
-#else
-  #warning lu_lagrange has not yet been implemented for your Eigen Version
-#endif
-
-  return false;
-#else
-  // number of unknowns
-  int n = ATA.rows();
-  // number of lagrange multipliers
-  int m = C.cols();
-
-  assert(ATA.cols() == n);
-  if(m != 0)
-  {
-    assert(C.rows() == n);
-    if(C.nonZeros() == 0)
-    {
-      // See note above about empty columns in C
-      fprintf(stderr,"Error: lu_lagrange() C has columns but no entries\n");
-      return false;
-    }
-  }
-
-  // Check that each column of C has at least one entry
-  std::vector<bool> has_entry; has_entry.resize(C.cols(),false);
-  // Iterate over outside
-  for(int k=0; k<C.outerSize(); ++k)
-  {
-    // Iterate over inside
-    for(typename Eigen::SparseMatrix<T>::InnerIterator it (C,k); it; ++it)
-    {
-      has_entry[it.col()] = true;
-    }
-  }
-  for(int i=0;i<(int)has_entry.size();i++)
-  {
-    if(!has_entry[i])
-    {
-      // See note above about empty columns in C
-      fprintf(stderr,"Error: lu_lagrange() C(:,%d) has no entries\n",i);
-      return false;
-    }
-  }
-
-
-
-  // Cholesky factorization of ATA
-  //// Eigen fails if you give a full view of the matrix like this:
-  //Eigen::SparseLLT<SparseMatrix<T> > ATA_LLT(ATA);
-  Eigen::SparseMatrix<T> ATA_LT = ATA.template triangularView<Eigen::Lower>();
-  Eigen::SparseLLT<Eigen::SparseMatrix<T> > ATA_LLT(ATA_LT);
-
-  Eigen::SparseMatrix<T> J = ATA_LLT.matrixL();
-
-  //if(!ATA_LLT.succeeded())
-  if(!((J*0).eval().nonZeros() == 0))
-  {
-    fprintf(stderr,"Error: lu_lagrange() failed to factor ATA\n");
-    return false;
-  }
-
-  if(m == 0)
-  {
-    // If there are no constraints (C is empty) then LU decomposition is just L
-    // and L' from cholesky decomposition
-    L = J;
-    U = J.transpose();
-  }else
-  {
-    // Construct helper matrix M
-    Eigen::SparseMatrix<T> M = C;
-    J.template triangularView<Eigen::Lower>().solveInPlace(M);
-
-    // Compute cholesky factorizaiton of M'*M
-    Eigen::SparseMatrix<T> MTM = M.transpose() * M;
-
-    Eigen::SparseLLT<Eigen::SparseMatrix<T> > MTM_LLT(MTM.template triangularView<Eigen::Lower>());
-
-    Eigen::SparseMatrix<T> K = MTM_LLT.matrixL();
-
-    //if(!MTM_LLT.succeeded())
-    if(!((K*0).eval().nonZeros() == 0))
-    {
-      fprintf(stderr,"Error: lu_lagrange() failed to factor MTM\n");
-      return false;
-    }
-
-    // assemble LU decomposition of Q
-    Eigen::Matrix<int,Eigen::Dynamic,1> MI;
-    Eigen::Matrix<int,Eigen::Dynamic,1> MJ;
-    Eigen::Matrix<T,Eigen::Dynamic,1> MV;
-    igl::find(M,MI,MJ,MV);
-
-    Eigen::Matrix<int,Eigen::Dynamic,1> KI;
-    Eigen::Matrix<int,Eigen::Dynamic,1> KJ;
-    Eigen::Matrix<T,Eigen::Dynamic,1> KV;
-    igl::find(K,KI,KJ,KV);
-
-    Eigen::Matrix<int,Eigen::Dynamic,1> JI;
-    Eigen::Matrix<int,Eigen::Dynamic,1> JJ;
-    Eigen::Matrix<T,Eigen::Dynamic,1> JV;
-    igl::find(J,JI,JJ,JV);
-
-    int nnz = JV.size()  + MV.size() + KV.size();
-
-    Eigen::Matrix<int,Eigen::Dynamic,1> UI(nnz);
-    Eigen::Matrix<int,Eigen::Dynamic,1> UJ(nnz);
-    Eigen::Matrix<T,Eigen::Dynamic,1> UV(nnz);
-    UI << JJ,                        MI, (KJ.array() + n).matrix();
-    UJ << JI, (MJ.array() + n).matrix(), (KI.array() + n).matrix(); 
-    UV << JV,                        MV,                     KV*-1;
-    igl::sparse(UI,UJ,UV,U);
-
-    Eigen::Matrix<int,Eigen::Dynamic,1> LI(nnz);
-    Eigen::Matrix<int,Eigen::Dynamic,1> LJ(nnz);
-    Eigen::Matrix<T,Eigen::Dynamic,1> LV(nnz);
-    LI << JI, (MJ.array() + n).matrix(), (KI.array() + n).matrix();
-    LJ << JJ,                        MI, (KJ.array() + n).matrix(); 
-    LV << JV,                        MV,                        KV;
-    igl::sparse(LI,LJ,LV,L);
-  }
-
-  return true;
-  #endif
-}
-
-#ifdef IGL_STATIC_LIBRARY
-// Explicit template specialization
-template bool igl::lu_lagrange<double>(Eigen::SparseMatrix<double, 0, int> const&, Eigen::SparseMatrix<double, 0, int> const&, Eigen::SparseMatrix<double, 0, int>&, Eigen::SparseMatrix<double, 0, int>&);
-#endif

+ 0 - 67
include/igl/lu_lagrange.h

@@ -1,67 +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_LU_LAGRANGE_H
-#define IGL_LU_LAGRANGE_H
-#include "igl_inline.h"
-
-#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
-#include <Eigen/Dense>
-#include <Eigen/Sparse>
-namespace igl
-{
-  // KNOWN BUGS: This does not seem to be correct for non-empty C
-  //
-  // LU_LAGRANGE Compute a LU decomposition for a special type of
-  // matrix Q that is symmetric but not positive-definite:
-  // Q = [A'*A C
-  //      C'   0];
-  // where A'*A, or ATA, is given as a symmetric positive definite matrix and C
-  // has full column-rank(?)
-  //
-  // [J] = lu_lagrange(ATA,C)
-  //
-  // Templates:
-  //   T  should be a eigen matrix primitive type like int or double
-  // Inputs:
-  //   ATA   n by n square, symmetric, positive-definite system matrix, usually
-  //     the quadratic coefficients corresponding to the original unknowns in a
-  //     system
-  //   C  n by m rectangular matrix corresponding the quadratic coefficients of
-  //     the original unknowns times the lagrange multipliers enforcing linear
-  //     equality constraints
-  // Outputs:
-  //   L  lower triangular matrix such that Q = L*U
-  //   U  upper triangular matrix such that Q = L*U
-  // Returns true on success, false on error
-  //
-  // Note: C should *not* have any empty columns. Typically C is the slice of
-  // the linear constraints matrix Aeq concerning the unknown variables of a
-  // quadratic optimization. Generally constraints may deal with unknowns as
-  // well as knowns. Each linear constraint corresponds to a column of Aeq. As
-  // long as each constraint concerns at least one unknown then the
-  // corresponding column in C will have at least one non zero entry. If a
-  // constraint concerns *no* unknowns, you should double check that this is a
-  // valid constraint. How can you constrain known values to each other? This
-  // is either a contradiction to the knowns' values or redundent. In either
-  // case, it's not this functions responsiblilty to handle empty constraints
-  // so you will get an error.
-  //
-  template <typename T>
-  IGL_INLINE bool lu_lagrange(
-    const Eigen::SparseMatrix<T> & ATA,
-    const Eigen::SparseMatrix<T> & C,
-    Eigen::SparseMatrix<T> & L,
-    Eigen::SparseMatrix<T> & U);
-
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "lu_lagrange.cpp"
-#endif
-
-#endif

+ 16 - 27
include/igl/matlab/prepare_lhs.cpp

@@ -14,22 +14,17 @@ IGL_INLINE void igl::matlab::prepare_lhs_double(
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
-  plhs[0] = mxCreateDoubleMatrix(V.rows(),V.cols(), mxREAL);
+  const int m = V.rows();
+  const int n = V.cols();
+  plhs[0] = mxCreateDoubleMatrix(m,n, mxREAL);
   double * Vp = mxGetPr(plhs[0]);
   double * Vp = mxGetPr(plhs[0]);
-
-  typedef typename DerivedV::Scalar Scalar;
-  const Scalar * V_data;
-  Matrix<Scalar, DerivedV::ColsAtCompileTime, DerivedV::RowsAtCompileTime, RowMajor> VT;
-  if(DerivedV::IsRowMajor)
-  {
-    VT = V.transpose();
-    V_data = VT.data();
-  }else
+  for(int i = 0;i<m;i++)
   {
   {
-    V_data = V.data();
+    for(int j = 0;j<n;j++)
+    {
+      Vp[i+m*j] = V(i,j);
+    }
   }
   }
-
-  copy(V_data,V_data+V.size(),Vp);
 }
 }
 
 
 template <typename DerivedV>
 template <typename DerivedV>
@@ -39,22 +34,17 @@ IGL_INLINE void igl::matlab::prepare_lhs_logical(
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
-  plhs[0] = mxCreateLogicalMatrix(V.rows(),V.cols());
+  const int m = V.rows();
+  const int n = V.cols();
+  plhs[0] = mxCreateLogicalMatrix(m,n);
   mxLogical * Vp = static_cast<mxLogical*>(mxGetData(plhs[0]));
   mxLogical * Vp = static_cast<mxLogical*>(mxGetData(plhs[0]));
-
-  typedef typename DerivedV::Scalar Scalar;
-  const Scalar * V_data;
-  Matrix<Scalar, DerivedV::ColsAtCompileTime, DerivedV::RowsAtCompileTime, RowMajor> VT;
-  if(DerivedV::IsRowMajor)
-  {
-    VT = V.transpose();
-    V_data = VT.data();
-  }else
+  for(int i = 0;i<m;i++)
   {
   {
-    V_data = V.data();
+    for(int j = 0;j<n;j++)
+    {
+      Vp[i+m*j] = V(i,j);
+    }
   }
   }
-
-  copy(V_data,V_data+V.size(),Vp);
 }
 }
 
 
 template <typename DerivedV>
 template <typename DerivedV>
@@ -63,7 +53,6 @@ IGL_INLINE void igl::matlab::prepare_lhs_index(
   mxArray *plhs[])
   mxArray *plhs[])
 {
 {
   // Treat indices as reals
   // Treat indices as reals
-  
   const auto Vd = (V.template cast<double>().array()+1).eval();
   const auto Vd = (V.template cast<double>().array()+1).eval();
   return prepare_lhs_double(Vd,plhs);
   return prepare_lhs_double(Vd,plhs);
 }
 }

+ 2 - 4
include/igl/min_quad_with_fixed.cpp

@@ -1,6 +1,6 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 // This file is part of libigl, a simple c++ geometry processing library.
 //
 //
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// Copyright (C) 2016 Alec Jacobson <alecjacobson@gmail.com>
 //
 //
 // This Source Code Form is subject to the terms of the Mozilla Public License
 // 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
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can
@@ -12,8 +12,6 @@
 #include "find.h"
 #include "find.h"
 #include "sparse.h"
 #include "sparse.h"
 #include "repmat.h"
 #include "repmat.h"
-//#include "lu_lagrange.h"
-#include "full.h"
 #include "matlab_format.h"
 #include "matlab_format.h"
 #include "EPS.h"
 #include "EPS.h"
 #include "cat.h"
 #include "cat.h"
@@ -536,7 +534,7 @@ IGL_INLINE bool igl::min_quad_with_fixed_solve(
   const Eigen::PlainObjectBase<DerivedBeq> & Beq,
   const Eigen::PlainObjectBase<DerivedBeq> & Beq,
   Eigen::PlainObjectBase<DerivedZ> & Z)
   Eigen::PlainObjectBase<DerivedZ> & Z)
 {
 {
-  Eigen::PlainObjectBase<DerivedZ> sol;
+  Eigen::Matrix<typename DerivedZ::Scalar, Eigen::Dynamic, Eigen::Dynamic> sol;
   return min_quad_with_fixed_solve(data,B,Y,Beq,Z,sol);
   return min_quad_with_fixed_solve(data,B,Y,Beq,Z,sol);
 }
 }
 
 

+ 7 - 4
include/igl/mod.cpp

@@ -14,16 +14,19 @@ IGL_INLINE void igl::mod(
   Eigen::PlainObjectBase<DerivedB> & B)
   Eigen::PlainObjectBase<DerivedB> & B)
 {
 {
   B.resize(A.rows(),A.cols());
   B.resize(A.rows(),A.cols());
-  for(int i = 0;i<B.size();i++)
+  for(int i = 0;i<A.rows();i++)
   {
   {
-    *(B.data()+i) = (*(A.data()+i))%base;
+    for(int j = 0;j<A.cols();j++)
+    {
+      B(i,j) = A(i,j)%base;
+    }
   }
   }
 }
 }
 template <typename DerivedA>
 template <typename DerivedA>
-IGL_INLINE Eigen::PlainObjectBase<DerivedA> igl::mod(
+IGL_INLINE DerivedA igl::mod(
   const Eigen::PlainObjectBase<DerivedA> & A, const int base)
   const Eigen::PlainObjectBase<DerivedA> & A, const int base)
 {
 {
-  Eigen::PlainObjectBase<DerivedA> B;
+  DerivedA B;
   mod(A,base,B);
   mod(A,base,B);
   return B;
   return B;
 }
 }

+ 1 - 1
include/igl/mod.h

@@ -24,7 +24,7 @@ namespace igl
     const int base,
     const int base,
     Eigen::PlainObjectBase<DerivedB> & B);
     Eigen::PlainObjectBase<DerivedB> & B);
   template <typename DerivedA>
   template <typename DerivedA>
-  IGL_INLINE Eigen::PlainObjectBase<DerivedA> mod(
+  IGL_INLINE DerivedA mod(
     const Eigen::PlainObjectBase<DerivedA> & A, const int base);
     const Eigen::PlainObjectBase<DerivedA> & A, const int base);
 }
 }
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY

+ 1 - 0
include/igl/n_polyvector.cpp

@@ -39,6 +39,7 @@ namespace igl {
     Eigen::VectorXi indInteriorToFull;
     Eigen::VectorXi indInteriorToFull;
     Eigen::VectorXi indFullToInterior;
     Eigen::VectorXi indFullToInterior;
 
 
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedV> B1, B2, FN;
     Eigen::PlainObjectBase<DerivedV> B1, B2, FN;
 
 
     IGL_INLINE void computek();
     IGL_INLINE void computek();

+ 1 - 0
include/igl/n_polyvector_general.cpp

@@ -36,6 +36,7 @@ namespace igl {
     Eigen::VectorXi indInteriorToFull;
     Eigen::VectorXi indInteriorToFull;
     Eigen::VectorXi indFullToInterior;
     Eigen::VectorXi indFullToInterior;
 
 
+#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
     Eigen::PlainObjectBase<DerivedV> B1, B2, FN;
     Eigen::PlainObjectBase<DerivedV> B1, B2, FN;
 
 
     IGL_INLINE void computek();
     IGL_INLINE void computek();

+ 16 - 9
include/igl/per_corner_normals.cpp

@@ -11,23 +11,27 @@
 #include "per_face_normals.h"
 #include "per_face_normals.h"
 #include "PI.h"
 #include "PI.h"
 
 
-template <typename DerivedV, typename DerivedF>
+template <typename DerivedV, typename DerivedF, typename DerivedCN>
 IGL_INLINE void igl::per_corner_normals(
 IGL_INLINE void igl::per_corner_normals(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedF>& F,
   const Eigen::PlainObjectBase<DerivedF>& F,
   const double corner_threshold,
   const double corner_threshold,
-  Eigen::PlainObjectBase<DerivedV> & CN)
+  Eigen::PlainObjectBase<DerivedCN> & CN)
 {
 {
   using namespace Eigen;
   using namespace Eigen;
   using namespace std;
   using namespace std;
-  Eigen::PlainObjectBase<DerivedV> FN;
+  Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,3> FN;
   per_face_normals(V,F,FN);
   per_face_normals(V,F,FN);
   vector<vector<int> > VF,VFi;
   vector<vector<int> > VF,VFi;
   vertex_triangle_adjacency(V,F,VF,VFi);
   vertex_triangle_adjacency(V,F,VF,VFi);
   return per_corner_normals(V,F,FN,VF,corner_threshold,CN);
   return per_corner_normals(V,F,FN,VF,corner_threshold,CN);
 }
 }
 
 
-template <typename DerivedV, typename DerivedF, typename DerivedFN, typename DerivedCN>
+template <
+  typename DerivedV, 
+  typename DerivedF, 
+  typename DerivedFN, 
+  typename DerivedCN>
 IGL_INLINE void igl::per_corner_normals(
 IGL_INLINE void igl::per_corner_normals(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedF>& F,
   const Eigen::PlainObjectBase<DerivedF>& F,
@@ -42,14 +46,19 @@ IGL_INLINE void igl::per_corner_normals(
   return per_corner_normals(V,F,FN,VF,corner_threshold,CN);
   return per_corner_normals(V,F,FN,VF,corner_threshold,CN);
 }
 }
 
 
-template <typename DerivedV, typename DerivedF, typename IndexType>
+template <
+  typename DerivedV, 
+  typename DerivedF, 
+  typename DerivedFN, 
+  typename IndexType,
+  typename DerivedCN>
 IGL_INLINE void igl::per_corner_normals(
 IGL_INLINE void igl::per_corner_normals(
   const Eigen::PlainObjectBase<DerivedV>& /*V*/,
   const Eigen::PlainObjectBase<DerivedV>& /*V*/,
   const Eigen::PlainObjectBase<DerivedF>& F,
   const Eigen::PlainObjectBase<DerivedF>& F,
-  const Eigen::PlainObjectBase<DerivedV>& FN,
+  const Eigen::PlainObjectBase<DerivedFN>& FN,
   const std::vector<std::vector<IndexType> >& VF,
   const std::vector<std::vector<IndexType> >& VF,
   const double corner_threshold,
   const double corner_threshold,
-  Eigen::PlainObjectBase<DerivedV> & CN)
+  Eigen::PlainObjectBase<DerivedCN> & CN)
 {
 {
   using namespace Eigen;
   using namespace Eigen;
   using namespace std;
   using namespace std;
@@ -96,9 +105,7 @@ IGL_INLINE void igl::per_corner_normals(
 // Explicit template specialization
 // Explicit template specialization
 // generated by autoexplicit.sh
 // generated by autoexplicit.sh
 template void igl::per_corner_normals<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&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::per_corner_normals<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&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::per_corner_normals<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1>, unsigned int>(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, 3, 1, -1, 3> > const&, std::vector<std::vector<unsigned int, std::allocator<unsigned int> >, std::allocator<std::vector<unsigned int, std::allocator<unsigned int> > > > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&);
 template void igl::per_corner_normals<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<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> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::per_corner_normals<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<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> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::per_corner_normals<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, int>(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> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 template void igl::per_corner_normals<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&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 template void igl::per_corner_normals<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&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 template void igl::per_corner_normals<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::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> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 template void igl::per_corner_normals<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::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> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 #endif
 #endif

+ 10 - 5
include/igl/per_corner_normals.h

@@ -21,12 +21,12 @@ namespace igl
   // Output:
   // Output:
   //   CN  #F*3 by 3 eigen Matrix of mesh vertex 3D normals, where the normal
   //   CN  #F*3 by 3 eigen Matrix of mesh vertex 3D normals, where the normal
   //     for corner F(i,j) is at CN(i*3+j,:) 
   //     for corner F(i,j) is at CN(i*3+j,:) 
-  template <typename DerivedV, typename DerivedF>
+  template <typename DerivedV, typename DerivedF, typename DerivedCN>
   IGL_INLINE void per_corner_normals(
   IGL_INLINE void per_corner_normals(
     const Eigen::PlainObjectBase<DerivedV>& V,
     const Eigen::PlainObjectBase<DerivedV>& V,
     const Eigen::PlainObjectBase<DerivedF>& F,
     const Eigen::PlainObjectBase<DerivedF>& F,
     const double corner_threshold,
     const double corner_threshold,
-    Eigen::PlainObjectBase<DerivedV> & CN);
+    Eigen::PlainObjectBase<DerivedCN> & CN);
   // Other Inputs:
   // Other Inputs:
   //   FN  #F by 3 eigen Matrix of face normals
   //   FN  #F by 3 eigen Matrix of face normals
   template <
   template <
@@ -42,14 +42,19 @@ namespace igl
     Eigen::PlainObjectBase<DerivedCN> & CN);
     Eigen::PlainObjectBase<DerivedCN> & CN);
   // Other Inputs:
   // Other Inputs:
   //   VF  map from vertices to list of incident faces
   //   VF  map from vertices to list of incident faces
-  template <typename DerivedV, typename DerivedF, typename IndexType>
+  template <
+    typename DerivedV, 
+    typename DerivedF, 
+    typename DerivedFN, 
+    typename IndexType,
+    typename DerivedCN>
   IGL_INLINE void per_corner_normals(
   IGL_INLINE void per_corner_normals(
     const Eigen::PlainObjectBase<DerivedV>& V,
     const Eigen::PlainObjectBase<DerivedV>& V,
     const Eigen::PlainObjectBase<DerivedF>& F,
     const Eigen::PlainObjectBase<DerivedF>& F,
-    const Eigen::PlainObjectBase<DerivedV>& FN,
+    const Eigen::PlainObjectBase<DerivedFN>& FN,
     const std::vector<std::vector<IndexType> >& VF,
     const std::vector<std::vector<IndexType> >& VF,
     const double corner_threshold,
     const double corner_threshold,
-    Eigen::PlainObjectBase<DerivedV> & CN);
+    Eigen::PlainObjectBase<DerivedCN> & CN);
 }
 }
 
 
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY

+ 1 - 1
include/igl/per_edge_normals.cpp

@@ -90,7 +90,7 @@ IGL_INLINE void igl::per_edge_normals(
   Eigen::PlainObjectBase<DerivedE> & E,
   Eigen::PlainObjectBase<DerivedE> & E,
   Eigen::PlainObjectBase<DerivedEMAP> & EMAP)
   Eigen::PlainObjectBase<DerivedEMAP> & EMAP)
 {
 {
-  Eigen::PlainObjectBase<DerivedN> FN;
+  Eigen::Matrix<typename DerivedN::Scalar,Eigen::Dynamic,3> FN;
   per_face_normals(V,F,FN);
   per_face_normals(V,F,FN);
   return per_edge_normals(V,F,weighting,FN,N,E,EMAP);
   return per_edge_normals(V,F,weighting,FN,N,E,EMAP);
 }
 }

+ 2 - 0
include/igl/per_face_normals.cpp

@@ -106,6 +106,8 @@ IGL_INLINE void igl::per_face_normals_stable(
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
 // generated by autoexplicit.sh
 // generated by autoexplicit.sh
+template void igl::per_face_normals<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3>, Eigen::Matrix<float, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> >&);
+// generated by autoexplicit.sh
 template void igl::per_face_normals<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3>, Eigen::Matrix<float, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&);
 template void igl::per_face_normals<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3>, Eigen::Matrix<float, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&);
 template void igl::per_face_normals<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&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::per_face_normals<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&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::per_face_normals<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 3, 1, 0, 3, 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, 3, 1, 0, 3, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::per_face_normals<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 3, 1, 0, 3, 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, 3, 1, 0, 3, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);

+ 1 - 1
include/igl/per_vertex_normals.cpp

@@ -19,7 +19,7 @@ IGL_INLINE void igl::per_vertex_normals(
   const igl::PerVertexNormalsWeightingType weighting,
   const igl::PerVertexNormalsWeightingType weighting,
   Eigen::PlainObjectBase<DerivedV> & N)
   Eigen::PlainObjectBase<DerivedV> & N)
 {
 {
-  Eigen::PlainObjectBase<DerivedV> PFN;
+  Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,3> PFN;
   igl::per_face_normals(V,F,PFN);
   igl::per_face_normals(V,F,PFN);
   return per_vertex_normals(V,F,weighting,PFN,N);
   return per_vertex_normals(V,F,weighting,PFN,N);
 }
 }

+ 70 - 0
include/igl/piecewise_constant_winding_number.cpp

@@ -0,0 +1,70 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 Alec Jacobson
+// 
+// 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/.
+#include "piecewise_constant_winding_number.h"
+#include "unique_edge_map.h"
+
+template <
+  typename DerivedF,
+  typename DeriveduE,
+  typename uE2EType>
+IGL_INLINE bool igl::piecewise_constant_winding_number(
+  const Eigen::PlainObjectBase<DerivedF>& F,
+  const Eigen::PlainObjectBase<DeriveduE>& uE,
+  const std::vector<std::vector<uE2EType> >& uE2E)
+{
+  const size_t num_faces = F.rows();
+  const size_t num_edges = uE.rows();
+  const auto edge_index_to_face_index = [&](size_t ei)
+  {
+    return ei % num_faces;
+  };
+  const auto is_consistent = [&](size_t fid, size_t s, size_t d)
+  {
+    if ((size_t)F(fid, 0) == s && (size_t)F(fid, 1) == d) return true;
+    if ((size_t)F(fid, 1) == s && (size_t)F(fid, 2) == d) return true;
+    if ((size_t)F(fid, 2) == s && (size_t)F(fid, 0) == d) return true;
+
+    if ((size_t)F(fid, 0) == d && (size_t)F(fid, 1) == s) return false;
+    if ((size_t)F(fid, 1) == d && (size_t)F(fid, 2) == s) return false;
+    if ((size_t)F(fid, 2) == d && (size_t)F(fid, 0) == s) return false;
+    throw "Invalid face!!";
+  };
+  for (size_t i=0; i<num_edges; i++)
+  {
+    const size_t s = uE(i,0);
+    const size_t d = uE(i,1);
+    int count=0;
+    for (const auto& ei : uE2E[i])
+    {
+      const size_t fid = edge_index_to_face_index(ei);
+      if (is_consistent(fid, s, d))
+      {
+        count++;
+      }
+      else
+      {
+        count--;
+      }
+    }
+    if (count != 0)
+    {
+      return false;
+    }
+  }
+  return true;
+}
+template <typename DerivedF>
+IGL_INLINE bool igl::piecewise_constant_winding_number(
+  const Eigen::PlainObjectBase<DerivedF>& F)
+{
+  Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,2> E, uE;
+  Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,1> EMAP;
+  std::vector<std::vector<size_t> > uE2E;
+  unique_edge_map(F, E, uE, EMAP, uE2E);
+  return piecewise_constant_winding_number(F,uE,uE2E);
+}

+ 49 - 0
include/igl/piecewise_constant_winding_number.h

@@ -0,0 +1,49 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 Alec Jacobson
+// 
+// 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_PIECEWISE_CONSTANT_WINDING_NUMBER_H
+#define IGL_PIECEWISE_CONSTANT_WINDING_NUMBER_H
+#include "igl_inline.h"
+#include <Eigen/Core>
+#include <vector>
+namespace igl
+{
+  // PIECEWISE_CONSTANT_WINDING_NUMBER Determine if a given mesh induces a
+  // piecewise constant winding number field: Is this mesh valid input to solid
+  // set operations.  **Assumes** that `(V,F)` contains no self-intersections
+  // (including degeneracies and co-incidences).  If there are co-planar and
+  // co-incident vertex placements, a mesh could _fail_ this combinatorial test
+  // but still induce a piecewise-constant winding number _geometrically_. For
+  // example, consider a hemisphere with boundary and then pinch the boundary
+  // "shut" along a line segment. The **_bullet-proof_** check is to first
+  // resolve all self-intersections in `(V,F) -> (SV,SF)` (i.e. what the
+  // `igl::copyleft::cgal::piecewise_constant_winding_number` overload does).
+  //
+  // Inputs:
+  //   F  #F by 3 list of triangle indices into some (abstract) list of
+  //     vertices V
+  //   uE  #uE by 2 list of unique edges indices into V
+  //   uE2E  #uE list of lists of indices into directed edges (#F * 3)
+  // Returns true if the mesh _combinatorially_ induces a piecewise constant
+  // winding number field.
+  //
+  template <
+    typename DerivedF,
+    typename DeriveduE,
+    typename uE2EType>
+  IGL_INLINE bool piecewise_constant_winding_number(
+    const Eigen::PlainObjectBase<DerivedF>& F,
+    const Eigen::PlainObjectBase<DeriveduE>& uE,
+    const std::vector<std::vector<uE2EType> >& uE2E);
+  template <typename DerivedF>
+  IGL_INLINE bool piecewise_constant_winding_number(
+    const Eigen::PlainObjectBase<DerivedF>& F);
+}
+#ifndef IGL_STATIC_LIBRARY
+#  include "piecewise_constant_winding_number.cpp"
+#endif
+#endif

+ 2 - 2
include/igl/polar_dec.cpp

@@ -84,8 +84,8 @@ IGL_INLINE void igl::polar_dec(
   Eigen::PlainObjectBase<DerivedR> & R,
   Eigen::PlainObjectBase<DerivedR> & R,
   Eigen::PlainObjectBase<DerivedT> & T)
   Eigen::PlainObjectBase<DerivedT> & T)
 {
 {
-  Eigen::PlainObjectBase<DerivedA> U;
-  Eigen::PlainObjectBase<DerivedA> V;
+  DerivedA U;
+  DerivedA V;
   Eigen::Matrix<typename DerivedA::Scalar,DerivedA::RowsAtCompileTime,1> S;
   Eigen::Matrix<typename DerivedA::Scalar,DerivedA::RowsAtCompileTime,1> S;
   return igl::polar_dec(A,R,T,U,S,V);
   return igl::polar_dec(A,R,T,U,S,V);
 }
 }

+ 2 - 2
include/igl/polar_svd.cpp

@@ -20,8 +20,8 @@ IGL_INLINE void igl::polar_svd(
   Eigen::PlainObjectBase<DerivedR> & R,
   Eigen::PlainObjectBase<DerivedR> & R,
   Eigen::PlainObjectBase<DerivedT> & T)
   Eigen::PlainObjectBase<DerivedT> & T)
 {
 {
-  Eigen::PlainObjectBase<DerivedA> U;
-  Eigen::PlainObjectBase<DerivedA> V;
+  DerivedA U;
+  DerivedA V;
   Eigen::Matrix<typename DerivedA::Scalar,DerivedA::RowsAtCompileTime,1> S;
   Eigen::Matrix<typename DerivedA::Scalar,DerivedA::RowsAtCompileTime,1> S;
   return igl::polar_svd(A,R,T,U,S,V);
   return igl::polar_svd(A,R,T,U,S,V);
 }
 }

+ 1 - 1
include/igl/polar_svd3x3.cpp

@@ -85,7 +85,7 @@ IGL_INLINE void igl::polar_svd3x3_avx(const Eigen::Matrix<T, 3*8, 3>& A, Eigen::
     Eigen::Matrix3f Rpart_SSE = R.block(3*k, 0, 3, 3);
     Eigen::Matrix3f Rpart_SSE = R.block(3*k, 0, 3, 3);
     Eigen::Matrix3f diff = Rpart - Rpart_SSE;
     Eigen::Matrix3f diff = Rpart - Rpart_SSE;
     float diffNorm = diff.norm();
     float diffNorm = diff.norm();
-    if (abs(diffNorm) > 0.001)
+    if (std::abs(diffNorm) > 0.001)
     {
     {
       printf("Huh: diffNorm = %15f (k = %i)\n", diffNorm, k);
       printf("Huh: diffNorm = %15f (k = %i)\n", diffNorm, k);
     }
     }

+ 1 - 1
include/igl/polyvector_field_comb_from_matchings_and_cuts.cpp

@@ -96,7 +96,7 @@ IGL_INLINE void igl::polyvector_field_comb_from_matchings_and_cuts(
   Eigen::PlainObjectBase<DerivedS> &sol3D_combed)
   Eigen::PlainObjectBase<DerivedS> &sol3D_combed)
   {
   {
     Eigen::MatrixXi TT, TTi;
     Eigen::MatrixXi TT, TTi;
-    igl::triangle_triangle_adjacency(V,F,TT,TTi);
+    igl::triangle_triangle_adjacency(F,TT,TTi);
 
 
     Eigen::MatrixXi E, E2F, F2E;
     Eigen::MatrixXi E, E2F, F2E;
     igl::edge_topology(V,F,E,F2E,E2F);
     igl::edge_topology(V,F,E,F2E,E2F);

+ 1 - 1
include/igl/polyvector_field_cut_mesh_with_singularities.cpp

@@ -91,7 +91,7 @@ IGL_INLINE void igl::polyvector_field_cut_mesh_with_singularities(
   igl::adjacency_list(F, VV);
   igl::adjacency_list(F, VV);
 
 
   Eigen::MatrixXi TT, TTi;
   Eigen::MatrixXi TT, TTi;
-  igl::triangle_triangle_adjacency(V,F,TT,TTi);
+  igl::triangle_triangle_adjacency(F,TT,TTi);
 
 
   igl::polyvector_field_cut_mesh_with_singularities(V, F, VF, VV, TT, TTi, singularities, cuts);
   igl::polyvector_field_cut_mesh_with_singularities(V, F, VF, VV, TT, TTi, singularities, cuts);
 
 

+ 2 - 1
include/igl/polyvector_field_matchings.cpp

@@ -168,7 +168,8 @@ IGL_INLINE typename DerivedC::Scalar igl::polyvector_field_matchings(
   Eigen::MatrixXi E, E2F, F2E;
   Eigen::MatrixXi E, E2F, F2E;
   igl::edge_topology(V,F,E,F2E,E2F);
   igl::edge_topology(V,F,E,F2E,E2F);
 
 
-  Eigen::PlainObjectBase<DerivedV> FN;
+#warning "Poor templating of igl::polyvector_field_matchings forces FN to be DerivedV (this could cause issues if DerivedV has fixed number of rows)"
+  DerivedV FN;
   igl::per_face_normals(V,F,FN);
   igl::per_face_normals(V,F,FN);
 
 
   return igl::polyvector_field_matchings(sol3D, V, F, E, FN, E2F, match_with_curl, match_ab, match_ba, curl);
   return igl::polyvector_field_matchings(sol3D, V, F, E, FN, E2F, match_with_curl, match_ab, match_ba, curl);

+ 1 - 1
include/igl/polyvector_field_singularities_from_matchings.cpp

@@ -80,7 +80,7 @@ IGL_INLINE void igl::polyvector_field_singularities_from_matchings(
   igl::vertex_triangle_adjacency(V,F,VF,VFi);
   igl::vertex_triangle_adjacency(V,F,VF,VFi);
 
 
   Eigen::MatrixXi TT, TTi;
   Eigen::MatrixXi TT, TTi;
-  igl::triangle_triangle_adjacency(V,F,TT,TTi);
+  igl::triangle_triangle_adjacency(F,TT,TTi);
 
 
   Eigen::MatrixXi E, E2F, F2E;
   Eigen::MatrixXi E, E2F, F2E;
   igl::edge_topology(V,F,E,F2E,E2F);
   igl::edge_topology(V,F,E,F2E,E2F);

+ 9 - 9
include/igl/project_to_line.cpp

@@ -1,18 +1,18 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
 // 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 
+//
+// 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "project_to_line.h"
 #include "project_to_line.h"
 #include <cassert>
 #include <cassert>
 #include <Eigen/Core>
 #include <Eigen/Core>
 
 
 template <
 template <
-  typename MatP, 
-  typename MatL, 
-  typename Matt, 
+  typename MatP,
+  typename MatL,
+  typename Matt,
   typename MatsqrD>
   typename MatsqrD>
 IGL_INLINE void igl::project_to_line(
 IGL_INLINE void igl::project_to_line(
   const MatP & P,
   const MatP & P,
@@ -38,11 +38,11 @@ IGL_INLINE void igl::project_to_line(
   // resize output
   // resize output
   t.resize(np,1);
   t.resize(np,1);
   sqrD.resize(np,1);
   sqrD.resize(np,1);
-  // loop over points 
+  // loop over points
 #pragma omp parallel for if (np>10000)
 #pragma omp parallel for if (np>10000)
   for(int i = 0;i<np;i++)
   for(int i = 0;i<np;i++)
   {
   {
-    MatL Pi = P.row(i);
+    MatP Pi = P.row(i);
     // vector from point i to source
     // vector from point i to source
     MatL SmPi = S-Pi;
     MatL SmPi = S-Pi;
     t(i) = -(DmS.array()*SmPi.array()).sum() / v_sqrlen;
     t(i) = -(DmS.array()*SmPi.array()).sum() / v_sqrlen;

+ 9 - 9
include/igl/project_to_line_segment.cpp

@@ -1,19 +1,19 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
 // 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 
+//
+// 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "project_to_line_segment.h"
 #include "project_to_line_segment.h"
 #include "project_to_line.h"
 #include "project_to_line.h"
 #include <Eigen/Core>
 #include <Eigen/Core>
 
 
 template <
 template <
-  typename DerivedP, 
-  typename DerivedS, 
-  typename DerivedD, 
-  typename Derivedt, 
+  typename DerivedP,
+  typename DerivedS,
+  typename DerivedD,
+  typename Derivedt,
   typename DerivedsqrD>
   typename DerivedsqrD>
 IGL_INLINE void igl::project_to_line_segment(
 IGL_INLINE void igl::project_to_line_segment(
   const Eigen::PlainObjectBase<DerivedP> & P,
   const Eigen::PlainObjectBase<DerivedP> & P,
@@ -28,7 +28,7 @@ IGL_INLINE void igl::project_to_line_segment(
 #pragma omp parallel for if (np>10000)
 #pragma omp parallel for if (np>10000)
   for(int p = 0;p<np;p++)
   for(int p = 0;p<np;p++)
   {
   {
-    const Eigen::PlainObjectBase<DerivedS> Pp = P.row(p);
+    const Eigen::PlainObjectBase<DerivedP> Pp = P.row(p);
     if(t(p)<0)
     if(t(p)<0)
     {
     {
       sqrD(p) = (Pp-S).squaredNorm();
       sqrD(p) = (Pp-S).squaredNorm();

+ 8 - 8
include/igl/randperm.cpp

@@ -20,16 +20,16 @@ IGL_INLINE void igl::randperm(
   std::random_shuffle(I.data(),I.data()+n);
   std::random_shuffle(I.data(),I.data()+n);
 }
 }
 
 
-template <typename DerivedI>
-IGL_INLINE Eigen::PlainObjectBase<DerivedI> igl::randperm( const int n)
-{
-  Eigen::PlainObjectBase<DerivedI> I;
-  randperm(n,I);
-  return I;
-}
+//template <typename DerivedI>
+//IGL_INLINE Eigen::PlainObjectBase<DerivedI> igl::randperm( const int n)
+//{
+//  Eigen::PlainObjectBase<DerivedI> I;
+//  randperm(n,I);
+//  return I;
+//}
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
 template void igl::randperm<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 template void igl::randperm<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > igl::randperm<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(int);
+//template Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > igl::randperm<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(int);
 #endif
 #endif

+ 2 - 2
include/igl/randperm.h

@@ -21,8 +21,8 @@ namespace igl
   IGL_INLINE void randperm(
   IGL_INLINE void randperm(
     const int n,
     const int n,
     Eigen::PlainObjectBase<DerivedI> & I);
     Eigen::PlainObjectBase<DerivedI> & I);
-  template <typename DerivedI>
-  IGL_INLINE Eigen::PlainObjectBase<DerivedI> randperm( const int n);
+  //template <typename DerivedI>
+  //IGL_INLINE DerivedI randperm( const int n);
 }
 }
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY
 #  include "randperm.cpp"
 #  include "randperm.cpp"

+ 1 - 1
include/igl/remove_duplicate_vertices.cpp

@@ -26,7 +26,7 @@ IGL_INLINE void igl::remove_duplicate_vertices(
 {
 {
   if(epsilon > 0)
   if(epsilon > 0)
   {
   {
-    Eigen::PlainObjectBase<DerivedV> rV,rSV;
+    DerivedV rV,rSV;
     round((V/(10.0*epsilon)).eval(),rV);
     round((V/(10.0*epsilon)).eval(),rV);
     unique_rows(rV,rSV,SVI,SVJ);
     unique_rows(rV,rSV,SVI,SVJ);
     slice(V,SVI,colon<int>(0,V.cols()-1),SV);
     slice(V,SVI,colon<int>(0,V.cols()-1),SV);

+ 11 - 11
include/igl/slice.cpp

@@ -225,22 +225,22 @@ IGL_INLINE void igl::slice(
 }
 }
 
 
 template <typename DerivedX>
 template <typename DerivedX>
-IGL_INLINE Eigen::PlainObjectBase<DerivedX> igl::slice(
+IGL_INLINE DerivedX igl::slice(
   const Eigen::PlainObjectBase<DerivedX> & X,
   const Eigen::PlainObjectBase<DerivedX> & X,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R)
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R)
 {
 {
-  Eigen::PlainObjectBase<DerivedX> Y;
+  DerivedX Y;
   igl::slice(X,R,Y);
   igl::slice(X,R,Y);
   return Y;
   return Y;
 }
 }
 
 
 template <typename DerivedX>
 template <typename DerivedX>
-IGL_INLINE Eigen::PlainObjectBase<DerivedX> igl::slice(
+IGL_INLINE DerivedX igl::slice(
   const Eigen::PlainObjectBase<DerivedX>& X,
   const Eigen::PlainObjectBase<DerivedX>& X,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
   const int dim)
   const int dim)
 {
 {
-  Eigen::PlainObjectBase<DerivedX> Y;
+  DerivedX Y;
   igl::slice(X,R,dim,Y);
   igl::slice(X,R,dim,Y);
   return Y;
   return Y;
 }
 }
@@ -248,14 +248,14 @@ IGL_INLINE Eigen::PlainObjectBase<DerivedX> igl::slice(
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
 // generated by autoexplicit.sh
 // generated by autoexplicit.sh
-template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
-template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
-template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&);
-template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > igl::slice<Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
-template Eigen::PlainObjectBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> > igl::slice<Eigen::Matrix<double, 1, -1, 1, 1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
-template Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > igl::slice<Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
+template Eigen::Matrix<double, -1, 1, 0, -1, 1>  igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
+template Eigen::Matrix<double, -1, -1, 0, -1, -1>  igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
+template Eigen::Matrix<double, -1, 1, 0, -1, 1>  igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&);
+template Eigen::Matrix<double, -1, 3, 0, -1, 3>  igl::slice<Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
+template Eigen::Matrix<double, 1, -1, 1, 1, -1>  igl::slice<Eigen::Matrix<double, 1, -1, 1, 1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
+template Eigen::Matrix<int, -1, 3, 0, -1, 3>  igl::slice<Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
+template Eigen::Matrix<int, -1, -1, 0, -1, -1 > igl::slice<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
 template void igl::slice<std::complex<double>, std::complex<double> >(Eigen::SparseMatrix<std::complex<double>, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<std::complex<double>, 0, int>&);
 template void igl::slice<std::complex<double>, std::complex<double> >(Eigen::SparseMatrix<std::complex<double>, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<std::complex<double>, 0, int>&);
-template Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > igl::slice<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
 template void igl::slice<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::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 template void igl::slice<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::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 template void igl::slice<double, double>(Eigen::SparseMatrix<double, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<double, 0, int>&);
 template void igl::slice<double, double>(Eigen::SparseMatrix<double, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<double, 0, int>&);
 template void igl::slice<Eigen::SparseMatrix<double, 0, int>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::SparseMatrix<double, 0, int> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, Eigen::SparseMatrix<double, 0, int>&);
 template void igl::slice<Eigen::SparseMatrix<double, 0, int>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::SparseMatrix<double, 0, int> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, Eigen::SparseMatrix<double, 0, int>&);

+ 7 - 2
include/igl/slice.h

@@ -63,12 +63,17 @@ namespace igl
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     Eigen::PlainObjectBase<DerivedY> & Y);
     Eigen::PlainObjectBase<DerivedY> & Y);
   // VectorXi Y = slice(X,R);
   // VectorXi Y = slice(X,R);
+  //
+  // This templating is bad because the return type might not have the same
+  // size as `DerivedX`. This will probably only work if DerivedX has Dynamic
+  // as it's non-trivial sizes or if the number of rows in R happens to equal
+  // the number of rows in `DerivedX`.
   template <typename DerivedX>
   template <typename DerivedX>
-  IGL_INLINE Eigen::PlainObjectBase<DerivedX> slice(
+  IGL_INLINE DerivedX slice(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R);
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R);
   template <typename DerivedX>
   template <typename DerivedX>
-  IGL_INLINE Eigen::PlainObjectBase<DerivedX> slice(
+  IGL_INLINE DerivedX slice(
     const Eigen::PlainObjectBase<DerivedX>& X,
     const Eigen::PlainObjectBase<DerivedX>& X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const int dim);
     const int dim);

+ 4 - 4
include/igl/slice_mask.cpp

@@ -94,23 +94,23 @@ IGL_INLINE void igl::slice_mask(
 }
 }
 
 
 template <typename DerivedX>
 template <typename DerivedX>
-IGL_INLINE Eigen::PlainObjectBase<DerivedX> igl::slice_mask(
+IGL_INLINE DerivedX igl::slice_mask(
   const Eigen::PlainObjectBase<DerivedX> & X,
   const Eigen::PlainObjectBase<DerivedX> & X,
   const Eigen::Array<bool,Eigen::Dynamic,1> & R,
   const Eigen::Array<bool,Eigen::Dynamic,1> & R,
   const Eigen::Array<bool,Eigen::Dynamic,1> & C)
   const Eigen::Array<bool,Eigen::Dynamic,1> & C)
 {
 {
-  Eigen::PlainObjectBase<DerivedX> Y;
+  DerivedX Y;
   igl::slice_mask(X,R,C,Y);
   igl::slice_mask(X,R,C,Y);
   return Y;
   return Y;
 }
 }
 
 
 template <typename DerivedX>
 template <typename DerivedX>
-IGL_INLINE Eigen::PlainObjectBase<DerivedX> igl::slice_mask(
+IGL_INLINE DerivedX igl::slice_mask(
   const Eigen::PlainObjectBase<DerivedX>& X,
   const Eigen::PlainObjectBase<DerivedX>& X,
   const Eigen::Array<bool,Eigen::Dynamic,1> & R,
   const Eigen::Array<bool,Eigen::Dynamic,1> & R,
   const int dim)
   const int dim)
 {
 {
-  Eigen::PlainObjectBase<DerivedX> Y;
+  DerivedX Y;
   igl::slice_mask(X,R,dim,Y);
   igl::slice_mask(X,R,dim,Y);
   return Y;
   return Y;
 }
 }

+ 7 - 3
include/igl/slice_mask.h

@@ -37,14 +37,18 @@ namespace igl
     const Eigen::Array<bool,Eigen::Dynamic,1> & R,
     const Eigen::Array<bool,Eigen::Dynamic,1> & R,
     const int dim,
     const int dim,
     Eigen::PlainObjectBase<DerivedX> & Y);
     Eigen::PlainObjectBase<DerivedX> & Y);
-
+  //
+  // This templating is bad because the return type might not have the same
+  // size as `DerivedX`. This will probably only work if DerivedX has Dynamic
+  // as it's non-trivial sizes or if the number of rows in R happens to equal
+  // the number of rows in `DerivedX`.
   template <typename DerivedX>
   template <typename DerivedX>
-  IGL_INLINE Eigen::PlainObjectBase<DerivedX> slice_mask(
+  IGL_INLINE DerivedX slice_mask(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Array<bool,Eigen::Dynamic,1> & R,
     const Eigen::Array<bool,Eigen::Dynamic,1> & R,
     const Eigen::Array<bool,Eigen::Dynamic,1> & C);
     const Eigen::Array<bool,Eigen::Dynamic,1> & C);
   template <typename DerivedX>
   template <typename DerivedX>
-  IGL_INLINE Eigen::PlainObjectBase<DerivedX> slice_mask(
+  IGL_INLINE DerivedX slice_mask(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Array<bool,Eigen::Dynamic,1> & R,
     const Eigen::Array<bool,Eigen::Dynamic,1> & R,
     const int dim);
     const int dim);

+ 4 - 0
include/igl/sort.cpp

@@ -213,6 +213,10 @@ IGL_INLINE void igl::sort(
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
 // generated by autoexplicit.sh
 // generated by autoexplicit.sh
+template void igl::sort<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+// generated by autoexplicit.sh
+template void igl::sort<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, 3, 0, -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, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+// generated by autoexplicit.sh
 template void igl::sort<int>(std::vector<int, std::allocator<int> > const&, bool, std::vector<int, std::allocator<int> >&, std::vector<unsigned long, std::allocator<unsigned long> >&);
 template void igl::sort<int>(std::vector<int, std::allocator<int> > const&, bool, std::vector<int, std::allocator<int> >&, std::vector<unsigned long, std::allocator<unsigned long> >&);
 
 
 // generated by autoexplicit.sh
 // generated by autoexplicit.sh

+ 36 - 65
include/igl/triangle_triangle_adjacency.cpp

@@ -13,19 +13,40 @@
 #include <algorithm>
 #include <algorithm>
 #include <iostream>
 #include <iostream>
 
 
-template <typename Scalar, typename Index>
-IGL_INLINE void igl::triangle_triangle_adjacency_preprocess(
-    const Eigen::PlainObjectBase<Scalar>& /*V*/,
-    const Eigen::PlainObjectBase<Index>& F,
-    std::vector<std::vector<int> >& TTT)
+// Extract the face adjacencies
+template <typename DerivedF, typename TTT_type, typename DerivedTT>
+IGL_INLINE void igl::triangle_triangle_adjacency_extractTT(
+  const Eigen::PlainObjectBase<DerivedF>& F,
+  std::vector<std::vector<TTT_type> >& TTT,
+  Eigen::PlainObjectBase<DerivedTT>& TT)
+{
+  TT.setConstant((int)(F.rows()),F.cols(),-1);
+
+  for(int i=1;i<(int)TTT.size();++i)
+  {
+    std::vector<int>& r1 = TTT[i-1];
+    std::vector<int>& r2 = TTT[i];
+    if ((r1[0] == r2[0]) && (r1[1] == r2[1]))
+    {
+      TT(r1[2],r1[3]) = r2[2];
+      TT(r2[2],r2[3]) = r1[2];
+    }
+  }
+}
+
+template <typename DerivedF, typename DerivedTT>
+IGL_INLINE void igl::triangle_triangle_adjacency(
+  const Eigen::PlainObjectBase<DerivedF>& F,
+  Eigen::PlainObjectBase<DerivedTT>& TT)
 {
 {
-  return triangle_triangle_adjacency_preprocess(F,TTT);
+  DerivedTT TTi;
+  return triangle_triangle_adjacency(F,TT,TTi);
 }
 }
 
 
-template <typename Index>
+template <typename DerivedF, typename TTT_type>
 IGL_INLINE void igl::triangle_triangle_adjacency_preprocess(
 IGL_INLINE void igl::triangle_triangle_adjacency_preprocess(
-    const Eigen::PlainObjectBase<Index>& F,
-    std::vector<std::vector<int> >& TTT)
+  const Eigen::PlainObjectBase<DerivedF>& F,
+  std::vector<std::vector<TTT_type> >& TTT)
 {
 {
   for(int f=0;f<F.rows();++f)
   for(int f=0;f<F.rows();++f)
     for (int i=0;i<F.cols();++i)
     for (int i=0;i<F.cols();++i)
@@ -42,32 +63,11 @@ IGL_INLINE void igl::triangle_triangle_adjacency_preprocess(
   std::sort(TTT.begin(),TTT.end());
   std::sort(TTT.begin(),TTT.end());
 }
 }
 
 
-// Extract the face adjacencies
-template <typename DerivedF, typename DerivedTT>
-IGL_INLINE void igl::triangle_triangle_adjacency_extractTT(
-  const Eigen::PlainObjectBase<DerivedF>& F,
-  std::vector<std::vector<int> >& TTT,
-  Eigen::PlainObjectBase<DerivedTT>& TT)
-{
-  TT.setConstant((int)(F.rows()),F.cols(),-1);
-
-  for(int i=1;i<(int)TTT.size();++i)
-  {
-    std::vector<int>& r1 = TTT[i-1];
-    std::vector<int>& r2 = TTT[i];
-    if ((r1[0] == r2[0]) && (r1[1] == r2[1]))
-    {
-      TT(r1[2],r1[3]) = r2[2];
-      TT(r2[2],r2[3]) = r1[2];
-    }
-  }
-}
-
 // Extract the face adjacencies indices (needed for fast traversal)
 // Extract the face adjacencies indices (needed for fast traversal)
-template <typename DerivedF, typename DerivedTTi>
+template <typename DerivedF, typename TTT_type, typename DerivedTTi>
 IGL_INLINE void igl::triangle_triangle_adjacency_extractTTi(
 IGL_INLINE void igl::triangle_triangle_adjacency_extractTTi(
   const Eigen::PlainObjectBase<DerivedF>& F,
   const Eigen::PlainObjectBase<DerivedF>& F,
-  std::vector<std::vector<int> >& TTT,
+  std::vector<std::vector<TTT_type> >& TTT,
   Eigen::PlainObjectBase<DerivedTTi>& TTi)
   Eigen::PlainObjectBase<DerivedTTi>& TTi)
 {
 {
   TTi.setConstant((int)(F.rows()),F.cols(),-1);
   TTi.setConstant((int)(F.rows()),F.cols(),-1);
@@ -84,34 +84,6 @@ IGL_INLINE void igl::triangle_triangle_adjacency_extractTTi(
   }
   }
 }
 }
 
 
-// Compute triangle-triangle adjacency
-template <typename Scalar, typename Index>
-IGL_INLINE void igl::triangle_triangle_adjacency(const Eigen::PlainObjectBase<Scalar>& V,
-                        const Eigen::PlainObjectBase<Index>& F,
-                        Eigen::PlainObjectBase<Index>& TT)
-{
-  //assert(igl::is_edge_manifold(V,F));
-  std::vector<std::vector<int> > TTT;
-
-  triangle_triangle_adjacency_preprocess(V,F,TTT);
-  triangle_triangle_adjacency_extractTT(F,TTT,TT);
-}
-
-// Compute triangle-triangle adjacency with indices
-template <typename Scalar, typename Index>
-IGL_INLINE void igl::triangle_triangle_adjacency(
-  const Eigen::PlainObjectBase<Scalar>& /*V*/,
-  const Eigen::PlainObjectBase<Index>& F,
-  Eigen::PlainObjectBase<Index>& TT,
-  Eigen::PlainObjectBase<Index>& TTi)
-{
-  //assert(igl::is_edge_manifold(V,F));
-  std::vector<std::vector<int> > TTT;
-  triangle_triangle_adjacency_preprocess(F,TTT);
-  triangle_triangle_adjacency_extractTT(F,TTT,TT);
-  triangle_triangle_adjacency_extractTTi(F,TTT,TTi);
-}
-
 // Compute triangle-triangle adjacency with indices
 // Compute triangle-triangle adjacency with indices
 template <typename DerivedF, typename DerivedTT, typename DerivedTTi>
 template <typename DerivedF, typename DerivedTT, typename DerivedTTi>
 IGL_INLINE void igl::triangle_triangle_adjacency(
 IGL_INLINE void igl::triangle_triangle_adjacency(
@@ -119,7 +91,6 @@ IGL_INLINE void igl::triangle_triangle_adjacency(
   Eigen::PlainObjectBase<DerivedTT>& TT,
   Eigen::PlainObjectBase<DerivedTT>& TT,
   Eigen::PlainObjectBase<DerivedTTi>& TTi)
   Eigen::PlainObjectBase<DerivedTTi>& TTi)
 {
 {
-  //assert(igl::is_edge_manifold(V,F));
   std::vector<std::vector<int> > TTT;
   std::vector<std::vector<int> > TTT;
   triangle_triangle_adjacency_preprocess(F,TTT);
   triangle_triangle_adjacency_preprocess(F,TTT);
   triangle_triangle_adjacency_extractTT(F,TTT,TT);
   triangle_triangle_adjacency_extractTT(F,TTT,TT);
@@ -235,10 +206,10 @@ template <
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
-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> >&);
-template void igl::triangle_triangle_adjacency<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&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template void igl::triangle_triangle_adjacency<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&, 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<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> >&);
+// generated by autoexplicit.sh
+template void igl::triangle_triangle_adjacency<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> >&);
+// generated by autoexplicit.sh
+template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, 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, -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, 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::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> > > > > >&);
 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> > > > > >&);

+ 13 - 30
include/igl/triangle_triangle_adjacency.h

@@ -22,7 +22,6 @@ namespace igl
   //   Index  derived type of eigen matrix for F (e.g. derived from
   //   Index  derived type of eigen matrix for F (e.g. derived from
   //     MatrixXi)
   //     MatrixXi)
   // Inputs:
   // Inputs:
-  //   V  #V by dim list of mesh vertex positions
   //   F  #F by simplex_size list of mesh faces (must be triangles)
   //   F  #F by simplex_size list of mesh faces (must be triangles)
   // Outputs:
   // Outputs:
   //   TT   #F by #3 adjacent matrix, the element i,j is the id of the triangle adjacent to the j edge of triangle i
   //   TT   #F by #3 adjacent matrix, the element i,j is the id of the triangle adjacent to the j edge of triangle i
@@ -30,56 +29,40 @@ namespace igl
   // NOTE: the first edge of a triangle is [0,1] the second [1,2] and the third [2,3].
   // NOTE: the first edge of a triangle is [0,1] the second [1,2] and the third [2,3].
   //       this convention is DIFFERENT from cotmatrix_entries.h
   //       this convention is DIFFERENT from cotmatrix_entries.h
   // Known bug: this should not need to take V as input.
   // Known bug: this should not need to take V as input.
-
-  template <typename Scalar, typename Index>
-  IGL_INLINE void triangle_triangle_adjacency(
-    const Eigen::PlainObjectBase<Scalar>& V,
-    const Eigen::PlainObjectBase<Index>& F,
-    Eigen::PlainObjectBase<Index>& TT);
-  // Compute triangle-triangle adjacency with indices
-  template <typename Scalar, typename Index>
-  IGL_INLINE void triangle_triangle_adjacency(
-    const Eigen::PlainObjectBase<Scalar>& V,
-    const Eigen::PlainObjectBase<Index>& F,
-    Eigen::PlainObjectBase<Index>& TT,
-    Eigen::PlainObjectBase<Index>& TTi);
-
   template <typename DerivedF, typename DerivedTT, typename DerivedTTi>
   template <typename DerivedF, typename DerivedTT, typename DerivedTTi>
   IGL_INLINE void triangle_triangle_adjacency(
   IGL_INLINE void triangle_triangle_adjacency(
     const Eigen::PlainObjectBase<DerivedF>& F,
     const Eigen::PlainObjectBase<DerivedF>& F,
     Eigen::PlainObjectBase<DerivedTT>& TT,
     Eigen::PlainObjectBase<DerivedTT>& TT,
     Eigen::PlainObjectBase<DerivedTTi>& TTi);
     Eigen::PlainObjectBase<DerivedTTi>& TTi);
-
-
+  template <typename DerivedF, typename DerivedTT>
+  IGL_INLINE void triangle_triangle_adjacency(
+    const Eigen::PlainObjectBase<DerivedF>& F,
+    Eigen::PlainObjectBase<DerivedTT>& TT);
   // Preprocessing
   // Preprocessing
-  template <typename Scalar, typename Index>
-  IGL_INLINE void triangle_triangle_adjacency_preprocess(
-    const Eigen::PlainObjectBase<Scalar>& V,
-    const Eigen::PlainObjectBase<Index>& F,
-    std::vector<std::vector<int> >& TTT);
-  template <typename DerivedF>
+  template <typename DerivedF, typename TTT_type>
   IGL_INLINE void triangle_triangle_adjacency_preprocess(
   IGL_INLINE void triangle_triangle_adjacency_preprocess(
     const Eigen::PlainObjectBase<DerivedF>& F,
     const Eigen::PlainObjectBase<DerivedF>& F,
-    std::vector<std::vector<int> >& TTT);
+    std::vector<std::vector<TTT_type> >& TTT);
   // Extract the face adjacencies
   // Extract the face adjacencies
-  template <typename DerivedF, typename DerivedTT>
+  template <typename DerivedF, typename TTT_type, typename DerivedTT>
   IGL_INLINE void triangle_triangle_adjacency_extractTT(
   IGL_INLINE void triangle_triangle_adjacency_extractTT(
     const Eigen::PlainObjectBase<DerivedF>& F,
     const Eigen::PlainObjectBase<DerivedF>& F,
-    std::vector<std::vector<int> >& TTT,
+    std::vector<std::vector<TTT_type> >& TTT,
     Eigen::PlainObjectBase<DerivedTT>& TT);
     Eigen::PlainObjectBase<DerivedTT>& TT);
   // Extract the face adjacencies indices (needed for fast traversal)
   // Extract the face adjacencies indices (needed for fast traversal)
-  template <typename DerivedF, typename DerivedTTi>
+  template <typename DerivedF, typename TTT_type, typename DerivedTTi>
   IGL_INLINE void triangle_triangle_adjacency_extractTTi(
   IGL_INLINE void triangle_triangle_adjacency_extractTTi(
     const Eigen::PlainObjectBase<DerivedF>& F,
     const Eigen::PlainObjectBase<DerivedF>& F,
-    std::vector<std::vector<int> >& TTT,
+    std::vector<std::vector<TTT_type> >& TTT,
     Eigen::PlainObjectBase<DerivedTTi>& TTi);
     Eigen::PlainObjectBase<DerivedTTi>& TTi);
   // Adjacency list version, which works with non-manifold meshes
   // Adjacency list version, which works with non-manifold meshes
   //
   //
   // Inputs:
   // Inputs:
   //   F  #F by 3 list of triangle indices
   //   F  #F by 3 list of triangle indices
   // Outputs:
   // Outputs:
-  //   TT  #F by 3 list of lists so that TT[i][c] --> {j,k,...} means that faces j and
-  //     k etc. are edge-neighbors of face i on face i's edge opposite corner c
+  //   TT  #F by 3 list of lists so that TT[i][c] --> {j,k,...} means that
+  //     faces j and k etc. are edge-neighbors of face i on face i's edge
+  //     opposite corner c
   //   TTj  #F list of lists so that TTj[i][c] --> {j,k,...} means that face
   //   TTj  #F list of lists so that TTj[i][c] --> {j,k,...} means that face
   //     TT[i][c][0] is an edge-neighbor of face i incident on the edge of face
   //     TT[i][c][0] is an edge-neighbor of face i incident on the edge of face
   //     TT[i][c][0] opposite corner j, and TT[i][c][1] " corner k, etc.
   //     TT[i][c][0] opposite corner j, and TT[i][c][1] " corner k, etc.

+ 1 - 1
include/igl/unique.cpp

@@ -209,7 +209,7 @@ IGL_INLINE void igl::unique_rows(
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
   VectorXi IM;
   VectorXi IM;
-  Eigen::PlainObjectBase<DerivedA> sortA;
+  DerivedA sortA;
   sortrows(A,true,sortA,IM);
   sortrows(A,true,sortA,IM);
 
 
 
 

+ 1 - 0
include/igl/vertex_triangle_adjacency.cpp

@@ -51,4 +51,5 @@ template void igl::vertex_triangle_adjacency<Eigen::Matrix<double, -1, 3, 0, -1,
 template void igl::vertex_triangle_adjacency<Eigen::Matrix<double, -1, -1, 0, -1, -1>, long, long>(Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&);
 template void igl::vertex_triangle_adjacency<Eigen::Matrix<double, -1, -1, 0, -1, -1>, long, long>(Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&);
 template void igl::vertex_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, long, long>(Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&);
 template void igl::vertex_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, long, long>(Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&);
 template void igl::vertex_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long, unsigned long>(Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, 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> > > >&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&);
 template void igl::vertex_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long, unsigned long>(Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, 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> > > >&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&);
+template void igl::vertex_triangle_adjacency<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
 #endif
 #endif

+ 3 - 2
include/igl/viewer/Viewer.cpp

@@ -159,9 +159,10 @@ static void glfw_mouse_move(GLFWwindow* window, double x, double y)
 {
 {
   if(
   if(
 #ifdef IGL_VIEWER_WITH_NANOGUI
 #ifdef IGL_VIEWER_WITH_NANOGUI
-      __viewer->screen->cursorPosCallbackEvent(x,y) == false || 
+      __viewer->screen->cursorPosCallbackEvent(x,y) == false &&
 #endif
 #endif
-      __viewer->down)
+      true
+    )
   {
   {
     __viewer->mouse_move(x*highdpi, y*highdpi);
     __viewer->mouse_move(x*highdpi, y*highdpi);
   }
   }

+ 1 - 1
include/igl/volume.cpp

@@ -46,7 +46,7 @@ IGL_INLINE void igl::volume(
   const auto & AmD = A-D;
   const auto & AmD = A-D;
   const auto & BmD = B-D;
   const auto & BmD = B-D;
   const auto & CmD = C-D;
   const auto & CmD = C-D;
-  Eigen::PlainObjectBase<DerivedA> BmDxCmD;
+  DerivedA BmDxCmD;
   cross(BmD.eval(),CmD.eval(),BmDxCmD);
   cross(BmD.eval(),CmD.eval(),BmDxCmD);
   const auto & AmDdx = (AmD.array() * BmDxCmD.array()).rowwise().sum();
   const auto & AmDdx = (AmD.array() * BmDxCmD.array()).rowwise().sum();
   vol = -AmDdx/6.;
   vol = -AmDdx/6.;

+ 76 - 3
style-guidelines.md

@@ -39,8 +39,6 @@ namespace igl
   // This is an example of a function, it takes a templated parameter and
   // This is an example of a function, it takes a templated parameter and
   // shovels it into cout
   // shovels it into cout
   //
   //
-  // Templates:
-  //   T  type that supports
   // Input:
   // Input:
   //   input  some input of a Printable type
   //   input  some input of a Printable type
   // Returns true for the sake of returning something
   // Returns true for the sake of returning something
@@ -164,7 +162,7 @@ than pointers (e.g. `Matrix * mat`) or value (e.g. `Matrix mat`).
 All functions should be implemented with at least one overload that has a
 All functions should be implemented with at least one overload that has a
 `void` or simple return type (e.g. `bool` on success/failure). With this
 `void` or simple return type (e.g. `bool` on success/failure). With this
 implementation its then possible to write an overload that returns a single
 implementation its then possible to write an overload that returns a single
-output.
+output. Please see [Templating with Eigen](#templatingwitheigen).
 
 
 For example:
 For example:
 
 
@@ -176,6 +174,81 @@ template <typename Atype>
 Eigen::SparseMatrix<Atype> adjacency_matrix(const ... & F);
 Eigen::SparseMatrix<Atype> adjacency_matrix(const ... & F);
 ```
 ```
 
 
+## Templating with Eigen
+
+Functions taking Eigen dense matrices/arrays as inputs and outputs (but **not**
+return arguments), should template on top of `Eigen::PlainObjectBase`. **Each
+parameter** should be derived using its own template.
+
+For example,
+
+```cpp
+template <typename DerivedV, typename DerivedF, typename DerivedBC>
+void barycenter(
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::PlainObjectBase<DerivedF> & F,
+  const Eigen::PlainObjectBase<DerivedBC> & BC);
+```
+
+The `Derived*` template encodes the scalar type (e.g. `double`, `int`), the
+number of rows and cols at compile time, and the data storage (Row-major vs.
+column-major). 
+
+Returning Eigen types is discouraged. In cases where the size and scalar type
+are a fixed **and matching** function of an input `Derived*` template, then
+return that `Derived*` type. **Do not** return
+`Eigen::PlainObjectBase<...>` types. For example, this function scales fits a
+given set of points to the unit cube. The return is a new set of vertex
+positions so its type should _match_ that of the input points:
+
+```cpp
+template <typename DerivedV>
+void DerivedV fit_to_unit_cube(const Eigen::PlainObjectBase<DerivedV> & V);
+```
+
+To implement this function, it is **required** to implement a more generic
+output-argument version and call that. So a full implementation looks like:
+
+In `igl/fit_in_unit_cube.h`:
+
+```cpp
+template <typename DerivedV, typename DerivedW>
+void fit_to_unit_cube(
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  Eigen::PlainObjectBase<DerivedW> & W);
+template <typename DerivedV>
+void DerivedV fit_to_unit_cube(const Eigen::PlainObjectBase<DerivedV> & V);
+```
+
+In `igl/fit_in_unit_cube.cpp`:
+
+```
+template <typename DerivedV, typename DerivedW>
+void fit_to_unit_cube(
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  Eigen::PlainObjectBase<DerivedW> & W)
+{
+  W = (V.rowwise()-V.colwise().minCoeff()).array() /
+    (V.maxCoeff()-V.minCoeff());
+}
+
+template <typename DerivedV>
+void DerivedV fit_to_unit_cube(const Eigen::PlainObjectBase<DerivedV> & V)
+{
+  DerivedV W;
+  fit_to_unit_cube(V,W);
+  return W;
+}
+```
+
+Notice that `W` is declared as a `DerivedV` type and **not**
+`Eigen::PlainObjectBase<DerivedV>` type.
+
+**Note:** Not all functions are suitable for returning Eigen types. For example
+`igl::barycenter` above outputs a #F by dim list of barycenters. Returning a
+`DerivedV` type would be inappropriate since the number of rows in `DerivedV`
+will be #V and may not match the number of rows in `DerivedF` (#F).
+
 ## Function naming conventions 
 ## Function naming conventions 
 
 
 Functions (and [thus also files](#filefunction)) should have simple,
 Functions (and [thus also files](#filefunction)) should have simple,

+ 12 - 8
tutorial/106_ViewerMenu/main.cpp

@@ -3,7 +3,7 @@
 int main()
 int main()
 {
 {
   std::cerr<<
   std::cerr<<
-    "Error: recompile with IGL_VIEWER_WITH_NANOGUI defined."<<std::endl;
+    "Error: recompile with LIBIGL_VIEWER_WITH_NANOGUI defined."<<std::endl;
   return EXIT_FAILURE;
   return EXIT_FAILURE;
 }
 }
 #else
 #else
@@ -15,14 +15,15 @@ int main()
 #include <iostream>
 #include <iostream>
 #include "tutorial_shared_path.h"
 #include "tutorial_shared_path.h"
 
 
-Eigen::MatrixXd V;
-Eigen::MatrixXi F;
-
-bool boolVariable = true;
-float floatVariable = 0.1f;
-
 int main(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
 {
+  Eigen::MatrixXd V;
+  Eigen::MatrixXi F;
+
+  bool boolVariable = true;
+  float floatVariable = 0.1f;
+  enum Orientation { Up=0,Down,Left,Right } dir = Up;
+
   // Load a mesh in OFF format
   // Load a mesh in OFF format
   igl::readOFF(TUTORIAL_SHARED_PATH "/bunny.off", V, F);
   igl::readOFF(TUTORIAL_SHARED_PATH "/bunny.off", V, F);
 
 
@@ -45,10 +46,13 @@ int main(int argc, char *argv[])
       return boolVariable; // get
       return boolVariable; // get
     });
     });
 
 
+    // Expose an enumaration type
+    viewer.ngui->addVariable<Orientation>("Direction",dir)->setItems({"Up","Down","Left","Right"});
+
     // Add a button
     // Add a button
     viewer.ngui->addButton("Print Hello",[](){ std::cout << "Hello\n"; });
     viewer.ngui->addButton("Print Hello",[](){ std::cout << "Hello\n"; });
 
 
-    // Add an additional bar
+    // Add an additional menu window
     viewer.ngui->addWindow(Eigen::Vector2i(220,10),"New Window");
     viewer.ngui->addWindow(Eigen::Vector2i(220,10),"New Window");
 
 
     // Expose the same variable directly ...
     // Expose the same variable directly ...

+ 1 - 1
tutorial/510_Integrable/main.cpp

@@ -633,7 +633,7 @@ int main(int argc, char *argv[])
   V_border = igl::is_border_vertex(V,F);
   V_border = igl::is_border_vertex(V,F);
   igl::adjacency_list(F, VV);
   igl::adjacency_list(F, VV);
   igl::vertex_triangle_adjacency(V,F,VF,VFi);
   igl::vertex_triangle_adjacency(V,F,VF,VFi);
-  igl::triangle_triangle_adjacency(V,F,TT,TTi);
+  igl::triangle_triangle_adjacency(F,TT,TTi);
   igl::edge_topology(V,F,E,F2E,E2F);
   igl::edge_topology(V,F,E,F2E,E2F);
 
 
   // Generate "subdivided" mesh for visualization of curl terms
   // Generate "subdivided" mesh for visualization of curl terms

+ 7 - 7
tutorial/608_LIM/main.cpp

@@ -7,6 +7,8 @@
 
 
 #include "tutorial_shared_path.h"
 #include "tutorial_shared_path.h"
 
 
+using namespace igl::lim;
+
 // Mesh
 // Mesh
 Eigen::MatrixX3d V0;
 Eigen::MatrixX3d V0;
 Eigen::MatrixX3d V1;
 Eigen::MatrixX3d V1;
@@ -15,7 +17,7 @@ Eigen::MatrixXi F;
 Eigen::SparseMatrix<double> C;
 Eigen::SparseMatrix<double> C;
 Eigen::VectorXd b;
 Eigen::VectorXd b;
 
 
-int energyType;
+Energy energyType;
 bool barriersEnabled;
 bool barriersEnabled;
 
 
 // This function is called every time a keyboard button is pressed
 // This function is called every time a keyboard button is pressed
@@ -28,7 +30,7 @@ bool key_down(igl::viewer::Viewer& viewer,unsigned char key,int modifier)
   if(key >= '0' && key <= '5' || key == 'B')
   if(key >= '0' && key <= '5' || key == 'B')
   {
   {
     // compute locally injective map
     // compute locally injective map
-    int energy = key - '1';
+    Energy energy = Energy(key - '1');
 
 
     V1 = V0;
     V1 = V0;
 
 
@@ -44,8 +46,7 @@ bool key_down(igl::viewer::Viewer& viewer,unsigned char key,int modifier)
 
 
     if(key != '0')
     if(key != '0')
     {
     {
-      igl::lim::lim(
-          V1,V0,F,C,b,energyType,1e-8,100,true,true,barriersEnabled,true,-1,-1);
+      lim(V1,V0,F,C,b,energyType,1e-8,100,true,true,barriersEnabled,true,-1,-1);
     }
     }
 
 
     // set mesh
     // set mesh
@@ -62,7 +63,7 @@ int main(int argc, char *argv[])
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
 
 
-  energyType = 0;
+  energyType = Dirichlet;
   barriersEnabled = true;
   barriersEnabled = true;
 
 
   // load a mesh in OFF format
   // load a mesh in OFF format
@@ -102,8 +103,7 @@ int main(int argc, char *argv[])
   b(2*fixedVertices.size()+1) = 0.2;
   b(2*fixedVertices.size()+1) = 0.2;
 
 
   // compute locally injective map
   // compute locally injective map
-  igl::lim::lim(
-    V1,V0,F,C,b,energyType,1e-8,100,true,true,barriersEnabled,true,-1,-1);
+  lim(V1,V0,F,C,b,energyType,1e-8,100,true,true,barriersEnabled,true,-1,-1);
 
 
   // Show mesh
   // Show mesh
   igl::viewer::Viewer viewer;
   igl::viewer::Viewer viewer;

+ 1 - 0
tutorial/609_Boolean/CMakeLists.txt

@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.6)
 project(609_Boolean)
 project(609_Boolean)
 
 
 find_package(CGAL REQUIRED)
 find_package(CGAL REQUIRED)
+set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "CGAL's CMAKE Setup is super annoying ")
 include(${CGAL_USE_FILE})
 include(${CGAL_USE_FILE})
 # CGAL's monkeying with all of the flags. Rather than change the CGAL_USE_FILE
 # CGAL's monkeying with all of the flags. Rather than change the CGAL_USE_FILE
 # just get ride of this flag.
 # just get ride of this flag.

+ 1 - 0
tutorial/610_CSGTree/CMakeLists.txt

@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.6)
 project(610_CSGTree)
 project(610_CSGTree)
 
 
 find_package(CGAL REQUIRED)
 find_package(CGAL REQUIRED)
+set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "CGAL's CMAKE Setup is super annoying ")
 include(${CGAL_USE_FILE})
 include(${CGAL_USE_FILE})
 # CGAL's monkeying with all of the flags. Rather than change the CGAL_USE_FILE
 # CGAL's monkeying with all of the flags. Rather than change the CGAL_USE_FILE
 # just get ride of this flag.
 # just get ride of this flag.

+ 1 - 1
tutorial/610_CSGTree/main.cpp

@@ -59,7 +59,7 @@ int main(int argc, char * argv[])
       default:
       default:
       {
       {
         CSGTree M;
         CSGTree M;
-        Matrix<long int,Dynamic,1> J;
+        Matrix<MatrixXi::Index,Dynamic,1> J;
         switch(view_id)
         switch(view_id)
         {
         {
           case 5:
           case 5:

+ 1 - 0
tutorial/CMakeLists.txt

@@ -34,6 +34,7 @@ find_package(MOSEK QUIET)
 find_package(TETGEN QUIET)
 find_package(TETGEN QUIET)
 find_package(TINYXML2 QUIET)
 find_package(TINYXML2 QUIET)
 find_package(TRIANGLE QUIET)
 find_package(TRIANGLE QUIET)
+find_package(LIM QUIET)
 
 
 message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
 message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
 include("CMakeLists.shared")
 include("CMakeLists.shared")

+ 3 - 0
tutorial/cmake/FindLIM.cmake

@@ -9,6 +9,7 @@ FIND_PATH(LIM_INCLUDE_DIR LIMSolverInterface.h
    /usr/include
    /usr/include
    /usr/local/include
    /usr/local/include
    ${PROJECT_SOURCE_DIR}/../libigl/external/lim/
    ${PROJECT_SOURCE_DIR}/../libigl/external/lim/
+   ${PROJECT_SOURCE_DIR}/../external/lim/
    ${PROJECT_SOURCE_DIR}/../../external/lim/
    ${PROJECT_SOURCE_DIR}/../../external/lim/
    NO_DEFAULT_PATH
    NO_DEFAULT_PATH
 )
 )
@@ -33,6 +34,8 @@ set(
   ${LIM_INCLUDE_DIR}/GreenStrain_LIMSolver3D.cpp
   ${LIM_INCLUDE_DIR}/GreenStrain_LIMSolver3D.cpp
   ${LIM_INCLUDE_DIR}/LSConformal_LIMSolver2D.cpp
   ${LIM_INCLUDE_DIR}/LSConformal_LIMSolver2D.cpp
   ${LIM_INCLUDE_DIR}/Poisson_LIMSolver2D.cpp
   ${LIM_INCLUDE_DIR}/Poisson_LIMSolver2D.cpp
+  ${LIM_INCLUDE_DIR}/Identity_LIMSolver2D.cpp
+  ${LIM_INCLUDE_DIR}/Identity_LIMSolver3D.cpp
   )
   )
 
 
 SET(LIM_FOUND "NO")
 SET(LIM_FOUND "NO")

+ 1 - 1
tutorial/tutorial.md.REMOVED.git-id

@@ -1 +1 @@
-e2e0d9675881ddf6a0d438a24c4ef1bb8f4b4791
+c1fd59bc7313c701b8e5c88150b65216c1ea30a5