Browse Source

fix warnings for Eigen's 'convenience' type `all` (#2421)

Alec Jacobson 1 year ago
parent
commit
5d93f800ba
49 changed files with 291 additions and 111 deletions
  1. 3 2
      include/igl/active_set.cpp
  2. 3 2
      include/igl/bijective_composite_harmonic_mapping.cpp
  3. 4 3
      include/igl/blue_noise.cpp
  4. 2 1
      include/igl/circumradius.cpp
  5. 2 1
      include/igl/copyleft/cgal/is_self_intersecting.cpp
  6. 7 6
      include/igl/copyleft/cgal/minkowski_sum.cpp
  7. 5 4
      include/igl/copyleft/cgal/point_areas.cpp
  8. 2 1
      include/igl/copyleft/cgal/point_solid_signed_squared_distance.cpp
  9. 4 3
      include/igl/copyleft/cgal/trim_with_solid.cpp
  10. 2 1
      include/igl/copyleft/cgal/wire_mesh.cpp
  11. 2 1
      include/igl/decimate.cpp
  12. 2 1
      include/igl/ears.cpp
  13. 2 1
      include/igl/eigs.cpp
  14. 2 1
      include/igl/intersection_blocking_collapse_edge_callbacks.h
  15. 2 1
      include/igl/iterative_closest_point.cpp
  16. 4 3
      include/igl/linprog.cpp
  17. 3 2
      include/igl/min_quad_with_fixed.impl.h
  18. 5 4
      include/igl/normal_derivative.cpp
  19. 18 0
      include/igl/placeholders.h
  20. 2 1
      include/igl/predicates/find_intersections.cpp
  21. 2 1
      include/igl/predicates/polygons_to_triangles.cpp
  22. 2 1
      include/igl/qslim.cpp
  23. 4 3
      include/igl/ramer_douglas_peucker.cpp
  24. 2 1
      include/igl/remove_duplicate_vertices.cpp
  25. 2 1
      include/igl/remove_unreferenced.cpp
  26. 2 1
      include/igl/resolve_duplicated_faces.cpp
  27. 5 4
      include/igl/slice.h
  28. 2 1
      include/igl/sort_triangles.cpp
  29. 2 1
      include/igl/spectra/eigs.cpp
  30. 2 1
      include/igl/split_nonmanifold.cpp
  31. 12 11
      include/igl/straighten_seams.cpp
  32. 2 1
      include/igl/triangle/cdt.cpp
  33. 4 3
      include/igl/triangle/scaf.cpp
  34. 3 2
      include/igl/uniformly_sample_two_manifold.cpp
  35. 3 2
      tests/include/igl/AABB.cpp
  36. 2 1
      tests/include/igl/decimate.cpp
  37. 5 4
      tests/include/igl/slice.cpp
  38. 3 2
      tests/include/igl/slice_into.cpp
  39. 3 2
      tests/include/igl/slice_mask.cpp
  40. 116 0
      tests/include/igl/triangle/refine.cpp
  41. 3 2
      tutorial/301_Slice/main.cpp
  42. 2 1
      tutorial/406_FastAutomaticSkinningTransformations/main.cpp
  43. 4 3
      tutorial/407_BiharmonicCoordinates/main.cpp
  44. 9 8
      tutorial/504_Planarization/main.cpp
  45. 9 8
      tutorial/803_ShapeUp/main.cpp
  46. 2 1
      tutorial/805_MeshImplicitFunction/contours.cpp
  47. 2 2
      tutorial/906_TrimWithSolid/main.cpp
  48. 3 2
      tutorial/907_DynamicAABB/main.cpp
  49. 3 2
      tutorial/908_IntersectionBlockingDecimation/main.cpp

+ 3 - 2
include/igl/active_set.cpp

@@ -11,6 +11,7 @@
 #include "slice_into.h"
 #include "cat.h"
 //#include "matlab_format.h"
+#include "placeholders.h"
 
 #include <iostream>
 #include <limits>
@@ -280,7 +281,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
       cout<<"  everything's fixed."<<endl;
 #endif
       Z.resize(A.rows(),Y_i.cols());
-      Z(known_i,Eigen::placeholders::all) = Y_i;
+      Z(known_i,igl::placeholders::all) = Y_i;
       sol.resize(0,Y_i.cols());
       assert(Aeq_i.rows() == 0 && "All fixed but linearly constrained");
     }else
@@ -328,7 +329,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
     // Slow
     slice(A,known_i,1,Ak);
     //slice(B,known_i,Bk);
-    DerivedB Bk = B(known_i,Eigen::placeholders::all);
+    DerivedB Bk = B(known_i,igl::placeholders::all);
     MatrixXd Lambda_known_i = -(0.5*Ak*Z + 0.5*Bk);
     // reverse the lambda values for lx
     Lambda_known_i.block(nk,0,as_lx_count,1) =

+ 3 - 2
include/igl/bijective_composite_harmonic_mapping.cpp

@@ -9,6 +9,7 @@
 
 #include "doublearea.h"
 #include "harmonic.h"
+#include "placeholders.h"
 //#include "matlab/MatlabWorkspace.h"
 #include <iostream>
 
@@ -50,7 +51,7 @@ IGL_INLINE bool igl::bijective_composite_harmonic_mapping(
   assert(F.cols() == 3 && "F should contain triangles");
   int nsteps = min_steps;
   Eigen::Matrix<typename Derivedbc::Scalar, Eigen::Dynamic, Eigen::Dynamic> bc0 =
-    V(b.col(0),Eigen::placeholders::all);
+    V(b.col(0),igl::placeholders::all);
 
   // It's difficult to check for flips "robustly" in the sense that the input
   // mesh might not have positive/consistent sign to begin with.
@@ -81,7 +82,7 @@ IGL_INLINE bool igl::bijective_composite_harmonic_mapping(
         //mw.save(bct,"bct");
         //mw.write("numerical.mat");
         harmonic(Eigen::Matrix<typename DerivedU::Scalar, Eigen::Dynamic, Eigen::Dynamic>(U), F, b, bct, 1, U);
-        bct = U(b.col(0),Eigen::placeholders::all);
+        bct = U(b.col(0),igl::placeholders::all);
         nans = (U.array() != U.array()).count();
         if(test_for_flips)
         {

+ 4 - 3
include/igl/blue_noise.cpp

@@ -9,6 +9,7 @@
 #include "doublearea.h"
 #include "random_points_on_mesh.h"
 #include "sortrows.h"
+#include "placeholders.h"
 #include "PI.h"
 #include "get_seconds.h"
 #include <unordered_map>
@@ -290,10 +291,10 @@ IGL_INLINE void igl::blue_noise(
   {
     Eigen::VectorXi I;
     igl::sortrows(decltype(Xs)(Xs),true,Xs,I);
-    X = X(I,Eigen::placeholders::all).eval();
+    X = X(I,igl::placeholders::all).eval();
     // These two could be spun off in their own thread.
-    XB = XB(I,Eigen::placeholders::all).eval();
-    XFI = XFI(I,Eigen::placeholders::all).eval();
+    XB = XB(I,igl::placeholders::all).eval();
+    XFI = XFI(I,igl::placeholders::all).eval();
   }
   // Initialization
   std::unordered_map<BlueNoiseKeyType,std::vector<int> > M;

+ 2 - 1
include/igl/circumradius.cpp

@@ -8,6 +8,7 @@
 #include "circumradius.h"
 #include "edge_lengths.h"
 #include "doublearea.h"
+#include "placeholders.h"
 #include <Eigen/QR>
 template <
   typename DerivedV, 
@@ -54,7 +55,7 @@ IGL_INLINE void igl::circumradius(
   {
     Eigen::Matrix<Scalar,ACOLS,ACOLS> A(T.cols()+1,T.cols()+1);
     // Not sure if this .eval() is a good idea
-    const auto Vi = V(T.row(i),Eigen::placeholders::all).eval();
+    const auto Vi = V(T.row(i),igl::placeholders::all).eval();
     A.topLeftCorner(T.cols(),T.cols()) = 2*(Vi*Vi.transpose());
     A.block(0,T.cols(),T.cols(),1).setConstant(1);
     A.block(T.cols(),0,1,T.cols()).setConstant(1);

+ 2 - 1
include/igl/copyleft/cgal/is_self_intersecting.cpp

@@ -1,4 +1,5 @@
 #include "is_self_intersecting.h"
+#include "../../placeholders.h"
 #include "../../find.h"
 #include "../../doublearea.h"
 #include "../../remove_unreferenced.h"
@@ -20,7 +21,7 @@ bool igl::copyleft::cgal::is_self_intersecting(
   const auto valid = 
     igl::find((F.array() != IGL_COLLAPSE_EDGE_NULL).rowwise().any().eval());
   // Extract only the valid faces
-  MatrixF FF = F(valid, Eigen::placeholders::all);
+  MatrixF FF = F(valid, igl::placeholders::all);
   // Remove unreferneced vertices
   MatrixV VV;
   {

+ 7 - 6
include/igl/copyleft/cgal/minkowski_sum.cpp

@@ -10,6 +10,7 @@
 
 #include "../../LinSpaced.h"
 #include "../../unique_rows.h"
+#include "../../placeholders.h"
 #include "../../find.h"
 #include "../../get_seconds.h"
 #include "../../edges.h"
@@ -230,22 +231,22 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   typedef Matrix<typename DerivedG::Scalar,Dynamic,1> VectorXI;
   MatrixXI GT(mp+mn,3);
   GT<< 
-    FA(igl::find(N),Eigen::placeholders::all), 
-    (FA.array()+n).eval()(igl::find(P),Eigen::placeholders::all);
+    FA(igl::find(N),igl::placeholders::all), 
+    (FA.array()+n).eval()(igl::find(P),igl::placeholders::all);
 
   // J indexes FA for parts at s and m+FA for parts at d
   J.derived() = igl::LinSpaced<DerivedJ >(m,0,m-1);
   DerivedJ JT(mp+mn);
   JT << 
-    J(igl::find(P),Eigen::placeholders::all), 
-    J(igl::find(N),Eigen::placeholders::all);
+    J(igl::find(P),igl::placeholders::all), 
+    J(igl::find(N),igl::placeholders::all);
   JT.block(mp,0,mn,1).array()+=m;
 
   // Original non-co-planar faces with positively oriented reversed
   MatrixXI BA(mp+mn,3);
   BA << 
-    FA(igl::find(P),Eigen::placeholders::all).rowwise().reverse(), 
-    FA(igl::find(N),Eigen::placeholders::all);
+    FA(igl::find(P),igl::placeholders::all).rowwise().reverse(), 
+    FA(igl::find(N),igl::placeholders::all);
   // Quads along **all** sides
   MatrixXI GQ((mp+mn)*3,4);
   GQ<< 

+ 5 - 4
include/igl/copyleft/cgal/point_areas.cpp

@@ -3,6 +3,7 @@
 
 #include "../../find.h"
 #include "../../parallel_for.h"
+#include "../../placeholders.h"
 
 #include "CGAL/Exact_predicates_inexact_constructions_kernel.h"
 #include "CGAL/Triangulation_vertex_base_with_info_2.h"
@@ -68,17 +69,17 @@ namespace igl {
         igl::parallel_for(P.rows(),[&](int i)
         {
           MatrixP neighbors;
-          neighbors = P(I.row(i),Eigen::placeholders::all);
+          neighbors = P(I.row(i),igl::placeholders::all);
           if(N.rows() && neighbors.rows() > 1){
             MatrixN neighbor_normals;
-            neighbor_normals = N(I.row(i),Eigen::placeholders::all);
+            neighbor_normals = N(I.row(i),igl::placeholders::all);
             Eigen::Matrix<scalarN,1,3> poi_normal = neighbor_normals.row(0);
             Eigen::Matrix<scalarN,Eigen::Dynamic,1> dotprod =
                             poi_normal(0)*neighbor_normals.col(0)
             + poi_normal(1)*neighbor_normals.col(1)
             + poi_normal(2)*neighbor_normals.col(2);
             Eigen::Array<bool,Eigen::Dynamic,1> keep = dotprod.array() > 0;
-            neighbors = neighbors(igl::find(keep),Eigen::placeholders::all).eval();
+            neighbors = neighbors(igl::find(keep),igl::placeholders::all).eval();
           }
           if(neighbors.rows() <= 2){
             A(i) = 0;
@@ -96,7 +97,7 @@ namespace igl {
               T.row(i) *= -1;
             }
             
-            MatrixP plane = scores(Eigen::placeholders::all,{0,1});
+            MatrixP plane = scores(igl::placeholders::all,{0,1});
             
             std::vector< std::pair<Point,unsigned> > points;
             //This is where we obtain a delaunay triangulation of the points

+ 2 - 1
include/igl/copyleft/cgal/point_solid_signed_squared_distance.cpp

@@ -11,6 +11,7 @@
 #include "../../get_seconds.h"
 #include "../../list_to_matrix.h"
 #include "../../find.h"
+#include "../../placeholders.h"
 #include "../../parallel_for.h"
 #include <vector>
 #include <Eigen/Core>
@@ -33,7 +34,7 @@ IGL_INLINE void igl::copyleft::cgal::point_solid_signed_squared_distance(
   // Collect queries that have non-zero distance
   Eigen::Array<bool,Eigen::Dynamic,1> NZ = D.array()!=0;
   // Compute sign for non-zero distance queries
-  DerivedQ QNZ = Q(igl::find(NZ),Eigen::placeholders::all);
+  DerivedQ QNZ = Q(igl::find(NZ),igl::placeholders::all);
   Eigen::Array<bool,Eigen::Dynamic,1> DNZ;
   igl::copyleft::cgal::points_inside_component(VB,FB,QNZ,DNZ);
   // Apply sign to distances

+ 4 - 3
include/igl/copyleft/cgal/trim_with_solid.cpp

@@ -14,6 +14,7 @@
 #include "../../extract_manifold_patches.h"
 #include "../../connected_components.h"
 #include "../../facet_adjacency_matrix.h"
+#include "../../placeholders.h"
 #include "../../list_to_matrix.h"
 #include "../../find.h"
 #include "../../get_seconds.h"
@@ -165,7 +166,7 @@ IGL_INLINE void igl::copyleft::cgal::trim_with_solid(
       igl::copyleft::cgal::intersect_other(
         VA,FA,VB,FB,{false,false,true},_1,V,F,J,_2);
       const auto keep = igl::find( (J.array()<FA.rows()).eval() );
-      F = F(keep,Eigen::placeholders::all).eval();
+      F = F(keep,igl::placeholders::all).eval();
       J = J(keep).eval();
       {
         Eigen::VectorXi _;
@@ -262,7 +263,7 @@ IGL_INLINE void igl::copyleft::cgal::trim_with_solid(
                 keep.push_back(f);
               }
             }
-            F = F(keep,Eigen::placeholders::all).eval();
+            F = F(keep,igl::placeholders::all).eval();
             J = J(keep).eval();
           }
 
@@ -278,7 +279,7 @@ IGL_INLINE void igl::copyleft::cgal::trim_with_solid(
       // only keep faces from A
       Eigen::Array<bool,Eigen::Dynamic,1> A = J.array()< FA.rows();
       const auto AI = igl::find(A);
-      F = F(AI,Eigen::placeholders::all).eval();
+      F = F(AI,igl::placeholders::all).eval();
       J = J(AI).eval();
       P = P(AI).eval();
       set_D_via_patches(num_patches,P);

+ 2 - 1
include/igl/copyleft/cgal/wire_mesh.cpp

@@ -2,6 +2,7 @@
 
 #include "../../list_to_matrix.h"
 #include "../../PI.h"
+#include "../../placeholders.h"
 #include "convex_hull.h"
 #include "coplanar.h"
 #include "mesh_boolean.h"
@@ -115,7 +116,7 @@ IGL_INLINE void igl::copyleft::cgal::wire_mesh(
   const auto append_hull = 
     [&V,&vF,&vJ](const Eigen::VectorXi & I, const int j)
   {
-    MatrixX3S Vv = V(I,Eigen::placeholders::all);
+    MatrixX3S Vv = V(I,igl::placeholders::all);
 
     if(coplanar(Vv))
     {

+ 2 - 1
include/igl/decimate.cpp

@@ -13,6 +13,7 @@
 #include "intersection_blocking_collapse_edge_callbacks.h"
 #include "is_edge_manifold.h"
 #include "remove_unreferenced.h"
+#include "placeholders.h"
 #include "find.h"
 #include "connect_boundary_to_infinity.h"
 #include "parallel_for.h"
@@ -84,7 +85,7 @@ IGL_INLINE bool igl::decimate(
     J,
     I);
   const Eigen::Array<bool,Eigen::Dynamic,1> keep = (J.array()<orig_m);
-  G = G(igl::find(keep),Eigen::placeholders::all).eval();
+  G = G(igl::find(keep),igl::placeholders::all).eval();
   J = J(igl::find(keep)).eval();
   Eigen::VectorXi _1,I2;
   igl::remove_unreferenced(Eigen::MatrixXd(U),Eigen::MatrixXi(G),U,G,_1,I2);

+ 2 - 1
include/igl/ears.cpp

@@ -2,6 +2,7 @@
 #include "on_boundary.h"
 #include "find.h"
 #include "min.h"
+#include "placeholders.h"
 #include <cassert>
 
 template <
@@ -21,7 +22,7 @@ IGL_INLINE void igl::ears(
   }
   find((B.rowwise().count() == 2).eval(), ear);
   // Why do I need this .derived()?
-  Eigen::Array<bool, Eigen::Dynamic, 3> Bear = B(ear.derived(),Eigen::placeholders::all);
+  Eigen::Array<bool, Eigen::Dynamic, 3> Bear = B(ear.derived(),igl::placeholders::all);
   Eigen::Array<bool, Eigen::Dynamic, 1> M;
   igl::min(Bear,2,M,ear_opp);
 }

+ 2 - 1
include/igl/eigs.cpp

@@ -10,6 +10,7 @@
 #include "cotmatrix.h"
 #include "sort.h"
 #include "massmatrix.h"
+#include "placeholders.h"
 #include <iostream>
 
 template <
@@ -163,7 +164,7 @@ IGL_INLINE bool igl::eigs(
   // finally sort
   VectorXi I;
   igl::sort(S,1,false,sS,I);
-  sU = U(Eigen::placeholders::all,I);
+  sU = U(igl::placeholders::all,I);
   sS /= rescale;
   sU /= sqrt(rescale);
   return true;

+ 2 - 1
include/igl/intersection_blocking_collapse_edge_callbacks.h

@@ -2,6 +2,7 @@
 #define IGL_INTERSECTION_BLOCKING_COLLAPSE_EDGE_CALLBACKS_H
 #include "igl_inline.h"
 #include "decimate_callback_types.h"
+#include "placeholders.h"
 #include <Eigen/Core>
 #include <vector>
 namespace igl
@@ -59,7 +60,7 @@ namespace igl
   ///    post_collapse,
   ///    E, EMAP, EF, EI,
   ///    U, G, J, I);
-  ///  G = G(igl::find((J.array()<orig_m).eval()), Eigen::placeholders::all).eval();
+  ///  G = G(igl::find((J.array()<orig_m).eval()), igl::placeholders::all).eval();
   ///  {
   ///    Eigen::VectorXi _;
   ///    igl::remove_unreferenced(Eigen::MatrixXd(U),Eigen::MatrixXi(G),U,G,_);

+ 2 - 1
include/igl/iterative_closest_point.cpp

@@ -9,6 +9,7 @@
 #include "AABB.h"
 #include "per_face_normals.h"
 #include "random_points_on_mesh.h"
+#include "placeholders.h"
 #include "rigid_alignment.h"
 #include <cassert>
 #include <iostream>
@@ -96,7 +97,7 @@ IGL_INLINE void igl::iterative_closest_point(
       Ytree.squared_distance(VY,FY,X,sqrD,I,P);
     }
     // Use better normals?
-    MatrixXS N = NY(I,Eigen::placeholders::all);
+    MatrixXS N = NY(I,igl::placeholders::all);
     //MatrixXS N = (X - P).rowwise().normalized();
     // fit rotation,translation
     Matrix3S Rup;

+ 4 - 3
include/igl/linprog.cpp

@@ -8,6 +8,7 @@
 #include "linprog.h"
 #include "find.h"
 #include "colon.h"
+#include "placeholders.h"
 
 //#define IGL_LINPROG_VERBOSE
 IGL_INLINE bool igl::linprog(
@@ -76,7 +77,7 @@ IGL_INLINE bool igl::linprog(
     J.head(j) = B.head(j);
     J.tail(B.size()-j-1) = B.tail(B.size()-j-1);
     B(j) = n+m;
-    MatrixXd AJ = A(Eigen::placeholders::all,J);
+    MatrixXd AJ = A(igl::placeholders::all,J);
     const VectorXd a = b - AJ.rowwise().sum();
     {
       MatrixXd old_A = A;
@@ -123,7 +124,7 @@ IGL_INLINE bool igl::linprog(
       }
       // reduced costs
       VectorXd sN = s(N);
-      MatrixXd AN = A(Eigen::placeholders::all,N);
+      MatrixXd AN = A(igl::placeholders::all,N);
       VectorXd r = sN - AN.transpose() * yb;
       int q;
       // determine new basic variable
@@ -209,7 +210,7 @@ IGL_INLINE bool igl::linprog(
       }
     }
     // iterative refinement
-    xb = (xb+D*(b-A(Eigen::placeholders::all,B)*xb)).eval();
+    xb = (xb+D*(b-A(igl::placeholders::all,B)*xb)).eval();
     // must be due to rounding
     VectorXi I;
     igl::find((xb.array()<0).eval(),I);

+ 3 - 2
include/igl/min_quad_with_fixed.impl.h

@@ -16,6 +16,7 @@
 #include "repmat.h"
 #include "EPS.h"
 #include "cat.h"
+#include "placeholders.h"
 
 //#include <Eigen/SparseExtra>
 // Bug in unsupported/Eigen/SparseExtra needs iostream first
@@ -464,7 +465,7 @@ IGL_INLINE bool igl::min_quad_with_fixed_solve(
     }
 
     // Build right hand side
-    MatrixXT BBequlcols = BBeq(data.unknown_lagrange,Eigen::placeholders::all);
+    MatrixXT BBequlcols = BBeq(data.unknown_lagrange,igl::placeholders::all);
     MatrixXT NB;
     if(kr == 0)
     {
@@ -515,7 +516,7 @@ IGL_INLINE bool igl::min_quad_with_fixed_solve(
       //data.AeqTQR.colsPermutation().transpose() * (-data.Aeqk * Y + Beq);
       data.AeqTET * (-data.Aeqk * Y + Beq.replicate(1,Beq.cols()==cols?1:cols));
     // Where did this -0.5 come from? Probably the same place as above.
-    MatrixXT Bu = B(data.unknown,Eigen::placeholders::all);
+    MatrixXT Bu = B(data.unknown,igl::placeholders::all);
     MatrixXT NB;
     NB = -0.5*(Bu.replicate(1,B.cols()==cols?1:cols) + data.preY * Y);
     // Trim eff_Beq

+ 5 - 4
include/igl/normal_derivative.cpp

@@ -8,6 +8,7 @@
 #include "LinSpaced.h"
 #include "normal_derivative.h"
 #include "cotmatrix_entries.h"
+#include "placeholders.h"
 #include <cassert>
 
 template <
@@ -40,7 +41,7 @@ IGL_INLINE void igl::normal_derivative(
     case 4:
     {
       const MatrixXi DDJ = 
-        Ele(Eigen::placeholders::all,{1,0,2,0,3,0,2,1,3,1,0,1,3,2,0,2,1,2,0,3,1,3,2,3});
+        Ele(igl::placeholders::all,{1,0,2,0,3,0,2,1,3,1,0,1,3,2,0,2,1,2,0,3,1,3,2,3});
       MatrixXi DDI(m,24);
       for(size_t f = 0;f<4;f++)
       {
@@ -53,7 +54,7 @@ IGL_INLINE void igl::normal_derivative(
       const DiagonalMatrix<Scalar,24,24> S =
         (Matrix<Scalar,2,1>(1,-1).template replicate<12,1>()).asDiagonal();
       Matrix<Scalar,Dynamic,Dynamic> DDV =
-        C(Eigen::placeholders::all,{2,2,1,1,3,3,0,0,4,4,2,2,5,5,1,1,0,0,3,3,4,4,5,5});
+        C(igl::placeholders::all,{2,2,1,1,3,3,0,0,4,4,2,2,5,5,1,1,0,0,3,3,4,4,5,5});
       DDV *= S;
 
       IJV.reserve(DDV.size());
@@ -70,7 +71,7 @@ IGL_INLINE void igl::normal_derivative(
     }
     case 3:
     {
-      const MatrixXi DDJ = Ele(Eigen::placeholders::all,{2,0,1,0,0,1,2,1,1,2,0,2});
+      const MatrixXi DDJ = Ele(igl::placeholders::all,{2,0,1,0,0,1,2,1,1,2,0,2});
       MatrixXi DDI(m,12);
       for(size_t f = 0;f<3;f++)
       {
@@ -82,7 +83,7 @@ IGL_INLINE void igl::normal_derivative(
       }
       const DiagonalMatrix<Scalar,12,12> S =
         (Matrix<Scalar,2,1>(1,-1).template replicate<6,1>()).asDiagonal();
-      Matrix<Scalar,Dynamic,Dynamic> DDV = C(Eigen::placeholders::all,{1,1,2,2,2,2,0,0,0,0,1,1});
+      Matrix<Scalar,Dynamic,Dynamic> DDV = C(igl::placeholders::all,{1,1,2,2,2,2,0,0,0,0,1,1});
       DDV *= S;
 
       IJV.reserve(DDV.size());

+ 18 - 0
include/igl/placeholders.h

@@ -0,0 +1,18 @@
+#ifndef IGL_PLACEHOLDERS_H
+#define IGL_PLACEHOLDERS_H
+
+#include <Eigen/Core>
+
+#if EIGEN_VERSION_AT_LEAST(3, 4, 90)
+  #define IGL_PLACEHOLDERS_ALL Eigen::placeholders::all
+#else
+  #define IGL_PLACEHOLDERS_ALL Eigen::all
+#endif
+
+namespace igl {
+  namespace placeholders {
+    const auto all = IGL_PLACEHOLDERS_ALL;
+  }
+}
+
+#endif

+ 2 - 1
include/igl/predicates/find_intersections.cpp

@@ -13,6 +13,7 @@
 #include "../triangle_triangle_intersect_shared_vertex.h"
 #include "../find.h"
 #include "../list_to_matrix.h"
+#include "../placeholders.h"
 #include "triangle_triangle_intersect.h"
 #include "../triangle_triangle_intersect.h"
 #include <stdio.h>
@@ -281,7 +282,7 @@ IGL_INLINE bool igl::predicates::find_intersections(
   if(!find_intersections(tree1,V1,F1,V2,F2,false,IF,CP)) { return false; }
   std::vector<int> EI_vec = igl::find((CP.array()==false).eval());
   igl::list_to_matrix(EI_vec,EI);
-  const auto IF_EI = IF(EI_vec,Eigen::placeholders::all).eval();
+  const auto IF_EI = IF(EI_vec,igl::placeholders::all).eval();
   igl::triangle_triangle_intersect(V1,F1,V2,F2,IF_EI,EV,EE);
   return true;
 }

+ 2 - 1
include/igl/predicates/polygons_to_triangles.cpp

@@ -1,6 +1,7 @@
 #include "polygons_to_triangles.h"
 #include "ear_clipping.h"
 #include "../sort.h"
+#include "../placeholders.h"
 #include <Eigen/Eigenvalues>
 
 template <
@@ -54,7 +55,7 @@ IGL_INLINE void igl::predicates::polygons_to_triangles(
               Eigen::Vector3d _1;
               Eigen::Vector3i I;
               igl::sort(es.eigenvalues().real().eval(),1,false,_1,I);
-              C = C(Eigen::placeholders::all,I).eval();
+              C = C(igl::placeholders::all,I).eval();
             }
             S = P*C.leftCols(2);
             break;

+ 2 - 1
include/igl/qslim.cpp

@@ -16,6 +16,7 @@
 #include "max_faces_stopping_condition.h"
 #include "per_vertex_point_to_plane_quadrics.h"
 #include "qslim_optimal_collapse_edge_callbacks.h"
+#include "placeholders.h"
 #include "quadric_binary_plus_operator.h"
 #include "remove_unreferenced.h"
 #include "intersection_blocking_collapse_edge_callbacks.h"
@@ -90,7 +91,7 @@ IGL_INLINE bool igl::qslim(
   // Remove phony boundary faces and clean up
   const Eigen::Array<bool,Eigen::Dynamic,1> keep = (J.array()<orig_m);
   const auto keep_i = igl::find(keep);
-  G = G(keep_i,Eigen::placeholders::all).eval();
+  G = G(keep_i,igl::placeholders::all).eval();
   J = J(keep_i).eval();
   Eigen::VectorXi _1,I2;
   igl::remove_unreferenced(Eigen::MatrixXd(U),Eigen::MatrixXi(G),U,G,_1,I2);

+ 4 - 3
include/igl/ramer_douglas_peucker.cpp

@@ -6,6 +6,7 @@
 #include "cumsum.h"
 #include "histc.h"
 #include "project_to_line.h"
+#include "placeholders.h"
 #include "EPS.h"
 
 template <typename DerivedP, typename DerivedS, typename DerivedJ>
@@ -65,7 +66,7 @@ IGL_INLINE void igl::ramer_douglas_peucker(
   };
   simplify(0,n-1);
   igl::find(I,J);
-  S = P(J.derived(),Eigen::placeholders::all);
+  S = P(J.derived(),igl::placeholders::all);
 }
 
 template <
@@ -119,7 +120,7 @@ IGL_INLINE void igl::ramer_douglas_peucker(
       T(t) = 0;
     }
   }
-  DerivedS SB = S(B,Eigen::placeholders::all);
+  DerivedS SB = S(B,igl::placeholders::all);
   Eigen::VectorXi MB = B.array()+1;
   for(int b = 0;b<MB.size();b++)
   {
@@ -128,7 +129,7 @@ IGL_INLINE void igl::ramer_douglas_peucker(
       MB(b) = S.rows()-1;
     }
   }
-  DerivedS SMB = S(MB,Eigen::placeholders::all);
+  DerivedS SMB = S(MB,igl::placeholders::all);
   Q = SB.array() + ((SMB.array()-SB.array()).colwise()*T.array());
 
   // Remove extra point at end

+ 2 - 1
include/igl/remove_duplicate_vertices.cpp

@@ -9,6 +9,7 @@
 #include "round.h"
 #include "unique_rows.h"
 #include "colon.h"
+#include "placeholders.h"
 #include <functional>
 
 template <
@@ -32,7 +33,7 @@ IGL_INLINE void igl::remove_duplicate_vertices(
     DerivedV rV,rSV;
     round((V/(epsilon)).eval(),rV);
     unique_rows(rV,rSV,SVI,SVJ);
-    SV = V(SVI.derived(),Eigen::placeholders::all);
+    SV = V(SVI.derived(),igl::placeholders::all);
   }else
   {
     unique_rows(V,SV,SVI,SVJ);

+ 2 - 1
include/igl/remove_unreferenced.cpp

@@ -6,6 +6,7 @@
 // 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 "remove_unreferenced.h"
+#include "placeholders.h"
 #include <algorithm>
 
 template <
@@ -46,7 +47,7 @@ IGL_INLINE void igl::remove_unreferenced(
   NF = F;
   std::for_each(NF.data(),NF.data()+NF.size(),
     [&I](typename DerivedNF::Scalar & a){a=I(a);});
-  NV = V(J.derived(),Eigen::placeholders::all);
+  NV = V(J.derived(),igl::placeholders::all);
 }
 
 template <

+ 2 - 1
include/igl/resolve_duplicated_faces.cpp

@@ -9,6 +9,7 @@
 
 #include "resolve_duplicated_faces.h"
 #include "IGL_ASSERT.h"
+#include "placeholders.h"
 
 #include "unique_simplices.h"
 #include <vector>
@@ -81,7 +82,7 @@ IGL_INLINE void igl::resolve_duplicated_faces(
   const size_t num_kept = kept_faces.size();
   J.resize(num_kept, 1);
   std::copy(kept_faces.begin(), kept_faces.end(), J.data());
-  F2 = F1(J.derived(),Eigen::placeholders::all);
+  F2 = F1(J.derived(),igl::placeholders::all);
 }
 
 #ifdef IGL_STATIC_LIBRARY

+ 5 - 4
include/igl/slice.h

@@ -8,6 +8,7 @@
 #ifndef IGL_SLICE_H
 #define IGL_SLICE_H
 #include "igl_inline.h"
+#include "placeholders.h"
 
 /// @file slice.h
 ///
@@ -19,11 +20,11 @@
 /// | igl                        | Eigen v3.4                         |
 /// |-------------------0--------|------------------------------------| |
 /// `igl::slice(X,I,J,Y)`      | `Y = X(I,J)`                       | |
-/// `igl::slice(X,I,1,Y)`      | `Y = X(I,Eigen::placeholders::all)`              | |
-/// `igl::slice(X,J,2,Y)`      | `Y = X(Eigen::placeholders::all,J)`              | |
+/// `igl::slice(X,I,1,Y)`      | `Y = X(I,igl::placeholders::all)`              | |
+/// `igl::slice(X,J,2,Y)`      | `Y = X(igl::placeholders::all,J)`              | |
 /// `igl::slice_into(Z,I,J,X)` | `X(I,J) = Z`                       | |
-/// `igl::slice_into(Z,I,1,X)` | `X(I,Eigen::placeholders::all) = Z`              | |
-/// `igl::slice_into(Z,J,2,X)` | `X(Eigen::placeholders::all,J) = Z`              | |
+/// `igl::slice_into(Z,I,1,X)` | `X(I,igl::placeholders::all) = Z`              | |
+/// `igl::slice_into(Z,J,2,X)` | `X(igl::placeholders::all,J) = Z`              | |
 /// `igl::slice_mask(X,M,N,Y)` | `Y = X(igl::find(M),igl::find(N))` | | _not
 /// available_            | `X(igl::find(M),igl::find(N)) = Z` |
 ///

+ 2 - 1
include/igl/sort_triangles.cpp

@@ -11,6 +11,7 @@
 #include "sortrows.h"
 #include "slice.h"
 #include "round.h"
+#include "placeholders.h"
 #include "colon.h"
 
 #include <iostream>
@@ -46,7 +47,7 @@ IGL_INLINE void igl::sort_triangles(
       MV.template cast<Scalar>().transpose()*
        P.template cast<Scalar>().transpose().eval().col(2));
   sort(D,1,false,sD,I);
-  FF = F(I.derived(),Eigen::placeholders::all);
+  FF = F(I.derived(),igl::placeholders::all);
 }
 
 

+ 2 - 1
include/igl/spectra/eigs.cpp

@@ -1,6 +1,7 @@
 #include "eigs.h"
 #include "../sort.h"
 #include "../IGL_ASSERT.h"
+#include "../placeholders.h"
 #include <Spectra/SymGEigsShiftSolver.h>
 
 template <
@@ -127,7 +128,7 @@ IGL_INLINE bool igl::spectra::eigs(
 
   Eigen::VectorXi I;
   igl::sort( Eigen::VectorXd(S), 1, false, S, I);
-  U = U(Eigen::placeholders::all,I).eval();
+  U = U(igl::placeholders::all,I).eval();
   return true;
 }
 

+ 2 - 1
include/igl/split_nonmanifold.cpp

@@ -11,6 +11,7 @@
 #include "unique.h"
 #include "sort.h"
 #include "triangle_triangle_adjacency.h"
+#include "placeholders.h"
 #include "is_edge_manifold.h"
 #include <unordered_map>
 #include <cassert>
@@ -468,7 +469,7 @@ IGL_INLINE void igl::split_nonmanifold(
   Eigen::PlainObjectBase <DerivedSVI> & SVI)
 {
   igl::split_nonmanifold(F,SF,SVI);
-  SV = V(SVI.derived(),Eigen::placeholders::all);
+  SV = V(SVI.derived(),igl::placeholders::all);
 }
 
 #ifdef IGL_STATIC_LIBRARY

+ 12 - 11
include/igl/straighten_seams.cpp

@@ -21,6 +21,7 @@
 #include "ramer_douglas_peucker.h"
 #include "vertex_components.h"
 #include "list_to_matrix.h"
+#include "placeholders.h"
 #include "ears.h"
 #include "sum.h"
 #include "find.h"
@@ -74,8 +75,8 @@ IGL_INLINE void igl::straighten_seams(
   Array<bool,Dynamic,1>vBT = Map<Array<bool,Dynamic,1> >(BT.data(),BT.size(),1);
   Array<bool,Dynamic,1>vBF = Map<Array<bool,Dynamic,1> >(BF.data(),BF.size(),1);
   const auto vBT_i = igl::find(vBT);
-  MatrixX2I OF = EF(vBT_i,Eigen::placeholders::all);
-  OT = EF(vBT_i,Eigen::placeholders::all);
+  MatrixX2I OF = EF(vBT_i,igl::placeholders::all);
+  OT = EF(vBT_i,igl::placeholders::all);
   VectorXi OFMAP = EFMAP(vBT_i);
   // Two boundary edges on the texture-mapping are "equivalent" to each other on
   // the 3D-mesh if their 3D-mesh vertex indices match
@@ -115,7 +116,7 @@ IGL_INLINE void igl::straighten_seams(
   assert( (M.array() == 1).all() );
   VectorXi DT;
   // Map counts onto texture-vertices
-  DT = DV(I,Eigen::placeholders::all);
+  DT = DV(I,igl::placeholders::all);
   // Boundary in 3D && UV
   Array<bool,Dynamic,1> BTF = vBF(igl::find(vBT));
 
@@ -235,14 +236,14 @@ IGL_INLINE void igl::straighten_seams(
     {
       case 1:
         {
-          MatrixX2I OTIc = OT(Ic,Eigen::placeholders::all);
+          MatrixX2I OTIc = OT(Ic,igl::placeholders::all);
           edges_to_path(OTIc,vpath,epath,eend);
           Array<bool,Dynamic,1> SVvpath = SV(vpath);
           assert(
             (vpath(0) != vpath(vpath.size()-1) || !SVvpath.any()) && 
             "Not dealing with 1-loops touching 'sharp' corners");
           // simple open boundary
-          MatrixX2S PI = VT(vpath,Eigen::placeholders::all);
+          MatrixX2S PI = VT(vpath,igl::placeholders::all);
           const Scalar bbd = 
             (PI.colwise().maxCoeff() - PI.colwise().minCoeff()).norm();
           // Do not collapse boundaries to fewer than 3 vertices
@@ -256,7 +257,7 @@ IGL_INLINE void igl::straighten_seams(
           {
             MatrixX2S UPI,UTvpath;
             ramer_douglas_peucker(PI,eff_tol*bbd,UPI,UIc,UTvpath);
-            UT(vpath,Eigen::placeholders::all) = UTvpath;
+            UT(vpath,igl::placeholders::all) = UTvpath;
             if(!is_closed || allow_boundary_collapse)
             {
               break;
@@ -294,8 +295,8 @@ IGL_INLINE void igl::straighten_seams(
           }
           Array<bool,Dynamic,1> flipped;
           {
-            MatrixX2I OFIc = OF(Ic,Eigen::placeholders::all);
-            MatrixX2I OFIcc = OF(Icc,Eigen::placeholders::all);
+            MatrixX2I OFIc = OF(Ic,igl::placeholders::all);
+            MatrixX2I OFIcc = OF(Icc,igl::placeholders::all);
             Eigen::VectorXi XOR,IA,IB;
             setxor(OFIc,OFIcc,XOR,IA,IB);
             assert(XOR.size() == 0);
@@ -309,7 +310,7 @@ IGL_INLINE void igl::straighten_seams(
             vUE.push_back({OT(Icc(0),flipped(0)?1:0),OT(Icc(0),flipped(0)?0:1)});
           }else
           {
-            MatrixX2I OTIc = OT(Ic,Eigen::placeholders::all);
+            MatrixX2I OTIc = OT(Ic,igl::placeholders::all);
             edges_to_path(OTIc,vpath,epath,eend);
             // Flip endpoints if needed
             for(int e = 0;e<eend.size();e++)if(flipped(e))eend(e)=1-eend(e);
@@ -335,8 +336,8 @@ IGL_INLINE void igl::straighten_seams(
             Matrix<Scalar,Dynamic,Dynamic> UPI,SI;
             VectorXi UIc;
             ramer_douglas_peucker(PI,tol*bbd,UPI,UIc,SI);
-            UT(vpath,Eigen::placeholders::all) = SI.leftCols (VT.cols());
-            UT(vpathc,Eigen::placeholders::all) = SI.rightCols(VT.cols());
+            UT(vpath,igl::placeholders::all) = SI.leftCols (VT.cols());
+            UT(vpathc,igl::placeholders::all) = SI.rightCols(VT.cols());
             for(int i = 0;i<UIc.size()-1;i++)
             {
               vUE.push_back({vpath(UIc(i)),vpath(UIc(i+1))});

+ 2 - 1
include/igl/triangle/cdt.cpp

@@ -3,6 +3,7 @@
 #include "../triangle/triangulate.h"
 #include "../remove_duplicate_vertices.h"
 #include "../remove_unreferenced.h"
+#include "../placeholders.h"
 
 template <
   typename DerivedV, 
@@ -35,7 +36,7 @@ IGL_INLINE void igl::triangle::cdt(
   igl::remove_duplicate_vertices(DerivedWV(WV),DerivedWE(WE),1e-10,WV,_,J,WE);
   // Remove degenerate edges
   const Eigen::Array<bool,Eigen::Dynamic,1> keep = (WE.array().col(0) != WE.array().col(1));
-  WE = WE(keep,Eigen::placeholders::all).eval();
+  WE = WE(keep,igl::placeholders::all).eval();
   // c flag must be present
   igl::triangle::triangulate(DerivedWV(WV),WE,DerivedWV(),flags,WV,WF);
   Eigen::VectorXi UJ;

+ 4 - 3
include/igl/triangle/scaf.cpp

@@ -30,6 +30,7 @@
 #include "../slice.h"
 #include "../slice_into.h"
 #include "../slim.h"
+#include "../placeholders.h"
 #include "../mapping_energy_with_jacobians.h"
 
 #include <map>
@@ -433,7 +434,7 @@ IGL_INLINE void build_surface_linear_system(const SCAFData &s, Eigen::SparseMatr
   }
   else
   {
-    MatrixXd bnd_pos = s.w_uv(bnd_ids, Eigen::placeholders::all);
+    MatrixXd bnd_pos = s.w_uv(bnd_ids, igl::placeholders::all);
 
     ArrayXi known_ids(bnd_ids.size() * dim);
     ArrayXi unknown_ids((v_n - bnd_ids.rows()) * dim);
@@ -494,7 +495,7 @@ IGL_INLINE void build_scaffold_linear_system(const SCAFData &s, Eigen::SparseMat
 
   auto bnd_n = bnd_ids.size();
   IGL_ASSERT(bnd_n > 0);
-  MatrixXd bnd_pos = s.w_uv(bnd_ids, Eigen::placeholders::all);
+  MatrixXd bnd_pos = s.w_uv(bnd_ids, igl::placeholders::all);
 
   ArrayXi known_ids(bnd_ids.size() * dim);
   ArrayXi unknown_ids((v_n - bnd_ids.rows()) * dim);
@@ -565,7 +566,7 @@ IGL_INLINE void solve_weighted_arap(SCAFData &s, Eigen::MatrixXd &uv)
   const auto v_n = s.v_num;
   const auto bnd_n = bnd_ids.size();
   assert(bnd_n > 0);
-  MatrixXd bnd_pos = s.w_uv(bnd_ids, Eigen::placeholders::all);
+  MatrixXd bnd_pos = s.w_uv(bnd_ids, igl::placeholders::all);
 
   ArrayXi known_ids(bnd_n * dim);
   ArrayXi unknown_ids((v_n - bnd_n) * dim);

+ 3 - 2
include/igl/uniformly_sample_two_manifold.cpp

@@ -12,6 +12,7 @@
 #include "vertex_triangle_adjacency.h"
 #include "get_seconds.h"
 #include "cat.h"
+#include "placeholders.h"
 //#include "MT19937.h"
 #include "partition.h"
 
@@ -88,7 +89,7 @@ IGL_INLINE void igl::uniformly_sample_two_manifold(
   // First get sampling as best as possible on mesh
   uniformly_sample_two_manifold_at_vertices(W,k,push,S);
   verbose("Lap: %g\n",get_seconds()-start);
-  WS = W(S,Eigen::placeholders::all);
+  WS = W(S,igl::placeholders::all);
   //cout<<"WSmesh=["<<endl<<WS<<endl<<"];"<<endl;
 
 //#ifdef EXTREME_VERBOSE
@@ -361,7 +362,7 @@ IGL_INLINE void igl::uniformly_sample_two_manifold_at_vertices(
   // Remove corners, which better be at top
   S = S.segment(W.cols(),k).eval();
 
-  MatrixXd WS = W(S,Eigen::placeholders::all);
+  MatrixXd WS = W(S,igl::placeholders::all);
   //cout<<"WSpartition=["<<endl<<WS<<endl<<"];"<<endl;
 
   // number of vertices

+ 3 - 2
tests/include/igl/AABB.cpp

@@ -4,6 +4,7 @@
 #include <igl/avg_edge_length.h>
 #include <igl/barycenter.h>
 #include <igl/colon.h>
+#include <igl/placeholders.h>
 #include <igl/get_seconds.h>
 #include <igl/point_mesh_squared_distance.h>
 #include <igl/point_simplex_squared_distance.h>
@@ -91,7 +92,7 @@ TEST_CASE("AABB: dynamic", "[igl]")
     // Load example mesh: GetParam() will be name of mesh file
     igl::read_triangle_mesh(test_common::data_path(param), V, F);
     // Make into soup
-    V = V(Eigen::Map<Eigen::VectorXi>(F.data(),F.size()), Eigen::placeholders::all).eval();
+    V = V(Eigen::Map<Eigen::VectorXi>(F.data(),F.size()), igl::placeholders::all).eval();
     F = Eigen::Map<Eigen::MatrixXi>(igl::colon<int>(0,V.rows()-1).data(),V.rows()/3,3).eval();
     Eigen::MatrixXd BC;
     igl::barycenter(V,F,BC);
@@ -160,7 +161,7 @@ TEST_CASE("AABB: dynamic", "[igl]")
       Eigen::MatrixXd TF = 0.1*h*Eigen::MatrixXd::Random(RF.size(),3);
       Eigen::MatrixXd TV(RV.rows(),3);
       TV<<TF,TF,TF;
-      V(RV,Eigen::placeholders::all) += TV;
+      V(RV,igl::placeholders::all) += TV;
       igl::barycenter(V,F,BC);
     }
     const int qi = RF(0);

+ 2 - 1
tests/include/igl/decimate.cpp

@@ -3,6 +3,7 @@
 #include <igl/sort.h>
 #include <igl/sortrows.h>
 #include <igl/matlab_format.h>
+#include <igl/placeholders.h>
 #include <iostream>
 
 // class decimate : public ::testing::TestWithParam<std::string> {};
@@ -27,7 +28,7 @@ TEST_CASE("decimate: hemisphere", "[igl]")
   igl::decimate(V,F,F.rows()/2,false,U,G,J,I);
   // Expect that all normals still point in same direction as original
   Eigen::MatrixXd NU = U.rowwise().normalized();
-  Eigen::MatrixXd NVI = NV(I,Eigen::placeholders::all);
+  Eigen::MatrixXd NVI = NV(I,igl::placeholders::all);
   REQUIRE (NU.rows() == NVI.rows());
   REQUIRE (NU.cols() == NVI.cols());
   // Dot product

+ 5 - 4
tests/include/igl/slice.cpp

@@ -1,5 +1,6 @@
 #include <test_common.h>
 #include <igl/LinSpaced.h>
+#include <igl/placeholders.h>
 #include <igl/randperm.h>
 // We don't want to include dense slices in the static library so include them
 // via header only mode for these tests (which themselves will eventually be
@@ -19,13 +20,13 @@ TEST_CASE("slice: eigen-simple", "[igl]")
   {
     Eigen::MatrixXd Yigl;
     igl::slice(X,I,1,Yigl);
-    Eigen::MatrixXd Yeigen  = X(I,Eigen::placeholders::all);
+    Eigen::MatrixXd Yeigen  = X(I,igl::placeholders::all);
     test_common::assert_eq(Yigl,Yeigen);
   }
   {
     Eigen::MatrixXd Yigl;
     igl::slice(X,I,2,Yigl);
-    Eigen::MatrixXd Yeigen  = X(Eigen::placeholders::all,I);
+    Eigen::MatrixXd Yeigen  = X(igl::placeholders::all,I);
     test_common::assert_eq(Yigl,Yeigen);
   }
 }
@@ -48,13 +49,13 @@ TEST_CASE("slice: eigen-random", "[igl]")
   {
     Eigen::MatrixXd Yigl;
     igl::slice(X,I,1,Yigl);
-    Eigen::MatrixXd Yeigen = X(I,Eigen::placeholders::all);
+    Eigen::MatrixXd Yeigen = X(I,igl::placeholders::all);
     test_common::assert_eq(Yigl,Yeigen);
   }
   {
     Eigen::MatrixXd Yigl;
     igl::slice(X,J,2,Yigl);
-    Eigen::MatrixXd Yeigen = X(Eigen::placeholders::all,J);
+    Eigen::MatrixXd Yeigen = X(igl::placeholders::all,J);
     test_common::assert_eq(Yigl,Yeigen);
   }
 }

+ 3 - 2
tests/include/igl/slice_into.cpp

@@ -2,6 +2,7 @@
 #include <igl/slice_into.h>
 #include <igl/LinSpaced.h>
 #include <igl/randperm.h>
+#include <igl/placeholders.h>
 
 TEST_CASE("slice_into: eigen-random", "[igl]")
 {
@@ -27,7 +28,7 @@ TEST_CASE("slice_into: eigen-random", "[igl]")
     Eigen::MatrixXd Yigl = X;
     igl::slice_into(Z,I,1,Yigl);
     Eigen::MatrixXd Yeigen = X;
-    Yeigen(I,Eigen::placeholders::all) = Z;
+    Yeigen(I,igl::placeholders::all) = Z;
     test_common::assert_eq(Yigl,Yeigen);
   }
   {
@@ -35,7 +36,7 @@ TEST_CASE("slice_into: eigen-random", "[igl]")
     Eigen::MatrixXd Yigl = X;
     igl::slice_into(Z,J,2,Yigl);
     Eigen::MatrixXd Yeigen = X;
-    Yeigen(Eigen::placeholders::all,J) = Z;
+    Yeigen(igl::placeholders::all,J) = Z;
     test_common::assert_eq(Yigl,Yeigen);
   }
   

+ 3 - 2
tests/include/igl/slice_mask.cpp

@@ -1,6 +1,7 @@
 #include <test_common.h>
 #include <igl/slice_mask.h>
 #include <igl/randperm.h>
+#include <igl/placeholders.h>
 #include <igl/find.h>
 
 TEST_CASE("slice_mask/find: random", "[igl]")
@@ -25,13 +26,13 @@ TEST_CASE("slice_mask/find: random", "[igl]")
   {
     Eigen::MatrixXd Yigl;
     igl::slice_mask(X,M,1,Yigl);
-    Eigen::MatrixXd Yfind = X(igl::find(M),Eigen::placeholders::all);
+    Eigen::MatrixXd Yfind = X(igl::find(M),igl::placeholders::all);
     test_common::assert_eq(Yigl,Yfind);
   }
   {
     Eigen::MatrixXd Yigl;
     igl::slice_mask(X,N,2,Yigl);
-    Eigen::MatrixXd Yfind = X(Eigen::placeholders::all,igl::find(N));
+    Eigen::MatrixXd Yfind = X(igl::placeholders::all,igl::find(N));
     test_common::assert_eq(Yigl,Yfind);
   }
 }

+ 116 - 0
tests/include/igl/triangle/refine.cpp

@@ -0,0 +1,116 @@
+#include <test_common.h>
+#include <igl/triangle/refine.h>
+#include <igl/triangle/triangulate.h>
+#include <igl/matlab_format.h>
+#include <igl/find.h>
+#include <igl/barycenter.h>
+#include <igl/winding_number.h>
+#include <igl/doublearea.h>
+#include <iostream>
+
+TEST_CASE("refine", "[igl][triangle]") {
+  Eigen::MatrixXd V(3,2);
+  V << 
+    0,0,
+    1,0,
+    0,1;
+  Eigen::MatrixXi F(1,3);
+  F<<0,1,2;
+  std::string flags = "a0.0625Q";
+  Eigen::MatrixXd V2;
+  Eigen::MatrixXi F2;
+  igl::triangle::refine(V,F,flags,V2,F2);
+  REQUIRE(F2.rows()>1);
+  Eigen::VectorXd A2;
+  igl::doublearea(V2,F2,A2);
+  REQUIRE((A2.array()<2*0.0625).all());
+}
+
+
+TEST_CASE("refine-inner-pinch", "[igl][triangle]") {
+  // Mesh an outline that looks like:
+  //
+  // o-----------------o
+  // |                 |
+  // |   o         o   |
+  // |   |\       /|   |
+  // |   | \     / |   |
+  // |   |  \   /  |   |
+  // |   |   \ /   |   |
+  // |   |    o    |   |
+  // |   o---------o   |
+  // |                 |
+  // o-----------------o
+  //
+  // If we mesh the whole convex hull and then remove the inner cavity we'll get
+  // over-refinement near the sharp corner.
+  //
+  // We could tell triangle a point inside this cavity but that's not often easy
+  // to do robustly/for broken input. Instead we can use a trivial mesh of the
+  // whole domain, remove the cavity with the winding number and then refine
+  // what's left.
+  //
+  Eigen::MatrixXd V(9,2);
+  V << 
+    0,0,
+    3,0,
+    3,3,
+    0,3,
+    1,1,
+    2,1,
+    2,2,
+    1.5,1.00000001,
+    1,2;
+  Eigen::MatrixXi E(9,2);
+  E <<
+    0,1,
+    1,2,
+    2,3,
+    3,0,
+    8,7,
+    7,6,
+    6,5,
+    5,4,
+    4,8;
+
+  Eigen::MatrixXd H(0,2);
+  const auto filter  = [&V,&E](
+    const Eigen::MatrixXd & Vc,
+    Eigen::MatrixXi & Fc)
+  {
+    Eigen::MatrixXd BC;
+    igl::barycenter(Vc,Fc,BC);
+    Eigen::VectorXd W;
+    // This is sadly O(|E| ⋅ |BC|) for 2D inputs.
+    igl::winding_number(V,E,BC,W);
+    auto keep = igl::find((W.array().abs() > 0.5).eval());
+    Fc = Fc(keep,Eigen::all).eval();
+  };
+
+  Eigen::MatrixXd Vq;
+  Eigen::MatrixXi Fq;
+  igl::triangle::triangulate(V,E,H,"cq33a0.0625Q",Vq,Fq);
+  filter(Vq,Fq);
+  //std::cout<<igl::matlab_format(Vq,"Vq")<<std::endl;
+  //std::cout<<igl::matlab_format_index(Fq,"Fq")<<std::endl;
+
+  Eigen::MatrixXd Vc;
+  Eigen::MatrixXi Fc;
+  igl::triangle::triangulate(V,E,H,"cQ",Vc,Fc);
+  REQUIRE(V.rows() == Vc.rows());
+  REQUIRE(Fc.rows() == 12);
+  filter(Vc,Fc);
+  REQUIRE(Fc.rows() == 9);
+  //std::cout<<igl::matlab_format(Vc,"Vc")<<std::endl;
+  //std::cout<<igl::matlab_format_index(Fc,"Fc")<<std::endl;
+
+  Eigen::MatrixXd Vr;
+  Eigen::MatrixXi Fr;
+
+  igl::triangle::refine(Vc,Fc,"q33a0.0625Q",Vr,Fr);
+  //std::cout<<igl::matlab_format(Vr,"Vr")<<std::endl;
+  //std::cout<<igl::matlab_format_index(Fr,"Fr")<<std::endl;
+  
+  REQUIRE(Fr.rows() > Fc.rows());
+  REQUIRE(Fr.rows() < 0.15 * Fq.rows());
+}

+ 3 - 2
tutorial/301_Slice/main.cpp

@@ -1,4 +1,5 @@
 #include <igl/floor.h>
+#include <igl/placeholders.h>
 #include <igl/readOFF.h>
 #include <igl/find.h>
 #include <igl/opengl/glfw/Viewer.h>
@@ -28,13 +29,13 @@ int main(int argc, char *argv[])
   // Red for each in K
   MatrixXd R = RowVector3d(1.0,0.3,0.3).replicate(K.rows(),1);
   // C(K,:) = R
-  C(K,Eigen::placeholders::all) = R;
+  C(K,igl::placeholders::all) = R;
   // igl::slice_into(R,K,1,C); no longer needed
 
   Eigen::Array<bool,Eigen::Dynamic,1> W = Eigen::VectorXd::Random(F.rows()).array()>0.5;
   // Set 1/4 of the colors  to blue
   MatrixXd B = RowVector3d(0.3,0.3,1.0).replicate(W.count(),1);
-  C(igl::find(W),Eigen::placeholders::all) = B;
+  C(igl::find(W),igl::placeholders::all) = B;
 
   // Plot the mesh with pseudocolors
   igl::opengl::glfw::Viewer viewer;

+ 2 - 1
tutorial/406_FastAutomaticSkinningTransformations/main.cpp

@@ -2,6 +2,7 @@
 
 #include <igl/readDMAT.h>
 #include <igl/readOBJ.h>
+#include <igl/placeholders.h>
 #include <igl/arap.h>
 #include <igl/arap_dof.h>
 #include <igl/opengl/glfw/Viewer.h>
@@ -146,7 +147,7 @@ int main(int argc, char *argv[])
   // Plot the mesh with pseudocolors
   igl::opengl::glfw::Viewer viewer;
   viewer.data().set_mesh(U, F);
-  viewer.data().add_points(V(b,Eigen::placeholders::all),sea_green);
+  viewer.data().add_points(V(b,igl::placeholders::all),sea_green);
   viewer.data().show_lines = false;
   viewer.callback_pre_draw = &pre_draw;
   viewer.callback_key_down = &key_down;

+ 4 - 3
tutorial/407_BiharmonicCoordinates/main.cpp

@@ -6,6 +6,7 @@
 #include <igl/massmatrix.h>
 #include <igl/matrix_to_list.h>
 #include <igl/parula.h>
+#include <igl/placeholders.h>
 #include <igl/point_mesh_squared_distance.h>
 #include <igl/readDMAT.h>
 #include <igl/readMESH.h>
@@ -67,7 +68,7 @@ int main(int argc, char * argv[])
     // with the vertices in high resolution. b is the list of vertices
     // corresponding to the indices in high resolution which has closest
     // distance to the points in low resolution
-    low.V = high.V(b,Eigen::placeholders::all);
+    low.V = high.V(b,igl::placeholders::all);
 
     // list of points --> list of singleton lists
     std::vector<std::vector<int> > S;
@@ -90,8 +91,8 @@ int main(int argc, char * argv[])
     igl::remove_unreferenced(high.V.rows(),high.F,I,J);
     for_each(high.F.data(),high.F.data()+high.F.size(),[&I](int & a){a=I(a);});
     for_each(b.data(),b.data()+b.size(),[&I](int & a){a=I(a);});
-    high.V = high.V(J,Eigen::placeholders::all).eval();
-    W = W(J,Eigen::placeholders::all).eval();
+    high.V = high.V(J,igl::placeholders::all).eval();
+    W = W(J,igl::placeholders::all).eval();
   }
 
   // Resize low res (high res will also be resized by affine precision of W)

+ 9 - 8
tutorial/504_Planarization/main.cpp

@@ -1,5 +1,6 @@
 #include <igl/avg_edge_length.h>
 #include <igl/barycenter.h>
+#include <igl/placeholders.h>
 #include <igl/jet.h>
 #include <igl/planarize_quad_mesh.h>
 #include <igl/quad_planarity.h>
@@ -90,19 +91,19 @@ int main(int argc, char *argv[])
   FQCtri.resize(2*FQC.rows(), 3);
   FQCtri <<  FQC.col(0),FQC.col(1),FQC.col(2),
              FQC.col(2),FQC.col(3),FQC.col(0);
-  PQC0 = VQC(FQC.col(0).eval(), Eigen::placeholders::all);
-  PQC1 = VQC(FQC.col(1).eval(), Eigen::placeholders::all);
-  PQC2 = VQC(FQC.col(2).eval(), Eigen::placeholders::all);
-  PQC3 = VQC(FQC.col(3).eval(), Eigen::placeholders::all);
+  PQC0 = VQC(FQC.col(0).eval(), igl::placeholders::all);
+  PQC1 = VQC(FQC.col(1).eval(), igl::placeholders::all);
+  PQC2 = VQC(FQC.col(2).eval(), igl::placeholders::all);
+  PQC3 = VQC(FQC.col(3).eval(), igl::placeholders::all);
 
   // Planarize it
   igl::planarize_quad_mesh(VQC, FQC, 100, 0.005, VQCplan);
 
   // Convert the planarized mesh to triangles
-  PQC0plan = VQCplan(FQC.col(0).eval(), Eigen::placeholders::all);
-  PQC1plan = VQCplan(FQC.col(1).eval(), Eigen::placeholders::all);
-  PQC2plan = VQCplan(FQC.col(2).eval(), Eigen::placeholders::all);
-  PQC3plan = VQCplan(FQC.col(3).eval(), Eigen::placeholders::all);
+  PQC0plan = VQCplan(FQC.col(0).eval(), igl::placeholders::all);
+  PQC1plan = VQCplan(FQC.col(1).eval(), igl::placeholders::all);
+  PQC2plan = VQCplan(FQC.col(2).eval(), igl::placeholders::all);
+  PQC3plan = VQCplan(FQC.col(3).eval(), igl::placeholders::all);
 
   // Launch the viewer
   igl::opengl::glfw::Viewer viewer;

+ 9 - 8
tutorial/803_ShapeUp/main.cpp

@@ -1,5 +1,6 @@
 #include <igl/avg_edge_length.h>
 #include <igl/barycenter.h>
+#include <igl/placeholders.h>
 #include <igl/jet.h>
 #include <igl/shapeup.h>
 #include <igl/quad_planarity.h>
@@ -110,10 +111,10 @@ int main(int argc, char *argv[])
   FQCtri.resize(2*FQC.rows(), 3);
   FQCtri <<  FQC.col(0),FQC.col(1),FQC.col(2),
              FQC.col(2),FQC.col(3),FQC.col(0);
-  PQC0 = VQC(FQC.col(0).eval(), Eigen::placeholders::all);
-  PQC1 = VQC(FQC.col(1).eval(), Eigen::placeholders::all);
-  PQC2 = VQC(FQC.col(2).eval(), Eigen::placeholders::all);
-  PQC3 = VQC(FQC.col(3).eval(), Eigen::placeholders::all);
+  PQC0 = VQC(FQC.col(0).eval(), igl::placeholders::all);
+  PQC1 = VQC(FQC.col(1).eval(), igl::placeholders::all);
+  PQC2 = VQC(FQC.col(2).eval(), igl::placeholders::all);
+  PQC3 = VQC(FQC.col(3).eval(), igl::placeholders::all);
 
   // Create a planar version with ShapeUp
   //igl::planarize_quad_mesh(VQC, FQC, 100, 0.005, VQCregular);
@@ -137,10 +138,10 @@ int main(int argc, char *argv[])
 
 
   // Convert the planarized mesh to triangles
-  PQC0regular = VQCregular(FQC.col(0).eval(), Eigen::placeholders::all);
-  PQC1regular = VQCregular(FQC.col(1).eval(), Eigen::placeholders::all);
-  PQC2regular = VQCregular(FQC.col(2).eval(), Eigen::placeholders::all);
-  PQC3regular = VQCregular(FQC.col(3).eval(), Eigen::placeholders::all);
+  PQC0regular = VQCregular(FQC.col(0).eval(), igl::placeholders::all);
+  PQC1regular = VQCregular(FQC.col(1).eval(), igl::placeholders::all);
+  PQC2regular = VQCregular(FQC.col(2).eval(), igl::placeholders::all);
+  PQC3regular = VQCregular(FQC.col(3).eval(), igl::placeholders::all);
 
   // Launch the viewer
   igl::opengl::glfw::Viewer viewer;

+ 2 - 1
tutorial/805_MeshImplicitFunction/contours.cpp

@@ -1,5 +1,6 @@
 #include "contours.h"
 #include <igl/unique_simplices.h>
+#include <igl/placeholders.h>
 #include <igl/dual_contouring.h>
 #include <igl/get_seconds.h>
 #include <igl/grid.h>
@@ -194,7 +195,7 @@ void contours(
       Q.col(2), Q.col(3), 
       Q.col(3), Q.col(0);
     igl::per_face_normals(V,I,C,N,VV,FF,J);
-    NN = N(J,Eigen::placeholders::all);
+    NN = N(J,igl::placeholders::all);
     igl::per_corner_normals(V,I,C,20,N,VV,FF,J,NN);
   }
 

+ 2 - 2
tutorial/906_TrimWithSolid/main.cpp

@@ -32,10 +32,10 @@ int main(int argc, char *argv[])
   tictoc();
   // More patches, less intersection handling
   igl::copyleft::cgal::trim_with_solid(VA, FA, VB, FB, CHECK_EACH_PATCH, VC, FC, D, J);
-  printf("CHECK_EACH_PATCH: %g secs, |FC| = %d, |D| = %d\n", tictoc(),FC.rows(),D.count());
+  printf("CHECK_EACH_PATCH: %g secs, |FC| = %td, |D| = %td\n", tictoc(),FC.rows(),D.count());
   // More intersection handling, fewer patches
   igl::copyleft::cgal::trim_with_solid(VA, FA, VB, FB, RESOLVE_BOTH_AND_RESTORE_THEN_CHECK_EACH_PATCH, VC, FC, D, J);
-  printf("RESOLVE_BOTH_...: %g secs, |FC| = %d, |D| = %d\n", tictoc(),FC.rows(),D.count());
+  printf("RESOLVE_BOTH_...: %g secs, |FC| = %td, |D| = %td\n", tictoc(),FC.rows(),D.count());
 
   igl::opengl::glfw::Viewer vr;
   vr.data().set_mesh(VC, FC);

+ 3 - 2
tutorial/907_DynamicAABB/main.cpp

@@ -1,5 +1,6 @@
 #include <igl/AABB.h>
 #include <igl/box_faces.h>
+#include <igl/placeholders.h>
 #include <igl/colon.h>
 #include <igl/find.h>
 #include <igl/get_seconds.h>
@@ -21,7 +22,7 @@ int main(int argc, char *argv[])
   igl::read_triangle_mesh(
     argc>1?argv[1]:TUTORIAL_SHARED_PATH "/decimated-knight.off",V,F);
   // Make mesh into disconnected soup
-  V = V(Eigen::Map<Eigen::VectorXi>(F.data(),F.size()), Eigen::placeholders::all).eval();
+  V = V(Eigen::Map<Eigen::VectorXi>(F.data(),F.size()), igl::placeholders::all).eval();
   F = Eigen::Map<Eigen::MatrixXi>(igl::colon<int>(0,V.rows()-1).data(),V.rows()/3,3).eval();
   // Cache normals
   igl::per_face_normals(V,F,N);
@@ -46,7 +47,7 @@ int main(int argc, char *argv[])
   Eigen::VectorXi TD;
   const auto update_edges = [&]()
   {
-    Eigen::MatrixXi TQd = TQ(igl::find((TD.array()==depth).eval()),Eigen::placeholders::all);
+    Eigen::MatrixXi TQd = TQ(igl::find((TD.array()==depth).eval()),igl::placeholders::all);
     Eigen::MatrixXi TE;
     igl::quad_edges(TQd,TE);
     vr.data().set_edges(TV,TE,Eigen::RowVector3d(1,1,1));

+ 3 - 2
tutorial/908_IntersectionBlockingDecimation/main.cpp

@@ -1,5 +1,6 @@
 #include <igl/opengl/glfw/Viewer.h>
 #include <igl/read_triangle_mesh.h>
+#include <igl/placeholders.h>
 #include <igl/predicates/find_self_intersections.h>
 #include <igl/unique.h>
 #include <igl/remove_unreferenced.h>
@@ -87,7 +88,7 @@ int main(int argc, char *argv[])
       post_collapse,
       E, EMAP, EF, EI,
       U, G, J, I);
-    G = G(igl::find((J.array()<orig_m).eval()), Eigen::placeholders::all).eval();
+    G = G(igl::find((J.array()<orig_m).eval()), igl::placeholders::all).eval();
     {
       Eigen::VectorXi _;
       igl::remove_unreferenced(Eigen::MatrixXd(U),Eigen::MatrixXi(G),U,G,_);
@@ -106,7 +107,7 @@ int main(int argc, char *argv[])
       }
       printf("  # self-intersections: %d\n",(int)BI.size());
       dC[pass] = gray.replicate(dF[pass].rows(),1);
-      dC[pass](BI,Eigen::placeholders::all) = 
+      dC[pass](BI,igl::placeholders::all) = 
         Eigen::RowVector3d(0.95,0.15,0.15).replicate(BI.size(),1);
     }
   }