Alec Jacobson 6 years ago
parent
commit
10ad76e11e
51 changed files with 309 additions and 133 deletions
  1. 0 2
      include/igl/find.cpp
  2. 1 0
      include/igl/grid.h
  3. 4 0
      include/igl/null.cpp
  4. 11 10
      include/igl/opengl/ViewerData.cpp
  5. 1 1
      include/igl/opengl/ViewerData.h
  6. 4 1
      include/igl/opengl/glfw/Viewer.cpp
  7. 1 0
      include/igl/opengl/glfw/imgui/ImGuiMenu.cpp
  8. 29 17
      include/igl/polar_svd.cpp
  9. 2 2
      include/igl/polar_svd.h
  10. 2 0
      include/igl/project.cpp
  11. 4 0
      include/igl/project.h
  12. 97 0
      include/igl/quad_grid.cpp
  13. 50 0
      include/igl/quad_grid.h
  14. 12 0
      include/igl/triangulated_grid.cpp
  15. 10 0
      include/igl/triangulated_grid.h
  16. 1 0
      include/igl/unproject.cpp
  17. 4 0
      include/igl/unproject.h
  18. 1 1
      tests/include/igl/avg_edge_length.cpp
  19. 2 2
      tests/include/igl/boundary_loop.cpp
  20. 4 4
      tests/include/igl/copyleft/boolean/mesh_boolean.cpp
  21. 1 1
      tests/include/igl/copyleft/cgal/CSGTree.cpp
  22. 2 2
      tests/include/igl/copyleft/cgal/hausdorff.cpp
  23. 2 2
      tests/include/igl/copyleft/cgal/mesh_to_polyhedron.cpp
  24. 3 3
      tests/include/igl/copyleft/cgal/order_facets_around_edges.cpp
  25. 5 5
      tests/include/igl/copyleft/cgal/outer_facet.cpp
  26. 1 1
      tests/include/igl/copyleft/cgal/outer_hull.cpp
  27. 2 2
      tests/include/igl/copyleft/cgal/peel_outer_hull_layers.cpp
  28. 3 3
      tests/include/igl/copyleft/cgal/points_inside_component.cpp
  29. 1 1
      tests/include/igl/copyleft/cgal/remesh_self_intersections.cpp
  30. 3 3
      tests/include/igl/cotmatrix.cpp
  31. 2 2
      tests/include/igl/cotmatrix_entries.cpp
  32. 1 1
      tests/include/igl/cotmatrix_intrinsic.cpp
  33. 3 3
      tests/include/igl/cut_to_disk.cpp
  34. 2 2
      tests/include/igl/decimate.cpp
  35. 1 1
      tests/include/igl/dijkstra.cpp
  36. 1 1
      tests/include/igl/doublearea.cpp
  37. 1 1
      tests/include/igl/edge_flaps.cpp
  38. 1 1
      tests/include/igl/edge_lengths.cpp
  39. 1 1
      tests/include/igl/embree/EmbreeIntersector.cpp
  40. 1 1
      tests/include/igl/intrinsic_delaunay_cotmatrix.cpp
  41. 2 2
      tests/include/igl/is_edge_manifold.cpp
  42. 1 1
      tests/include/igl/is_irregular_vertex.cpp
  43. 1 1
      tests/include/igl/iterative_closest_point.cpp
  44. 1 1
      tests/include/igl/per_face_normals.cpp
  45. 2 2
      tests/include/igl/readDMAT.cpp
  46. 4 2
      tests/include/igl/readOBJ.cpp
  47. 1 1
      tests/include/igl/readOFF.cpp
  48. 1 1
      tests/include/igl/squared_edge_lengths.cpp
  49. 1 1
      tests/include/igl/triangle_triangle_adjacency.cpp
  50. 1 1
      tests/include/igl/upsample.cpp
  51. 17 43
      tests/test_common.h

+ 0 - 2
include/igl/find.cpp

@@ -132,8 +132,6 @@ template void igl::find<double, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Mat
 template void igl::find<Eigen::Matrix<bool, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<bool, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #if EIGEN_VERSION_AT_LEAST(3,3,0)
 #else
-template void igl::find<Eigen::CwiseBinaryOp<Eigen::internal::scalar_cmp_op<long, (Eigen::internal::ComparisonName)0>, Eigen::PartialReduxExpr<Eigen::Array<bool, -1, 3, 0, -1, 3>, Eigen::internal::member_count<long>, 1> const, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<long>, Eigen::Array<long, -1, 1, 0, -1, 1> > const>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::CwiseBinaryOp<Eigen::internal::scalar_cmp_op<long, (Eigen::internal::ComparisonName)0>, Eigen::PartialReduxExpr<Eigen::Array<bool, -1, 3, 0, -1, 3>, Eigen::internal::member_count<long>, 1> const, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<long>, Eigen::Array<long, -1, 1, 0, -1, 1> > const> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::find<Eigen::CwiseBinaryOp<Eigen::internal::scalar_cmp_op<int, (Eigen::internal::ComparisonName)0>, Eigen::Array<int, -1, 1, 0, -1, 1> const, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<int>, Eigen::Array<int, -1, 1, 0, -1, 1> > const>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::CwiseBinaryOp<Eigen::internal::scalar_cmp_op<int, (Eigen::internal::ComparisonName)0>, Eigen::Array<int, -1, 1, 0, -1, 1> const, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<int>, Eigen::Array<int, -1, 1, 0, -1, 1> > const> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif
 
 #endif

+ 1 - 0
include/igl/grid.h

@@ -21,6 +21,7 @@ namespace igl
   // Outputs:
   //   GV  res.array().prod() by #res list of mesh vertex positions.
   //   
+  //   See also: triangulated_grid, quad_grid
   template <
     typename Derivedres,
     typename DerivedGV>

+ 4 - 0
include/igl/null.cpp

@@ -19,3 +19,7 @@ IGL_INLINE void igl::null(
   svd.setThreshold(A.cols() * svd.singularValues().maxCoeff() * EPS<Scalar>());
   N = svd.matrixV().rightCols(A.cols()-svd.rank());
 }
+
+#ifdef IGL_STATIC_LIBRARY
+template void igl::null<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+#endif

+ 11 - 10
include/igl/opengl/ViewerData.cpp

@@ -19,22 +19,23 @@
 
 IGL_INLINE igl::opengl::ViewerData::ViewerData()
 : dirty(MeshGL::DIRTY_ALL),
-  show_faces(true),
-  show_lines(true),
-  invert_normals(false),
-  show_overlay(true),
-  show_overlay_depth(true),
-  show_vertid(false),
-  show_faceid(false),
-  show_labels(false),
-  show_texture(false),
+  // UINT_MAX sets all bits to 1 so these defaults get applied to all view cores
+  show_faces        (UINT_MAX),
+  show_lines        (UINT_MAX),
+  invert_normals    (false),
+  show_overlay      (UINT_MAX),
+  show_overlay_depth(UINT_MAX),
+  show_vertid       (false),
+  show_faceid       (false),
+  show_labels       (false),
+  show_texture      (false),
   point_size(30),
   line_width(0.5f),
   line_color(0,0,0,1),
   label_color(0,0,0.04,1),
   shininess(35.0f),
   id(-1),
-  is_visible(1)
+  is_visible        (UINT_MAX)
 {
   clear();
 };

+ 1 - 1
include/igl/opengl/ViewerData.h

@@ -97,7 +97,7 @@ public:
     const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& B,
     const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& A);
 
-  // Sets points given a list of point vertices. In constrast to `set_points`
+  // Sets points given a list of point vertices. In constrast to `add_points`
   // this will (purposefully) clober existing points.
   //
   // Inputs:

+ 4 - 1
include/igl/opengl/glfw/Viewer.cpp

@@ -211,7 +211,10 @@ namespace glfw
     highdpi = windowWidth/width_window;
     glfw_window_size(window,width_window,height_window);
     //opengl.init();
-    core().align_camera_center(data().V,data().F);
+    for(int i=0;i<core_list.size(); i++)
+    {
+      core_list[i].align_camera_center(data().V,data().F);
+    }
     // Initialize IGL viewer
     init();
     return EXIT_SUCCESS;

+ 1 - 0
include/igl/opengl/glfw/imgui/ImGuiMenu.cpp

@@ -335,6 +335,7 @@ IGL_INLINE void ImGuiMenu::draw_labels_window()
 
 IGL_INLINE void ImGuiMenu::draw_labels(const igl::opengl::ViewerData &data)
 {
+  // Alec: How can we get these to respect (optionally) the depth of the scene?
   if (data.show_vertid)
   {
     for (int i = 0; i < data.V.rows(); ++i)

+ 29 - 17
include/igl/polar_svd.cpp

@@ -16,12 +16,17 @@ template <
   typename DerivedR,
   typename DerivedT>
 IGL_INLINE void igl::polar_svd(
-  const Eigen::PlainObjectBase<DerivedA> & A,
+  const Eigen::MatrixBase<DerivedA> & A,
   Eigen::PlainObjectBase<DerivedR> & R,
   Eigen::PlainObjectBase<DerivedT> & T)
 {
-  DerivedA U;
-  DerivedA V;
+  typedef 
+    Eigen::Matrix<typename DerivedA::Scalar,
+    DerivedA::RowsAtCompileTime,
+    DerivedA::ColsAtCompileTime>
+    MatA;
+  MatA U;
+  MatA V;
   Eigen::Matrix<typename DerivedA::Scalar,DerivedA::RowsAtCompileTime,1> S;
   return igl::polar_svd(A,R,T,U,S,V);
 }
@@ -34,7 +39,7 @@ template <
   typename DerivedS,
   typename DerivedV>
 IGL_INLINE void igl::polar_svd(
-  const Eigen::PlainObjectBase<DerivedA> & A,
+  const Eigen::MatrixBase<DerivedA> & A,
   Eigen::PlainObjectBase<DerivedR> & R,
   Eigen::PlainObjectBase<DerivedT> & T,
   Eigen::PlainObjectBase<DerivedU> & U,
@@ -42,7 +47,12 @@ IGL_INLINE void igl::polar_svd(
   Eigen::PlainObjectBase<DerivedV> & V)
 {
   using namespace std;
-  Eigen::JacobiSVD<DerivedA> svd;
+  typedef 
+    Eigen::Matrix<typename DerivedA::Scalar,
+    DerivedA::RowsAtCompileTime,
+    DerivedA::ColsAtCompileTime>
+    MatA;
+  Eigen::JacobiSVD<MatA> svd;
   svd.compute(A, Eigen::ComputeFullU | Eigen::ComputeFullV );
   U = svd.matrixU();
   V = svd.matrixV();
@@ -65,16 +75,18 @@ IGL_INLINE void igl::polar_svd(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -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<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::polar_svd<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
-template void igl::polar_svd<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&);
-template void igl::polar_svd<Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2> >(Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&);
-template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
-template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::polar_svd<Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,1,0,3,1>,Eigen::Matrix<float,3,3,0,3,3> >(Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > const &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,1,0,3,1> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> >&);
-template void igl::polar_svd<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 3, 0, 3, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&);
-template void igl::polar_svd<Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 1, 0, 2, 1>, Eigen::Matrix<float, 2, 2, 0, 2, 2> >(Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 1, 0, 2, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&);
-template void igl::polar_svd<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 1, 0, 2, 1>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
-template void igl::polar_svd<Eigen::Matrix<double, -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<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -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<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+// generated by autoexplicit.sh
+template void igl::polar_svd<Eigen::Transpose<Eigen::Matrix<double, 3, 3, 0, 3, 3> >, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Transpose<Eigen::Matrix<double, 3, 3, 0, 3, 3> > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::polar_svd<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::MatrixBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
+template void igl::polar_svd<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&);
+template void igl::polar_svd<Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2> >(Eigen::MatrixBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&);
+template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
+template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::polar_svd<Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,1,0,3,1>,Eigen::Matrix<float,3,3,0,3,3> >(Eigen::MatrixBase<Eigen::Matrix<float,3,3,0,3,3> > const &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,1,0,3,1> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> >&);
+template void igl::polar_svd<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 3, 0, 3, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&);
+template void igl::polar_svd<Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 1, 0, 2, 1>, Eigen::Matrix<float, 2, 2, 0, 2, 2> >(Eigen::MatrixBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 1, 0, 2, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&);
+template void igl::polar_svd<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 1, 0, 2, 1>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::MatrixBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
+template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif

+ 2 - 2
include/igl/polar_svd.h

@@ -33,7 +33,7 @@ namespace igl
     typename DerivedS,
     typename DerivedV>
   IGL_INLINE void polar_svd(
-    const Eigen::PlainObjectBase<DerivedA> & A,
+    const Eigen::MatrixBase<DerivedA> & A,
     Eigen::PlainObjectBase<DerivedR> & R,
     Eigen::PlainObjectBase<DerivedT> & T,
     Eigen::PlainObjectBase<DerivedU> & U,
@@ -44,7 +44,7 @@ namespace igl
     typename DerivedR,
     typename DerivedT>
   IGL_INLINE void polar_svd(
-    const Eigen::PlainObjectBase<DerivedA> & A,
+    const Eigen::MatrixBase<DerivedA> & A,
     Eigen::PlainObjectBase<DerivedR> & R,
     Eigen::PlainObjectBase<DerivedT> & T);
 }

+ 2 - 0
include/igl/project.cpp

@@ -56,4 +56,6 @@ template Eigen::Matrix<double, 3, 1, 0, 3, 1> igl::project<double>(Eigen::Matrix
 template Eigen::Matrix<float, 3, 1, 0, 3, 1> igl::project<float>(Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&);
 template void igl::project<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 1, 0, 4, 1>, Eigen::Matrix<float, -1, -1, 0, -1, -1>>(const Eigen::MatrixBase<Eigen::Matrix<float, -1, -1, 0, -1, -1>>&, const Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4>>&, const Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4>>&, const Eigen::MatrixBase<Eigen::Matrix<float, 4, 1, 0, 4, 1>>&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1>>&);
 template void igl::project<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 4, 4, 0, 4, 4>, Eigen::Matrix<double, 4, 4, 0, 4, 4>, Eigen::Matrix<double, 4, 1, 0, 4, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(const Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>&, const Eigen::MatrixBase<Eigen::Matrix<double, 4, 4, 0, 4, 4>>&, const Eigen::MatrixBase<Eigen::Matrix<double, 4, 4, 0, 4, 4>>&, const Eigen::MatrixBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>>&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>&);
+template void igl::project<Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 1, 0, 4, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 1, 0, 4, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
+template void igl::project<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 1, 0, 4, 1>, Eigen::Matrix<double, 1, 3, 1, 1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 1, 0, 4, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&);
 #endif

+ 4 - 0
include/igl/project.h

@@ -32,6 +32,10 @@ namespace igl
   //   viewport  viewport vector
   // Outputs:
   //   P  #V by 3 list of screen space points
+  //
+  // Known issue:
+  //   The compiler will not complain if V and P are Vector3d, but the result
+  //   will be incorrect.
   template <typename DerivedV, typename DerivedM, typename DerivedN, typename DerivedO, typename DerivedP>
   IGL_INLINE void project(
     const    Eigen::MatrixBase<DerivedV>&  V,

+ 97 - 0
include/igl/quad_grid.cpp

@@ -0,0 +1,97 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2019 Alec Jacobson <[email protected]>
+// 
+// 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 "quad_grid.h"
+#include "grid.h"
+
+template<
+  typename DerivedV,
+  typename DerivedQ,
+  typename DerivedE>
+IGL_INLINE void igl::quad_grid(
+  const int nx,
+  const int ny,
+  Eigen::PlainObjectBase<DerivedV> & V,
+  Eigen::PlainObjectBase<DerivedQ> & Q,
+  Eigen::PlainObjectBase<DerivedE> & E)
+{
+  grid(Eigen::Vector2i(nx,ny),V);
+  return igl::quad_grid(nx,ny,Q,E);
+}
+
+template<
+  typename DerivedQ,
+  typename DerivedE>
+IGL_INLINE void igl::quad_grid(
+  const int nx,
+  const int ny,
+  Eigen::PlainObjectBase<DerivedQ> & Q,
+  Eigen::PlainObjectBase<DerivedE> & E)
+{
+  Eigen::MatrixXi I(nx,ny);
+  Q.resize(  (nx-1)*(ny-1),4);
+  E.resize((nx-1)*ny + (ny-1)*nx,2);
+  {
+    int v = 0;
+    int q = 0;
+    int e = 0;
+    // Ordered to match igl::grid
+    for(int y = 0;y<ny;y++)
+    {
+      for(int x = 0;x<nx;x++)
+      {
+        //// Add a vertex
+        //V(v,0) = (-1.0) + double(x)/double(nx-1) * (1.0 - (-1.0));
+        //V(v,2) = (-1.0) + double(y)/double(ny-1) * (1.0 - (-1.0));
+        I(x,y) = v;
+        v++;
+        // Add a verical edge
+        if(y>0)
+        {
+          E(e,0) = I(x,y);
+          E(e,1) = I(x,y-1);
+          e++;
+        }
+        // Add a horizontal edge
+        if(x>0)
+        {
+          E(e,0) = I(x,y);
+          E(e,1) = I(x-1,y);
+          e++;
+        }
+        // Add two triangles
+        if(x>0 && y>0)
+        {
+          // -1,0----0,0
+          //   |    / |
+          //   |   /  |
+          //   |  /   |
+          //   | /    |
+          // -1,-1---0,-1
+          Q(q,0) = I(x-0,y-0);
+          Q(q,1) = I(x-1,y-0);
+          Q(q,2) = I(x-1,y-1);
+          Q(q,3) = I(x-0,y-1);
+          q++;
+          //F(f,2) = I(x-0,y-0);
+          //F(f,1) = I(x-1,y-0);
+          //F(f,0) = I(x-1,y-1);
+          //f++;
+          //F(f,2) = I(x-0,y-0);
+          //F(f,1) = I(x-1,y-1);
+          //F(f,0) = I(x-0,y-1);
+          //f++;
+        }
+      }
+    }
+  }
+}
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template instantiation
+template void igl::quad_grid<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(int, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+#endif

+ 50 - 0
include/igl/quad_grid.h

@@ -0,0 +1,50 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2019 Alec Jacobson <[email protected]>
+// 
+// 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_QUAD_GRID_H
+#define IGL_QUAD_GRID_H
+
+#include <igl/igl_inline.h>
+#include <Eigen/Core>
+
+namespace igl
+{
+  // Generate a quad mesh over a regular grid.
+  //
+  // Inputs:
+  //   nx  number of vertices in the x direction
+  //   ny  number of vertices in the y direction
+  // Outputs:
+  //   V  nx*ny by 2 list of vertex positions
+  //   Q  (nx-1)*(ny-1) by 4 list of quad indices into V
+  //   E  (nx-1)*ny+(ny-1)*nx by 2 list of undirected quad edge indices into V
+  //
+  //   See also: grid, triangulated_grid
+  template<
+    typename DerivedV,
+    typename DerivedQ,
+    typename DerivedE>
+  IGL_INLINE void quad_grid(
+    const int nx,
+    const int ny,
+    Eigen::PlainObjectBase<DerivedV> & V,
+    Eigen::PlainObjectBase<DerivedQ> & Q,
+    Eigen::PlainObjectBase<DerivedE> & E);
+  template<
+    typename DerivedQ,
+    typename DerivedE>
+  IGL_INLINE void quad_grid(
+    const int nx,
+    const int ny,
+    Eigen::PlainObjectBase<DerivedQ> & Q,
+    Eigen::PlainObjectBase<DerivedE> & E);
+}
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "quad_grid.cpp"
+#endif
+#endif

+ 12 - 0
include/igl/triangulated_grid.cpp

@@ -23,6 +23,18 @@ IGL_INLINE void igl::triangulated_grid(
   using namespace Eigen;
   Eigen::Matrix<XType,2,1> res(nx,ny);
   igl::grid(res,GV);
+  return igl::triangulated_grid(nx,ny,GF);
+};
+
+template <
+  typename XType,
+  typename YType,
+  typename DerivedGF>
+IGL_INLINE void igl::triangulated_grid(
+  const XType & nx,
+  const YType & ny,
+  Eigen::PlainObjectBase<DerivedGF> & GF)
+{
   GF.resize((nx-1)*(ny-1)*2,3);
   for(int y = 0;y<ny-1;y++)
   {

+ 10 - 0
include/igl/triangulated_grid.h

@@ -20,6 +20,8 @@ namespace igl
   // Outputs:
   //   GV  nx*ny by 2 list of mesh vertex positions.
   //   GF  2*(nx-1)*(ny-1) by 3  list of triangle indices
+  //
+  //   See also: grid, quad_grid
   template <
     typename XType,
     typename YType,
@@ -30,6 +32,14 @@ namespace igl
     const YType & ny,
     Eigen::PlainObjectBase<DerivedGV> & GV,
     Eigen::PlainObjectBase<DerivedGF> & GF);
+  template <
+    typename XType,
+    typename YType,
+    typename DerivedGF>
+  IGL_INLINE void triangulated_grid(
+    const XType & nx,
+    const YType & ny,
+    Eigen::PlainObjectBase<DerivedGF> & GF);
 }
 #ifndef IGL_STATIC_LIBRARY
 #  include "triangulated_grid.cpp"

+ 1 - 0
include/igl/unproject.cpp

@@ -71,4 +71,5 @@ template Eigen::Matrix<float, 3, 1, 0, 3, 1> igl::unproject<float>(Eigen::Matrix
 template Eigen::Matrix<double, 3, 1, 0, 3, 1> igl::unproject<double>(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 4, 4, 0, 4, 4> const&, Eigen::Matrix<double, 4, 4, 0, 4, 4> const&, Eigen::Matrix<double, 4, 1, 0, 4, 1> const&);
 template void igl::unproject<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 1, 0, 4, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 1, 0, 4, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::unproject<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 1, 0, 4, 1>, Eigen::Matrix<float, 3, 1, 0, 3, 1> >(Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 1, 0, 4, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> >&);
+template void igl::unproject<Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 4, 0, 4, 4>, Eigen::Matrix<float, 4, 1, 0, 4, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 4, 1, 0, 4, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
 #endif

+ 4 - 0
include/igl/unproject.h

@@ -20,6 +20,10 @@ namespace igl
   //   viewport  4-long viewport vector
   // Outputs:
   //   scene  #P by 3 or 3-vector (#P=1) the unprojected x, y, and z coordinates
+  //
+  // Known issue:
+  //   The compiler will not complain if V and P are Vector3d, but the result
+  //   will be incorrect.
   template <
     typename Derivedwin,
     typename Derivedmodel,

+ 1 - 1
tests/include/igl/avg_edge_length.cpp

@@ -10,7 +10,7 @@ TEST_CASE("avg_edge_length: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
   //Create scaled versions of the cube
   double scale = 1.0;
   double huge_scale = 1.0e8;

+ 2 - 2
tests/include/igl/boundary_loop.cpp

@@ -9,7 +9,7 @@ TEST_CASE("boundary_loop: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.off", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.off"), V, F);
 
   //Compute Boundary Loop
   Eigen::VectorXi boundary;
@@ -24,7 +24,7 @@ TEST_CASE("boundary_loop: bunny", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //Load the Stanford bunny
-  test_common::load_mesh("bunny.off", V, F);
+  igl::read_triangle_mesh(test_common::data_path("bunny.off"), V, F);
 
   //Compute list of ordered boundary loops for a manifold mesh
   std::vector<std::vector<int> >boundaries;

+ 4 - 4
tests/include/igl/copyleft/boolean/mesh_boolean.cpp

@@ -55,7 +55,7 @@ namespace {
 TEST_CASE("MeshBoolean: TwoCubes", "[igl/copyleft/boolean]") {
     Eigen::MatrixXd V1;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("two-boxes-bad-self-union.ply", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("two-boxes-bad-self-union.ply"), V1, F1);
 
     Eigen::MatrixXd V2(0, 3);
     Eigen::MatrixXi F2(0, 3);
@@ -76,8 +76,8 @@ TEST_CASE("MeshBoolean: MinusTest", "[igl/copyleft/boolean]") {
     // Many thanks to Eric Yao for submitting this test case.
     Eigen::MatrixXd V1, V2, Vo;
     Eigen::MatrixXi F1, F2, Fo;
-    test_common::load_mesh("boolean_minus_test_cube.obj", V1, F1);
-    test_common::load_mesh("boolean_minus_test_green.obj", V2, F2);
+    igl::read_triangle_mesh(test_common::data_path("boolean_minus_test_cube.obj"), V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("boolean_minus_test_green.obj"), V2, F2);
 
     igl::copyleft::cgal::mesh_boolean(V1, F1, V2, F2,
             igl::MESH_BOOLEAN_TYPE_MINUS,
@@ -91,7 +91,7 @@ TEST_CASE("MeshBoolean: MinusTest", "[igl/copyleft/boolean]") {
 TEST_CASE("MeshBoolean: IntersectWithSelf", "[igl/copyleft/boolean]") {
     Eigen::MatrixXd V1, Vo;
     Eigen::MatrixXi F1, Fo;
-    test_common::load_mesh("cube.obj", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
 
     igl::copyleft::cgal::mesh_boolean(V1, F1, V1, F1,
             igl::MESH_BOOLEAN_TYPE_INTERSECT,

+ 1 - 1
tests/include/igl/copyleft/cgal/CSGTree.cpp

@@ -5,7 +5,7 @@
 TEST_CASE("CSGTree: extrusion", "[igl/copyleft/cgal]") {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh("extrusion.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("extrusion.obj"), V, F);
     igl::copyleft::cgal::CSGTree tree(V, F);
     igl::copyleft::cgal::CSGTree inter(tree, tree, "i"); // returns error
 

+ 2 - 2
tests/include/igl/copyleft/cgal/hausdorff.cpp

@@ -9,8 +9,8 @@ TEST_CASE("hausdorff: knightVScheburashka", "[igl/copyleft/cgal]")
 {
   Eigen::MatrixXd VA,VB;
   Eigen::MatrixXi FA,FB;
-  test_common::load_mesh("decimated-knight.obj", VA, FA);
-  test_common::load_mesh("cheburashka.off", VB, FB);
+  igl::read_triangle_mesh(test_common::data_path("decimated-knight.obj"), VA, FA);
+  igl::read_triangle_mesh(test_common::data_path("cheburashka.off"), VB, FB);
   //typedef CGAL::Epeck Kernel;
   typedef CGAL::Simple_cartesian<double> Kernel;
   CGAL::AABB_tree<

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

@@ -12,7 +12,7 @@ TEST_CASE(
   {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     CGAL::Polyhedron_3<
       CGAL::Simple_cartesian<double>, 
       CGAL::Polyhedron_items_with_id_3, 
@@ -31,7 +31,7 @@ TEST_CASE(
 {
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
-  test_common::load_mesh("truck.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("truck.obj"), V, F);
   CGAL::Polyhedron_3<
     CGAL::Simple_cartesian<double>, 
     CGAL::Polyhedron_items_with_id_3, 

+ 3 - 3
tests/include/igl/copyleft/cgal/order_facets_around_edges.cpp

@@ -54,7 +54,7 @@ void assert_order(
         Eigen::MatrixXd N;
         //igl::per_face_normals_stable(V, F, N);
         //igl::per_face_normals(V, F, N);
-        test_common::load_matrix(normal, N);
+        igl::readDMAT(test_common::data_path(normal), N);
         igl::copyleft::cgal::order_facets_around_edges(
           V, F, N, uE, uE2E, uE2oE, uE2C);
     } else {
@@ -192,9 +192,9 @@ TEST_CASE("copyleft_cgal_order_facets_around_edges: NormalSensitivity", "[igl/co
     // results in very different ordering of facets.
 
     Eigen::MatrixXd V;
-    test_common::load_matrix("duplicated_faces_V.dmat", V);
+    igl::readDMAT(test_common::data_path("duplicated_faces_V.dmat"), V);
     Eigen::MatrixXi F;
-    test_common::load_matrix("duplicated_faces_F.dmat", F);
+    igl::readDMAT(test_common::data_path("duplicated_faces_F.dmat"), F);
 
     assert_order(V, F, 223, 224, {2, 0, 3, 1}, "duplicated_faces_N1.dmat");
     assert_order(V, F, 223, 224, {0, 3, 2, 1}, "duplicated_faces_N2.dmat");

+ 5 - 5
tests/include/igl/copyleft/cgal/outer_facet.cpp

@@ -22,7 +22,7 @@ TEST_CASE("OuterFacet: Simple", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
     const size_t num_faces = F.rows();
 
@@ -41,7 +41,7 @@ TEST_CASE("OuterFacet: DuplicatedOppositeFaces", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("cube.obj", V, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F1);
 
     Eigen::MatrixXi F2 = F1;
     F2.col(0).swap(F2.col(1));
@@ -64,7 +64,7 @@ TEST_CASE("OuterFacet: FullyDegnerated", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh("degenerated.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("degenerated.obj"), V, F);
 
     Eigen::VectorXi I(F.rows());
     I.setLinSpaced(F.rows(), 0, F.rows()-1);
@@ -81,7 +81,7 @@ TEST_CASE("OuterFacet: InvertedNormal", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
     F.col(0).swap(F.col(1));
 
     Eigen::VectorXi I(F.rows());
@@ -99,7 +99,7 @@ TEST_CASE("OuterFacet: SliverTet", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh("sliver_tet.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("sliver_tet.ply"), V, F);
 
     Eigen::VectorXi I(F.rows());
     I.setLinSpaced(F.rows(), 0, F.rows()-1);

+ 1 - 1
tests/include/igl/copyleft/cgal/outer_hull.cpp

@@ -7,7 +7,7 @@ TEST_CASE("OuterHull: CubeWithFold", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube_with_fold.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube_with_fold.ply"), V, F);
 
     Eigen::MatrixXi G,J,flip;
     // Is this just checking that it doesn't crash?

+ 2 - 2
tests/include/igl/copyleft/cgal/peel_outer_hull_layers.cpp

@@ -15,7 +15,7 @@ TEST_CASE("copyleft_cgal_peel_outer_hull_layers: TwoCubes", "[igl/copyleft/cgal]
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh("two-boxes-bad-self-union.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("two-boxes-bad-self-union.ply"), V, F);
     REQUIRE (V.rows() == 486);
     REQUIRE (F.rows() == 708);
 
@@ -55,7 +55,7 @@ TEST_CASE("PeelOuterHullLayers: CubeWithFold", "[igl/copyleft/cgal]")
 {
     Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> V;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube_with_fold.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube_with_fold.ply"), V, F);
 
     typedef CGAL::Exact_predicates_exact_constructions_kernel K;
     typedef K::FT Scalar;

+ 3 - 3
tests/include/igl/copyleft/cgal/points_inside_component.cpp

@@ -7,7 +7,7 @@ TEST_CASE("PointInsideComponent: simple", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V1;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("cube.obj", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
 
     Eigen::MatrixXd P(4, 3);
     P << 0.0, 0.0, 0.0,
@@ -27,7 +27,7 @@ TEST_CASE("PointInsideComponent: near_boundary", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V1;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("cube.obj", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
 
     const double EPS = std::numeric_limits<double>::epsilon();
     Eigen::MatrixXd P(6, 3);
@@ -52,7 +52,7 @@ TEST_CASE("PointInsideComponent: near_corner", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V1;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("cube.obj", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
 
     const double EPS = std::numeric_limits<double>::epsilon();
     Eigen::MatrixXd P_out(8, 3);

+ 1 - 1
tests/include/igl/copyleft/cgal/remesh_self_intersections.cpp

@@ -10,7 +10,7 @@ TEST_CASE("RemeshSelfIntersections: CubeWithFold", "[igl/copyleft/cgal]")
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube_with_fold.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube_with_fold.ply"), V, F);
 
     typedef CGAL::Exact_predicates_exact_constructions_kernel K;
     typedef Eigen::Matrix<K::FT, Eigen::Dynamic, Eigen::Dynamic> MatrixXe;

+ 3 - 3
tests/include/igl/cotmatrix.cpp

@@ -10,7 +10,7 @@ TEST_CASE("cotmatrix: constant_in_null_space", "[igl]")
     Eigen::MatrixXi F;
     Eigen::SparseMatrix<double> L;
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     igl::cotmatrix(V,F,L);
     REQUIRE (L.rows() == V.rows());
     REQUIRE (L.cols() == L.rows());
@@ -33,7 +33,7 @@ TEST_CASE("cotmatrix: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
   //Scale the cube to have huge sides
   Eigen::MatrixXd V_huge = V * 1.0e8;
@@ -109,7 +109,7 @@ TEST_CASE("cotmatrix: tetrahedron", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
   //Prepare another mesh with triangles along side diagonals of the cube
   //These triangles are form a regular tetrahedron of side sqrt(2)

+ 2 - 2
tests/include/igl/cotmatrix_entries.cpp

@@ -12,7 +12,7 @@ TEST_CASE("cotmatrix_entries: simple", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
   //Prepare another mesh with triangles along side diagonals of the cube
   //These triangles are form a regular tetrahedron of side sqrt(2)
@@ -142,7 +142,7 @@ TEST_CASE("cotmatrix_entries: intrinsic", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
   Eigen::MatrixXd Cext,Cint;
   // compute C extrinsically
   igl::cotmatrix_entries(V,F,Cext);

+ 1 - 1
tests/include/igl/cotmatrix_intrinsic.cpp

@@ -67,7 +67,7 @@ TEST_CASE("cotmatrix_intrinsic: manifold_meshes", "[igl]")
   {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     Eigen::MatrixXd l;
     igl::edge_lengths(V,F,l);
     Eigen::SparseMatrix<double> L,Li;

+ 3 - 3
tests/include/igl/cut_to_disk.cpp

@@ -108,7 +108,7 @@ TEST_CASE("cut_to_disk: torus", "[igl]")
   using namespace igl;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
-  test_common::load_mesh("TinyTorus.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("TinyTorus.obj"), V, F);
 
   std::vector<std::vector<int>> cuts;
   cut_to_disk(F, cuts);
@@ -122,7 +122,7 @@ TEST_CASE("cut_to_disk: cube", "[igl]")
   using namespace igl;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
   std::vector<std::vector<int>> cuts;
   cut_to_disk(F, cuts);
@@ -136,7 +136,7 @@ TEST_CASE("cut_to_disk: annulus", "[igl]") {
   using namespace igl;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
-  test_common::load_mesh("annulus.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("annulus.obj"), V, F);
 
   std::vector<std::vector<int>> cuts;
   cut_to_disk(F, cuts);

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

@@ -22,7 +22,7 @@ TEST_CASE("decimate: hemisphere", "[igl]")
   Eigen::MatrixXi F,G;
   Eigen::VectorXi J,I;
   // Load example mesh: GetParam() will be name of mesh file
-  test_common::load_mesh("hemisphere.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("hemisphere.obj"), V, F);
   // Perfect normals from positions
   Eigen::MatrixXd NV = V.rowwise().normalized();
   // Remove half of the faces
@@ -48,7 +48,7 @@ TEST_CASE("decimate: closed", "[igl]")
     Eigen::MatrixXi F,G;
     Eigen::VectorXi J;
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     igl::decimate(V,F,0,U,G,J);
     REQUIRE (4 == U.rows());
     REQUIRE (4 == G.rows());

+ 1 - 1
tests/include/igl/dijkstra.cpp

@@ -8,7 +8,7 @@ TEST_CASE("dijkstra: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.off", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.off"), V, F);
 
   std::vector<std::vector<int>> VV;
   igl::adjacency_list(F, VV);

+ 1 - 1
tests/include/igl/doublearea.cpp

@@ -8,7 +8,7 @@ TEST_CASE("doublearea: VF_vs_ABC", "[igl]")
     {
       Eigen::MatrixXd V;
       Eigen::MatrixXi F;
-      test_common::load_mesh(param, V, F);
+      igl::read_triangle_mesh(test_common::data_path(param), V, F);
 
       // Check that computing double area with (V,F) is the same as computing
       // double area with (V1,V2,V2)

+ 1 - 1
tests/include/igl/edge_flaps.cpp

@@ -8,7 +8,7 @@ TEST_CASE("edge_flaps: verify", "[igl]")
 	{
 	  Eigen::MatrixXd V;
 	  Eigen::MatrixXi F;
-	  test_common::load_mesh(param, V, F);
+	  igl::read_triangle_mesh(test_common::data_path(param), V, F);
 
 	  Eigen::MatrixXi efE,efEF,efEI;
 	  Eigen::VectorXi efEMAP;

+ 1 - 1
tests/include/igl/edge_lengths.cpp

@@ -9,7 +9,7 @@ TEST_CASE("edge_lengths: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
   //Create scaled versions of the cube
   double scale = 1.0;
   double huge_scale = 1.0e8;

+ 1 - 1
tests/include/igl/embree/EmbreeIntersector.cpp

@@ -9,7 +9,7 @@ TEST_CASE("EmbreeIntersector: cube", "[igl/embree]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   // This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
   // Initialize embree
   igl::embree::EmbreeIntersector embree;

+ 1 - 1
tests/include/igl/intrinsic_delaunay_cotmatrix.cpp

@@ -43,7 +43,7 @@ TEST_CASE("intrinsic_delaunay_cotmatrix: manifold_meshes", "[igl]")
   {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     Eigen::SparseMatrix<double> L;
     Eigen::MatrixXi F_intrinsic;
     Eigen::MatrixXd l_intrinsic;

+ 2 - 2
tests/include/igl/is_edge_manifold.cpp

@@ -8,7 +8,7 @@ TEST_CASE("is_edge_manifold: positive", "[igl]")
   {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     REQUIRE ( igl::is_edge_manifold(F) );
   };
 
@@ -20,6 +20,6 @@ TEST_CASE("is_edge_manifold: negative", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   // Known non-manifold mesh
-  test_common::load_mesh("truck.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("truck.obj"), V, F);
   REQUIRE (! igl::is_edge_manifold(F) );
 }

+ 1 - 1
tests/include/igl/is_irregular_vertex.cpp

@@ -7,7 +7,7 @@ TEST_CASE("is_irregular_vertex: simple", "[igl]")
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     // Known "bad" mesh (many boundaries + irregular vertices, non-manifold)
-    test_common::load_mesh("truck.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("truck.obj"), V, F);
     std::vector<bool> vec = igl::is_irregular_vertex(V,F);
     // some vertices are irregular thus the sum over all vertices should evaluate to true
     REQUIRE(std::any_of(vec.begin(),vec.end(), [](bool v) { return v; }));

+ 1 - 1
tests/include/igl/iterative_closest_point.cpp

@@ -16,7 +16,7 @@ TEST_CASE("iterative_closest_point: identity","[igl]")
     Eigen::MatrixXd VX,VY;
     Eigen::MatrixXi FX,FY;
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, VY, FY);
+    igl::read_triangle_mesh(test_common::data_path(param), VY, FY);
     VX = VY;
     FX = FY;
     // Single iteration should find a identity

+ 1 - 1
tests/include/igl/per_face_normals.cpp

@@ -10,7 +10,7 @@ TEST_CASE("per_face_normals: dot", "[igl]")
 	  Eigen::MatrixXd V,N;
 	  Eigen::MatrixXi F;
 	  // Load example mesh: GetParam() will be name of mesh file
-	  test_common::load_mesh(param, V, F);
+	  igl::read_triangle_mesh(test_common::data_path(param), V, F);
 	  igl::per_face_normals(V,F,N);
 	  REQUIRE (N.rows() == F.rows());
 	  for(int f = 0;f<N.rows();f++)

+ 2 - 2
tests/include/igl/readDMAT.cpp

@@ -3,8 +3,8 @@
 TEST_CASE("readDMAT: Comp", "[igl]")
 {
     Eigen::MatrixXd N1, N2;
-    test_common::load_matrix("duplicated_faces_N1.dmat", N1);
-    test_common::load_matrix("duplicated_faces_N2.dmat", N2);
+    igl::readDMAT(test_common::data_path("duplicated_faces_N1.dmat"), N1);
+    igl::readDMAT(test_common::data_path("duplicated_faces_N2.dmat"), N2);
 
     REQUIRE (N2.rows() == N1.rows());
     REQUIRE (N2.cols() == N1.cols());

+ 4 - 2
tests/include/igl/readOBJ.cpp

@@ -1,3 +1,4 @@
+#include <igl/readOBJ.h>
 #include <test_common.h>
 #include <iostream>
 #include <string>
@@ -9,7 +10,7 @@ TEST_CASE("readOBJ: simple", "[igl]")
     Eigen::MatrixXi F;
     // wait... so this is actually testing test_common::load_mesh not readOBJ
     // directly...
-    test_common::load_mesh("cube.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
     REQUIRE (V.rows() == 8);
     REQUIRE (F.rows() == 12);
 }
@@ -23,7 +24,8 @@ TEST_CASE("readOBJ: Obj with material", "[igl]")
     std::vector<std::vector<int > > FTC;
     std::vector<std::vector<int > >  FN;
     std::vector<std::tuple<std::string, int, int>> FM;
-    test_common::load_obj_with_material<double, int>("cubewithmaterial.obj", V, TC, N, F, FTC, FN, FM);
+    igl::readOBJ(test_common::data_path("cubewithmaterial.obj"), V, TC, N, F, FTC, FN, FM);
+
     REQUIRE (V.size() == 8);
     REQUIRE (F.size() == 6);
     for ( const auto& i : FM ) {

+ 1 - 1
tests/include/igl/readOFF.cpp

@@ -6,7 +6,7 @@ TEST_CASE("readOFF: simple", "[igl]")
     Eigen::MatrixXi F;
     // wait... so this is actually testing test_common::load_mesh not readOFF
     // directly...
-    test_common::load_mesh("cube.off", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube.off"), V, F);
     REQUIRE (V.rows() == 8);
     REQUIRE (V.cols() == 3);
     REQUIRE (F.rows() == 12);

+ 1 - 1
tests/include/igl/squared_edge_lengths.cpp

@@ -10,7 +10,7 @@ TEST_CASE("squared_edge_lengths: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
   //Create scaled versions of the cube
   double scale = 1.0;
   double huge_scale = 1.0e8;

+ 1 - 1
tests/include/igl/triangle_triangle_adjacency.cpp

@@ -11,7 +11,7 @@ TEST_CASE("triangle_triangle_adjacency: dot", "[igl]")
     Eigen::MatrixXd V;
     Eigen::MatrixXi F,TT,TTi;
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     igl::triangle_triangle_adjacency(F,TT,TTi);
     REQUIRE (TT.rows() == F.rows());
     REQUIRE (TTi.rows() == F.rows());

+ 1 - 1
tests/include/igl/upsample.cpp

@@ -34,7 +34,7 @@ TEST_CASE("upsample: V_comes_first_F_ordering", "[igl]")
     Eigen::MatrixXd V,NV;
     Eigen::MatrixXi F,NF;
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     igl::upsample(V,F,NV,NF);
     REQUIRE (V.rows() <= NV.rows());
     REQUIRE (4*F.rows() == NF.rows());

+ 17 - 43
tests/test_common.h

@@ -1,10 +1,12 @@
 #pragma once
 
 
+// These are not directly used but would otherwise be included in most files.
+// Leaving them included here. 
 #include <igl/read_triangle_mesh.h>
-#include <igl/find.h>
 #include <igl/readDMAT.h>
-#include <igl/readOBJ.h>
+
+#include <igl/find.h>
 
 #include <Eigen/Core>
 #include <catch2/catch.hpp>
@@ -21,7 +23,20 @@ namespace test_common
   void run_test_cases(const std::vector<Param> &params,  Fun test_case)
   {
     for(const auto &p : params)
+    {
+      // Can't use INFO( p ) because we're not sure how to print p
       test_case(p);
+    }
+  }
+
+  template<typename Fun>
+  void run_test_cases(const std::vector<std::string> &params,  Fun test_case)
+  {
+    for(const auto &p : params)
+    {
+      INFO( p );
+      test_case(p);
+    }
   }
 
   inline std::vector<std::string> closed_genus_0_meshes()
@@ -75,47 +90,6 @@ namespace test_common
     return std::string(LIBIGL_DATA_DIR) + "/" + s;
   };
 
-  // TODO: this seems like a pointless indirection. Should just find and
-  // replace test_common::load_mesh(X,...) with
-  // igl::read_triangle_mesh(test_common::data_path(X),...)
-  template<typename DerivedV, typename DerivedF>
-  void load_mesh(
-    const std::string& filename,
-    Eigen::PlainObjectBase<DerivedV>& V,
-    Eigen::PlainObjectBase<DerivedF>& F)
-  {
-    igl::read_triangle_mesh(data_path(filename), V, F);
-  }
-
-  template<typename DerivedV, typename DerivedF>
-  void load_obj_with_material(
-    const std::string& filename,
-    std::vector<std::vector<DerivedV >> & V,
-    std::vector<std::vector<DerivedV >> & TC,
-    std::vector<std::vector<DerivedV >> & N,
-    std::vector<std::vector<DerivedF >> & F,
-    std::vector<std::vector<DerivedF >> & FTC,
-    std::vector<std::vector<DerivedF >> & FN,
-    std::vector<std::tuple<std::string, DerivedF, DerivedF >> &FM)
-  {
-    igl::readOBJ(data_path(filename), V, TC, N, F, FTC, FN, FM);
-  }
-
-
-
-
-
-  // TODO: this seems like a pointless indirection. Should just find and
-  // replace test_common::load_matrix(X,...) with
-  // igl::readDMAT(test_common::data_path(X),...)
-  template<typename Derived>
-  void load_matrix(
-    const std::string& filename,
-    Eigen::PlainObjectBase<Derived>& M)
-  {
-    igl::readDMAT(data_path(filename), M);
-  }
-
   template <typename DerivedA, typename DerivedB>
   void assert_eq(
     const Eigen::MatrixBase<DerivedA> & A,