Переглянути джерело

PlainObject -> MatrixBase (#2425)

* PlainObject -> MatrixBase

* template igl::Hit

* vector input intersect rays with multiple hits

* initialize

* initialize

* only write if hit

* fix templates

* template me baby

* templates

* my god. so many PlainObject -> Matrix; Derived -> PlainMatrix<Derived>

* Options doesn't exist for Maps/Refs

* templates; windows size_t shinanigans

* Derived->PlainMatrix

* windows template

* derived -> plainvector

* options

* fix templating

* std types

* fix windingnumbertree tempalting

* further fix windingnumbertree tempalting

* Xi->XI

* templating

* clean up and template some of the decimation code; eventually gave up on templating outer functions

* rm needless cast

* attempt to fix index templating in boolean code

* remove debugging casts

* more templatin hell

* debug kruft

* vector resize

* assert

* int -> template

* int -> template

* int -> template

* templating away more Xi

* templating away more 3i

* formatting

* vector

* plainmatrix

* plainmatrix

* bug

* templating MSH io

* remove use of Map

* zero default tags

* bug fix

* file debug flags

* __1::

* better typing

* knn tempalte

* note

* templating

* reorder scaf inputs

* fix build

* doc

* templates

* messier than I thought

* doc

* Xi -> XI

* use templated type

* 1x1 is always symmetric

* use index type

* split intrinsic

* templating

* template internal
Alec Jacobson 11 місяців тому
батько
коміт
7472691fe6
100 змінених файлів з 1394 додано та 1042 видалено
  1. 78 13
      include/igl/AABB.cpp
  2. 43 5
      include/igl/AABB.h
  3. 3 3
      include/igl/Hit.h
  4. 95 0
      include/igl/PlainMatrix.h
  5. 36 0
      include/igl/PlainVector.h
  6. 84 85
      include/igl/WindingNumberAABB.h
  7. 100 127
      include/igl/WindingNumberTree.h
  8. 16 15
      include/igl/active_set.cpp
  9. 7 7
      include/igl/active_set.h
  10. 30 24
      include/igl/ambient_occlusion.cpp
  11. 2 2
      include/igl/ambient_occlusion.h
  12. 3 3
      include/igl/arap_rhs.cpp
  13. 1 0
      include/igl/barycenter.cpp
  14. 5 5
      include/igl/bbw.cpp
  15. 4 4
      include/igl/bbw.h
  16. 2 1
      include/igl/bezier.cpp
  17. 1 1
      include/igl/biharmonic_coordinates.cpp
  18. 24 9
      include/igl/boundary_conditions.cpp
  19. 19 9
      include/igl/boundary_conditions.h
  20. 2 2
      include/igl/ceil.cpp
  21. 1 1
      include/igl/ceil.h
  22. 23 13
      include/igl/circulation.cpp
  23. 16 13
      include/igl/circulation.h
  24. 61 83
      include/igl/collapse_edge.cpp
  25. 58 65
      include/igl/collapse_edge.h
  26. 21 8
      include/igl/collapse_edge_would_create_intersections.cpp
  27. 17 8
      include/igl/collapse_edge_would_create_intersections.h
  28. 12 3
      include/igl/collapse_small_triangles.cpp
  29. 7 3
      include/igl/collapse_small_triangles.h
  30. 5 5
      include/igl/columnize.cpp
  31. 1 1
      include/igl/columnize.h
  32. 4 3
      include/igl/comb_cross_field.cpp
  33. 11 9
      include/igl/comb_frame_field.cpp
  34. 4 3
      include/igl/comb_line_field.cpp
  35. 2 1
      include/igl/compute_frame_field_bisectors.cpp
  36. 7 7
      include/igl/copyleft/cgal/BinaryWindingNumberOperations.h
  37. 1 1
      include/igl/copyleft/cgal/CSGTree.h
  38. 2 6
      include/igl/copyleft/cgal/cell_adjacency.cpp
  39. 1 1
      include/igl/copyleft/cgal/cell_adjacency.h
  40. 55 33
      include/igl/copyleft/cgal/closest_facet.cpp
  41. 27 27
      include/igl/copyleft/cgal/closest_facet.h
  42. 12 12
      include/igl/copyleft/cgal/component_inside_component.cpp
  43. 10 10
      include/igl/copyleft/cgal/component_inside_component.h
  44. 32 24
      include/igl/copyleft/cgal/extract_cells.cpp
  45. 9 9
      include/igl/copyleft/cgal/extract_cells.h
  46. 10 8
      include/igl/copyleft/cgal/extract_cells_single_component.cpp
  47. 6 6
      include/igl/copyleft/cgal/extract_cells_single_component.h
  48. 5 5
      include/igl/copyleft/cgal/extract_feature.cpp
  49. 5 5
      include/igl/copyleft/cgal/extract_feature.h
  50. 13 13
      include/igl/copyleft/cgal/half_space_box.cpp
  51. 6 6
      include/igl/copyleft/cgal/half_space_box.h
  52. 45 20
      include/igl/copyleft/cgal/intersect_other.cpp
  53. 15 9
      include/igl/copyleft/cgal/intersect_other.h
  54. 1 1
      include/igl/copyleft/cgal/intersect_with_half_space.cpp
  55. 3 3
      include/igl/copyleft/cgal/is_self_intersecting.cpp
  56. 2 2
      include/igl/copyleft/cgal/is_self_intersecting.h
  57. 1 1
      include/igl/copyleft/cgal/lexicographic_triangulation.cpp
  58. 1 1
      include/igl/copyleft/cgal/lexicographic_triangulation.h
  59. 7 5
      include/igl/copyleft/cgal/mesh_boolean.cpp
  60. 26 21
      include/igl/copyleft/cgal/order_facets_around_edge.cpp
  61. 6 5
      include/igl/copyleft/cgal/order_facets_around_edge.h
  62. 17 17
      include/igl/copyleft/cgal/order_facets_around_edges.cpp
  63. 11 11
      include/igl/copyleft/cgal/order_facets_around_edges.h
  64. 16 15
      include/igl/copyleft/cgal/outer_edge.cpp
  65. 3 3
      include/igl/copyleft/cgal/outer_edge.h
  66. 18 17
      include/igl/copyleft/cgal/outer_facet.cpp
  67. 7 7
      include/igl/copyleft/cgal/outer_facet.h
  68. 3 3
      include/igl/copyleft/cgal/outer_hull.cpp
  69. 2 2
      include/igl/copyleft/cgal/outer_hull.h
  70. 14 13
      include/igl/copyleft/cgal/outer_hull_legacy.cpp
  71. 2 2
      include/igl/copyleft/cgal/outer_hull_legacy.h
  72. 13 13
      include/igl/copyleft/cgal/outer_vertex.cpp
  73. 3 3
      include/igl/copyleft/cgal/outer_vertex.h
  74. 3 3
      include/igl/copyleft/cgal/peel_outer_hull_layers.cpp
  75. 2 2
      include/igl/copyleft/cgal/peel_outer_hull_layers.h
  76. 2 2
      include/igl/copyleft/cgal/peel_winding_number_layers.cpp
  77. 2 2
      include/igl/copyleft/cgal/peel_winding_number_layers.h
  78. 3 3
      include/igl/copyleft/cgal/piecewise_constant_winding_number.cpp
  79. 2 2
      include/igl/copyleft/cgal/piecewise_constant_winding_number.h
  80. 13 11
      include/igl/copyleft/cgal/point_mesh_squared_distance.cpp
  81. 6 6
      include/igl/copyleft/cgal/point_mesh_squared_distance.h
  82. 7 6
      include/igl/copyleft/cgal/point_solid_signed_squared_distance.cpp
  83. 3 3
      include/igl/copyleft/cgal/point_solid_signed_squared_distance.h
  84. 45 38
      include/igl/copyleft/cgal/points_inside_component.cpp
  85. 7 7
      include/igl/copyleft/cgal/points_inside_component.h
  86. 33 26
      include/igl/copyleft/cgal/propagate_winding_numbers.cpp
  87. 11 11
      include/igl/copyleft/cgal/propagate_winding_numbers.h
  88. 6 5
      include/igl/copyleft/cgal/relabel_small_immersed_cells.cpp
  89. 4 4
      include/igl/copyleft/cgal/relabel_small_immersed_cells.h
  90. 3 3
      include/igl/copyleft/cgal/resolve_intersections.cpp
  91. 2 2
      include/igl/copyleft/cgal/resolve_intersections.h
  92. 2 2
      include/igl/copyleft/cgal/row_to_point.cpp
  93. 1 1
      include/igl/copyleft/cgal/row_to_point.h
  94. 1 1
      include/igl/copyleft/cgal/signed_distance_isosurface.cpp
  95. 3 3
      include/igl/copyleft/cgal/snap_rounding.cpp
  96. 2 2
      include/igl/copyleft/cgal/snap_rounding.h
  97. 4 4
      include/igl/copyleft/cgal/subdivide_segments.cpp
  98. 2 2
      include/igl/copyleft/cgal/subdivide_segments.h
  99. 7 7
      include/igl/copyleft/cgal/submesh_aabb_tree.cpp
  100. 3 3
      include/igl/copyleft/cgal/submesh_aabb_tree.h

+ 78 - 13
include/igl/AABB.cpp

@@ -1470,7 +1470,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
   const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & dir,
-  std::vector<igl::Hit> & hits) const
+  std::vector<igl::Hit<typename DerivedV::Scalar>> & hits) const
 {
   RowVectorDIMS inv_dir = dir.cwiseInverse();
   RowVectorDIMS inv_dir_pad = inv_dir;
@@ -1486,7 +1486,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
   const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & dir,
-  igl::Hit & hit) const
+  igl::Hit<typename DerivedV::Scalar> & hit) const
 {
 #if false
   // BFS
@@ -1513,7 +1513,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
     {
       // Actually process elements
       assert((Ele.size() == 0 || Ele.cols() == 3) && "Elements should be triangles");
-      igl::Hit leaf_hit;
+      igl::Hit<typename DerivedV::Scalar> leaf_hit;
       if(
         ray_mesh_intersect(origin,dir,V,Ele.row(tree->m_primitive),leaf_hit)&&
         leaf_hit.t < hit.t)
@@ -1545,7 +1545,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
   const RowVectorDIMS & origin,
   const RowVectorDIMS & dir,
   const Scalar _min_t,
-  igl::Hit & hit) const
+  igl::Hit<typename DerivedV::Scalar> & hit) const
 {
   RowVectorDIMS inv_dir = dir.cwiseInverse();
   RowVectorDIMS inv_dir_pad = inv_dir;
@@ -1553,6 +1553,68 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
   return intersect_ray_opt(V, Ele, origin, dir, inv_dir, inv_dir_pad, _min_t, hit);
 }
 
+
+template <typename DerivedV, int DIM>
+template <
+  typename DerivedEle,
+  typename DerivedOrigin,
+  typename DerivedDir,
+  typename DerivedI,
+  typename DerivedT,
+  typename DerivedUV>
+IGL_INLINE void igl::AABB<DerivedV,DIM>::intersect_ray(
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedOrigin> & origin,
+  const Eigen::MatrixBase<DerivedDir> & dir,
+  const Scalar min_t,
+  Eigen::PlainObjectBase<DerivedI> & I,
+  Eigen::PlainObjectBase<DerivedT> & T,
+  Eigen::PlainObjectBase<DerivedUV> & UV)
+{
+  assert(origin.rows() == dir.rows());
+  I.setConstant(origin.rows(),1,-1);
+  T.setConstant(origin.rows(),1,std::numeric_limits<Scalar>::quiet_NaN());
+  UV.resize(origin.rows(),2);
+
+  igl::parallel_for(origin.rows(),[&](int i)
+  {
+    RowVectorDIMS origin_i = origin.row(i);
+    RowVectorDIMS dir_i = dir.row(i);
+    igl::Hit<typename DerivedV::Scalar> hit_i;
+    if(intersect_ray(V,Ele,origin_i,dir_i,min_t,hit_i))
+    {
+      I(i) = hit_i.id;
+      UV.row(i) << hit_i.u, hit_i.v;
+      T(i) = hit_i.t;
+    }
+  },
+  10000);
+}
+
+template <typename DerivedV, int DIM>
+template <
+  typename DerivedEle,
+  typename DerivedOrigin,
+  typename DerivedDir>
+IGL_INLINE void igl::AABB<DerivedV,DIM>::intersect_ray(
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedOrigin> & origin,
+  const Eigen::MatrixBase<DerivedDir> & dir,
+  std::vector<std::vector<igl::Hit<typename DerivedV::Scalar>>> & hits)
+{
+  assert(origin.rows() == dir.rows());
+  hits.resize(origin.rows());
+  igl::parallel_for(origin.rows(),[&](int i)
+  {
+    RowVectorDIMS origin_i = origin.row(i);
+    RowVectorDIMS dir_i = dir.row(i);
+    this->intersect_ray(V,Ele,origin_i,dir_i,hits[i]);
+  },
+  10000);
+}
+
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 IGL_INLINE bool
@@ -1563,7 +1625,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray_opt(
   const RowVectorDIMS & dir,
   const RowVectorDIMS & inv_dir,
   const RowVectorDIMS & inv_dir_pad,
-  std::vector<igl::Hit> & hits) const
+  std::vector<igl::Hit<typename DerivedV::Scalar>> & hits) const
 {
   hits.clear();
   const Scalar t0 = 0;
@@ -1571,6 +1633,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray_opt(
   {
     Scalar _1,_2;
 
+
     if(!ray_box_intersect(origin,inv_dir,inv_dir_pad,m_box,t0,t1,_1,_2))
     {
       return false;
@@ -1590,8 +1653,8 @@ igl::AABB<DerivedV,DIM>::intersect_ray_opt(
     }
     return ret;
   }
-  std::vector<igl::Hit> left_hits;
-  std::vector<igl::Hit> right_hits;
+  std::vector<igl::Hit<typename DerivedV::Scalar>> left_hits;
+  std::vector<igl::Hit<typename DerivedV::Scalar>> right_hits;
   const bool left_ret = m_left->intersect_ray_opt(V,Ele,origin,dir,inv_dir,inv_dir_pad,left_hits);
   const bool right_ret = m_right->intersect_ray_opt(V,Ele,origin,dir,inv_dir,inv_dir_pad,right_hits);
   hits.insert(hits.end(),left_hits.begin(),left_hits.end());
@@ -1610,7 +1673,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray_opt(
   const RowVectorDIMS & inv_dir,
   const RowVectorDIMS & inv_dir_pad,
   const Scalar _min_t,
-  igl::Hit & hit) const
+  igl::Hit<typename DerivedV::Scalar> & hit) const
 {
   Scalar min_t = _min_t;
   const Scalar t0 = 0;
@@ -1633,8 +1696,8 @@ igl::AABB<DerivedV,DIM>::intersect_ray_opt(
 
   // Doesn't seem like smartly choosing left before/after right makes a
   // differnce
-  igl::Hit left_hit;
-  igl::Hit right_hit;
+  igl::Hit<typename DerivedV::Scalar> left_hit;
+  igl::Hit<typename DerivedV::Scalar> right_hit;
   bool left_ret = m_left->intersect_ray_opt(V,Ele,origin,dir,inv_dir,inv_dir_pad,min_t,left_hit);
   if(left_ret && left_hit.t<min_t)
   {
@@ -1663,7 +1726,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray_opt(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 // generated by autoexplicit.sh
-template bool igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, std::vector<igl::Hit, std::allocator<igl::Hit> >&) const;
+template bool igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, std::vector<igl::Hit<double>, std::allocator<igl::Hit<double>> >&) const;
 
 template class igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>;
 template class igl::AABB<Eigen::Matrix<double, -1, 3, 0, -1, 3>, 3>;
@@ -1681,14 +1744,14 @@ template void igl::AABB<Eigen::Matrix<double, -1, 3, 0, -1, 3>, 3>::init<Eigen::
 // generated by autoexplicit.sh
 template void igl::AABB<Eigen::Matrix<double, -1, 2, 0, -1, 2>, 2>::init<Eigen::Matrix<int, -1, 2, 0, -1, 2> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&);
 // generated by autoexplicit.sh
-template bool igl::AABB<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<float, 1, 3, 1, 1, 3> const&, Eigen::Matrix<float, 1, 3, 1, 1, 3> const&, std::vector<igl::Hit, std::allocator<igl::Hit> >&) const;
+template bool igl::AABB<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<float, 1, 3, 1, 1, 3> const&, Eigen::Matrix<float, 1, 3, 1, 1, 3> const&, std::vector<igl::Hit<float>, std::allocator<igl::Hit<float>> >&) const;
 // generated by autoexplicit.sh
 template void igl::AABB<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 3>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
 // generated by autoexplicit.sh
 template void igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&) const;
 // generated by autoexplicit.sh
 template void igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
-template bool igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, igl::Hit&) const;
+template bool igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, igl::Hit<double>&) const;
 template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 2, 1, 1, 2> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 2, 1, 1, 2> >&) const;
 template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, double, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
 template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
@@ -1724,6 +1787,8 @@ template void igl::AABB<Eigen::Matrix<float, -1, 3, 0, -1, 3>, 3>::init<Eigen::M
 template void igl::AABB<Eigen::Matrix<float, -1, 3, 1, -1, 3>, 3>::init<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&);
 template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
 template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<double, 1, 2, 1, 1, 2> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 2, 1, 1, 2> >&) const;
+template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -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::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, double, Eigen::PlainObjectBase<Eigen::Matrix<int, -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::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, std::vector<std::vector<igl::Hit<double>, std::allocator<igl::Hit<double>>>, std::allocator<std::vector<igl::Hit<double>, std::allocator<igl::Hit<double>>>>>&);
 #ifdef WIN32
 template void igl::AABB<class Eigen::Matrix<double,-1,-1,0,-1,-1>,3>::squared_distance<class Eigen::Matrix<int,-1,-1,0,-1,-1>,class Eigen::Matrix<double,-1,-1,0,-1,-1>,class Eigen::Matrix<double,-1,1,0,-1,1>,class Eigen::Matrix<__int64,-1,1,0,-1,1>,class Eigen::Matrix<double,-1,3,0,-1,3> >(class Eigen::MatrixBase<class Eigen::Matrix<double,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<double,-1,-1,0,-1,-1> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<double,-1,1,0,-1,1> > &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &,class Eigen::PlainObjectBase<class Eigen::Matrix<double,-1,3,0,-1,3> > &)const;
 #endif

+ 43 - 5
include/igl/AABB.h

@@ -632,7 +632,7 @@ public:
         const Eigen::MatrixBase<DerivedEle> & Ele, 
         const RowVectorDIMS & origin,
         const RowVectorDIMS & dir,
-        std::vector<igl::Hit> & hits) const;
+        std::vector<igl::Hit<typename DerivedV::Scalar>> & hits) const;
       /// Intersect a ray with the mesh return first hit
       ///
       /// @param[in]  V  #V by dim list of vertex positions
@@ -647,7 +647,8 @@ public:
         const Eigen::MatrixBase<DerivedEle> & Ele, 
         const RowVectorDIMS & origin,
         const RowVectorDIMS & dir,
-        igl::Hit & hit) const;
+        igl::Hit<typename DerivedV::Scalar> & hit) const;
+
       /// Intersect a ray with the mesh return first hit farther than `min_t`
       ///
       /// @param[in]  V  #V by dim list of vertex positions
@@ -664,7 +665,44 @@ public:
         const RowVectorDIMS & origin,
         const RowVectorDIMS & dir,
         const Scalar min_t,
-        igl::Hit & hit) const;
+        igl::Hit<typename DerivedV::Scalar> & hit) const;
+      /// Intersect a rays with the mesh return first hit for each
+      ///
+      /// @param[in]  V  #V by dim list of vertex positions
+      /// @param[in]  Ele  #Ele by dim list of simplex indices
+      /// @param[in]  origin #ray by dim+1 list of ray origins 
+      /// @param[in]  dir #ray by dim list of ray directions
+      /// @param[in]  min_t  minimum t value to consider
+      /// @param[out]  I #ray list of indices into Ele of closest primitives
+      ///   (-1 indicates no hit)
+      /// @param[out]  T #ray list of t values (nan indicates no hit)
+      /// @param[out]  UV #ray by dim list of barycentric coordinates
+      template <
+        typename DerivedEle,
+        typename DerivedOrigin,
+        typename DerivedDir,
+        typename DerivedI,
+        typename DerivedT,
+        typename DerivedUV>
+      IGL_INLINE void intersect_ray(
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedEle> & Ele, 
+        const Eigen::MatrixBase<DerivedOrigin> & origin,
+        const Eigen::MatrixBase<DerivedDir> & dir,
+        const Scalar min_t,
+        Eigen::PlainObjectBase<DerivedI> & I,
+        Eigen::PlainObjectBase<DerivedT> & T,
+        Eigen::PlainObjectBase<DerivedUV> & UV);
+      template <
+        typename DerivedEle,
+        typename DerivedOrigin,
+        typename DerivedDir>
+      IGL_INLINE void intersect_ray(
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedEle> & Ele, 
+        const Eigen::MatrixBase<DerivedOrigin> & origin,
+        const Eigen::MatrixBase<DerivedDir> & dir,
+        std::vector<std::vector<igl::Hit<typename DerivedV::Scalar>>> & hits);
       /// Compute the squared distance from all query points in P to the
       /// _closest_ points on the primitives stored in the AABB hierarchy for
       /// the mesh (V,Ele).
@@ -784,7 +822,7 @@ private:
         const RowVectorDIMS & dir,
         const RowVectorDIMS & inv_dir,
         const RowVectorDIMS & inv_dir_pad,
-        std::vector<igl::Hit> & hits) const;
+        std::vector<igl::Hit<typename DerivedV::Scalar>> & hits) const;
       /// Intersect a ray with the mesh return first hit farther than `min_t`
       ///
       /// @param[in]  V  #V by dim list of vertex positions
@@ -803,7 +841,7 @@ private:
         const RowVectorDIMS & inv_dir,
         const RowVectorDIMS & inv_dir_pad,
         const Scalar min_t,
-        igl::Hit & hit) const;
+        igl::Hit<typename DerivedV::Scalar> & hit) const;
 public:
       EIGEN_MAKE_ALIGNED_OPERATOR_NEW
     };

+ 3 - 3
include/igl/Hit.h

@@ -13,7 +13,7 @@ namespace igl
 {
   /// Reimplementation of the embree::Hit struct from embree1.0
   /// 
-  // TODO: template on floating point type
+  template <typename Scalar>
   struct Hit
   {
     /// primitive id
@@ -22,10 +22,10 @@ namespace igl
     int gid; 
     /// barycentric coordinates so that 
     ///   pos = V.row(F(id,0))*(1-u-v)+V.row(F(id,1))*u+V.row(F(id,2))*v;
-    float u,v; 
+    Scalar u,v; 
     /// parametric distance so that
     ///   pos = origin + t * dir
-    float t; 
+    Scalar t; 
   };
 }
 #endif 

+ 95 - 0
include/igl/PlainMatrix.h

@@ -0,0 +1,95 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2024 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_PLAINMATRIX_H
+#define IGL_PLAINMATRIX_H
+#include <Eigen/Core>
+
+#include <type_traits>
+#include <Eigen/Dense>
+
+// Define void_t for compatibility if it's not in the standard library (C++11 and later)
+#if __cplusplus < 201703L
+namespace std {
+  template <typename... Ts>
+  using void_t = void;
+}
+#endif
+
+
+#ifndef IGL_DEFAULT_MAJORING
+#define IGL_DEFAULT_MAJORING Eigen::ColMajor
+#endif
+
+namespace igl
+{
+  template <typename Derived, int Rows, int Cols, int Options>
+  struct PlainMatrixHelper {
+    using Type = Eigen::Matrix<typename Derived::Scalar,Rows,Cols,((Rows == 1 && Cols != 1) ? Eigen::RowMajor : ((Cols == 1 && Rows != 1) ? Eigen::ColMajor : Options))>;
+  };
+  template <typename Derived, typename = void>
+  struct get_options {
+    static constexpr int value = IGL_DEFAULT_MAJORING;
+  };
+  
+  template <typename Derived>
+  struct get_options<Derived, std::void_t<decltype(Derived::Options)>> {
+    static constexpr int value = Derived::Options;
+  };
+  /// Some libigl implementations would (still do?) use a pattern like:
+  ///
+  /// template <typename DerivedA>
+  /// void foo(const Eigen::MatrixBase<DerivedA>& A)
+  /// {
+  ///    DerivedA B;
+  ///    igl::unique_rows(A,true,B);
+  /// }
+  ///
+  /// If `DerivedA` is `Eigen::Matrix`, then this may compile, but `DerivedA` might be
+  /// from a Eigen::Map or Eigen::Ref and fail to compile due to missing
+  /// construtor.
+  ///
+  /// Even worse, the code above will work if `DerivedA` has dynamic rows, but will
+  /// throw a runtime error if `DerivedA` has fixed number of rows.
+  ///
+  /// Instead it's better to declare `B` as a `Eigen::Matrix`
+  ///
+  /// Eigen::Matrix<typename DerivedA::Scalar,Eigen::Dynamic,DerivedA::ColsAtCompileTime,DerivedA::Options> B;
+  ///
+  /// Using `Eigen::Dynamic` for dimensions that may not be known at compile
+  /// time (or may be different from A).
+  ///
+  /// `igl::PlainMatrix` is just a helper to make this easier. So in this case
+  /// we could write:
+  ///
+  /// igl::PlainMatrix<DerivedA,Eigen::Dynamic> B;
+  ///
+  /// IIUC, if the code in question looks like:
+  ///
+  /// template <typename DerivedC>
+  /// void foo(Eigen::PlainObjectBase<DerivedC>& C)
+  /// {
+  ///    DerivedC B;
+  ///    …
+  ///    C.resize(not_known_at_compile_time,also_not_known_at_compile_time);
+  /// }
+  ///
+  /// Then it's probably fine. If C can be resized to different sizes, then
+  /// `DerivedC` should be `Eigen::Matrix`-like .
+  // Helper to check if `Options` exists in Derived
+
+  // Modify PlainMatrix to use get_options
+  template <typename Derived, 
+            int Rows = Derived::RowsAtCompileTime, 
+            int Cols = Derived::ColsAtCompileTime, 
+            int Options = get_options<Derived>::value>
+  using PlainMatrix = typename PlainMatrixHelper<Derived, Rows, Cols, Options>::Type;
+
+}
+
+#endif

+ 36 - 0
include/igl/PlainVector.h

@@ -0,0 +1,36 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2024 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_PLAINVECTOR_H
+#define IGL_PLAINVECTOR_H
+#include <Eigen/Core>
+#include "PlainMatrix.h"
+
+namespace igl
+{
+  // PlainVectorHelper to determine correct matrix type based on Derived and Size
+  template <typename Derived, int Size, int Options>
+    struct PlainVectorHelper {
+      // Conditional Type: Column vector if is_column_vector is true, otherwise row vector
+      using Type = Eigen::Matrix<
+        typename Derived::Scalar,
+        (Derived::ColsAtCompileTime == 1 && Derived::RowsAtCompileTime != 1) ? Size : 1,
+        (Derived::ColsAtCompileTime == 1 && Derived::RowsAtCompileTime != 1) ? 1 : Size,
+        Options>;
+    };
+
+  /// \see PlainMatrix
+  template <
+    typename Derived, 
+    int Size = (Derived::ColsAtCompileTime == 1 && Derived::RowsAtCompileTime != 1) ? Derived::RowsAtCompileTime : Derived::ColsAtCompileTime,
+    int Options = get_options<Derived>::value>
+  using PlainVector = typename PlainVectorHelper<Derived, Size, Options>::Type;
+
+}
+#endif
+

+ 84 - 85
include/igl/WindingNumberAABB.h

@@ -13,21 +13,24 @@
 #ifndef IGL_WINDINGNUMBERAABB_H
 #define IGL_WINDINGNUMBERAABB_H
 #include "WindingNumberTree.h"
+#include "PlainMatrix.h"
 
 namespace igl
 {
   /// Class for building an AABB tree to implement the divide and conquer
   /// algorithm described in [Jacobson et al. 2013]. 
   template <
-    typename Point,
-    typename DerivedV, 
-    typename DerivedF >
-  class WindingNumberAABB : public WindingNumberTree<Point,DerivedV,DerivedF>
+    typename Scalar, 
+    typename Index>
+  class WindingNumberAABB : public WindingNumberTree<Scalar,Index>
   {
     protected:
+      // WindingNumberTree defines Point
+      using Point = typename WindingNumberTree<Scalar,Index>::Point;
+      using MatrixXF = typename WindingNumberTree<Scalar,Index>::MatrixXF;
       Point min_corner;
       Point max_corner;
-      typename DerivedV::Scalar total_positive_area;
+      Scalar total_positive_area;
     public: 
       enum SplitMethod
       {
@@ -37,23 +40,25 @@ namespace igl
       } split_method;
     public:
       inline WindingNumberAABB():
-        total_positive_area(std::numeric_limits<typename DerivedV::Scalar>::infinity()),
+        total_positive_area(std::numeric_limits<Scalar>::infinity()),
         split_method(MEDIAN_ON_LONGEST_AXIS)
       {}
       /// Constructor
       ///
       /// @param[in] V  #V by 3 list of vertex positions
       /// @param[in] F  #F by 3 list of triangle indices into V
+      template <typename DerivedV, typename DerivedF>
       inline WindingNumberAABB(
         const Eigen::MatrixBase<DerivedV> & V,
         const Eigen::MatrixBase<DerivedF> & F);
       inline WindingNumberAABB(
-        const WindingNumberTree<Point,DerivedV,DerivedF> & parent,
-        const Eigen::MatrixBase<DerivedF> & F);
+        const WindingNumberTree<Scalar,Index> & parent,
+        const typename WindingNumberTree<Scalar,Index>::MatrixXF & F);
       /// Initialize the hierarchy to a given mesh
       ///
       /// @param[in] V  #V by 3 list of vertex positions
       /// @param[in] F  #F by 3 list of triangle indices into V
+      template <typename DerivedV, typename DerivedF>
       inline void set_mesh(
         const Eigen::MatrixBase<DerivedV> & V,
         const Eigen::MatrixBase<DerivedF> & F);
@@ -62,8 +67,8 @@ namespace igl
       inline virtual void grow();
       // Compute min and max corners
       inline void compute_min_max_corners();
-      inline typename DerivedV::Scalar max_abs_winding_number(const Point & p) const;
-      inline typename DerivedV::Scalar max_simple_abs_winding_number(const Point & p) const;
+      inline Scalar max_abs_winding_number(const Point & p) const;
+      inline Scalar max_simple_abs_winding_number(const Point & p) const;
   };
 }
 
@@ -86,70 +91,76 @@ namespace igl
 #  define WindingNumberAABB_MIN_F 100
 #endif
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::set_mesh(
+template <typename Scalar, typename Index>
+  template <typename DerivedV, typename DerivedF>
+inline void igl::WindingNumberAABB<Scalar,Index>::set_mesh(
     const Eigen::MatrixBase<DerivedV> & V,
     const Eigen::MatrixBase<DerivedF> & F)
 {
-  igl::WindingNumberTree<Point,DerivedV,DerivedF>::set_mesh(V,F);
+  // static assert that DerivedF::ColsAtCompileTime == 3 or Eigen::Dynamic
+  static_assert(
+    DerivedF::ColsAtCompileTime == 3 || DerivedF::ColsAtCompileTime == Eigen::Dynamic,
+    "F should have 3 or Dynamic columns");
+  igl::WindingNumberTree<Scalar,Index>::set_mesh(V,F);
   init();
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::init()
+template <typename Scalar, typename Index>
+inline void igl::WindingNumberAABB<Scalar,Index>::init()
 {
   using namespace Eigen;
   assert(max_corner.size() == 3);
   assert(min_corner.size() == 3);
   compute_min_max_corners();
-  Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,1> dblA;
-  doublearea(this->getV(),this->getF(),dblA);
+  Eigen::Matrix<Scalar,Eigen::Dynamic,1> dblA;
+  doublearea((*this->Vptr),(this->F),dblA);
   total_positive_area = dblA.sum()/2.0;
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline igl::WindingNumberAABB<Point,DerivedV,DerivedF>::WindingNumberAABB(
+template <typename Scalar, typename Index>
+template <typename DerivedV, typename DerivedF>
+inline igl::WindingNumberAABB<Scalar,Index>::WindingNumberAABB(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedF> & F):
-  WindingNumberTree<Point,DerivedV,DerivedF>(V,F),
+  WindingNumberTree<Scalar,Index>(V,F),
   min_corner(),
   max_corner(),
   total_positive_area(
-    std::numeric_limits<typename DerivedV::Scalar>::infinity()),
+    std::numeric_limits<Scalar>::infinity()),
   split_method(MEDIAN_ON_LONGEST_AXIS)
 {
   init();
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline igl::WindingNumberAABB<Point,DerivedV,DerivedF>::WindingNumberAABB(
-  const WindingNumberTree<Point,DerivedV,DerivedF> & parent,
-  const Eigen::MatrixBase<DerivedF> & F):
-  WindingNumberTree<Point,DerivedV,DerivedF>(parent,F),
+template <typename Scalar, typename Index>
+inline igl::WindingNumberAABB<Scalar,Index>::WindingNumberAABB(
+  const WindingNumberTree<Scalar,Index> & parent,
+  const typename WindingNumberTree<Scalar,Index>::MatrixXF & F):
+  WindingNumberTree<Scalar,Index>(parent,F),
   min_corner(),
   max_corner(),
   total_positive_area(
-    std::numeric_limits<typename DerivedV::Scalar>::infinity()),
+    std::numeric_limits<Scalar>::infinity()),
   split_method(MEDIAN_ON_LONGEST_AXIS)
 {
   init();
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::grow()
+template <typename Scalar, typename Index>
+inline void igl::WindingNumberAABB<Scalar,Index>::grow()
 {
   using namespace std;
   using namespace Eigen;
   // Clear anything that already exists
   this->delete_children();
 
-  //cout<<"cap.rows(): "<<this->getcap().rows()<<endl;
-  //cout<<"F.rows(): "<<this->getF().rows()<<endl;
+  //cout<<"cap.rows(): "<<(this->cap).rows()<<endl;
+  //cout<<"F.rows(): "<<(this->F).rows()<<endl;
 
   // Base cases
   if(
-    this->getF().rows() <= (WindingNumberAABB_MIN_F>0?WindingNumberAABB_MIN_F:0) ||
-    (this->getcap().rows() - 2) >= this->getF().rows())
+    (this->F).rows() <= (WindingNumberAABB_MIN_F>0?WindingNumberAABB_MIN_F:0) ||
+    ((this->cap).rows() - 2) >= (this->F).rows())
   {
     // Don't grow
     return;
@@ -157,8 +168,8 @@ inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::grow()
 
   // Compute longest direction
   int max_d = -1;
-  typename DerivedV::Scalar max_len = 
-    -numeric_limits<typename DerivedV::Scalar>::infinity();
+  Scalar max_len = 
+    -numeric_limits<Scalar>::infinity();
   for(int d = 0;d<min_corner.size();d++)
   {
     if( (max_corner[d] - min_corner[d]) > max_len )
@@ -168,13 +179,13 @@ inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::grow()
     }
   }
   // Compute facet barycenters
-  Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,Eigen::Dynamic> BC;
-  barycenter(this->getV(),this->getF(),BC);
+  Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> BC;
+  barycenter((*this->Vptr),(this->F),BC);
 
 
   // Blerg, why is selecting rows so difficult
 
-  typename DerivedV::Scalar split_value;
+  Scalar split_value;
   // Split in longest direction
   switch(split_method)
   {
@@ -191,8 +202,8 @@ inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::grow()
   //cout<<"c: "<<0.5*(max_corner[max_d] + min_corner[max_d])<<" "<<
   //  "m: "<<split_value<<endl;;
 
-  vector<int> id( this->getF().rows());
-  for(int i = 0;i<this->getF().rows();i++)
+  vector<int> id( (this->F).rows());
+  for(int i = 0;i<(this->F).rows();i++)
   {
     if(BC(i,max_d) <= split_value)
     {
@@ -210,19 +221,19 @@ inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::grow()
     // badly balanced base case (could try to recut)
     return;
   }
-  assert(lefts+rights == this->getF().rows());
-  DerivedF leftF(lefts,  this->getF().cols());
-  DerivedF rightF(rights,this->getF().cols());
+  assert(lefts+rights == (this->F).rows());
+  MatrixXF leftF(lefts,  (this->F).cols());
+  MatrixXF rightF(rights,(this->F).cols());
   int left_i = 0;
   int right_i = 0;
-  for(int i = 0;i<this->getF().rows();i++)
+  for(int i = 0;i<(this->F).rows();i++)
   {
     if(id[i] == 0)
     {
-      leftF.row(left_i++) = this->getF().row(i);
+      leftF.row(left_i++) = (this->F).row(i);
     }else if(id[i] == 1)
     {
-      rightF.row(right_i++) = this->getF().row(i);
+      rightF.row(right_i++) = (this->F).row(i);
     }else
     {
       assert(false);
@@ -231,18 +242,18 @@ inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::grow()
   assert(right_i == rightF.rows());
   assert(left_i == leftF.rows());
   // Finally actually grow children and Recursively grow
-  WindingNumberAABB<Point,DerivedV,DerivedF> * leftWindingNumberAABB = 
-    new WindingNumberAABB<Point,DerivedV,DerivedF>(*this,leftF);
+  WindingNumberAABB<Scalar,Index> * leftWindingNumberAABB = 
+    new WindingNumberAABB<Scalar,Index>(*this,leftF);
   leftWindingNumberAABB->grow();
   this->children.push_back(leftWindingNumberAABB);
-  WindingNumberAABB<Point,DerivedV,DerivedF> * rightWindingNumberAABB = 
-    new WindingNumberAABB<Point,DerivedV,DerivedF>(*this,rightF);
+  WindingNumberAABB<Scalar,Index> * rightWindingNumberAABB = 
+    new WindingNumberAABB<Scalar,Index>(*this,rightF);
   rightWindingNumberAABB->grow();
   this->children.push_back(rightWindingNumberAABB);
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline bool igl::WindingNumberAABB<Point,DerivedV,DerivedF>::inside(const Point & p) const
+template <typename Scalar, typename Index>
+inline bool igl::WindingNumberAABB<Scalar,Index>::inside(const Point & p) const
 {
   assert(p.size() == max_corner.size());
   assert(p.size() == min_corner.size());
@@ -259,8 +270,8 @@ inline bool igl::WindingNumberAABB<Point,DerivedV,DerivedF>::inside(const Point
   return true;
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::compute_min_max_corners()
+template <typename Scalar, typename Index>
+inline void igl::WindingNumberAABB<Scalar,Index>::compute_min_max_corners()
 {
   using namespace std;
   // initialize corners
@@ -272,26 +283,26 @@ inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::compute_min_max_cor
 
   this->center = Point(0,0,0);
   // Loop over facets
-  for(int i = 0;i<this->getF().rows();i++)
+  for(int i = 0;i<(this->F).rows();i++)
   {
-    for(int j = 0;j<this->getF().cols();j++)
+    for(int j = 0;j<(this->F).cols();j++)
     {
       for(int d = 0;d<min_corner.size();d++)
       {
         min_corner[d] = 
-          this->getV()(this->getF()(i,j),d) < min_corner[d] ?  
-            this->getV()(this->getF()(i,j),d) : min_corner[d];
+          (*this->Vptr)((this->F)(i,j),d) < min_corner[d] ?  
+            (*this->Vptr)((this->F)(i,j),d) : min_corner[d];
         max_corner[d] = 
-          this->getV()(this->getF()(i,j),d) > max_corner[d] ?  
-            this->getV()(this->getF()(i,j),d) : max_corner[d];
+          (*this->Vptr)((this->F)(i,j),d) > max_corner[d] ?  
+            (*this->Vptr)((this->F)(i,j),d) : max_corner[d];
       }
       // This is biased toward vertices incident on more than one face, but
       // perhaps that's good
-      this->center += this->getV().row(this->getF()(i,j));
+      this->center += (*this->Vptr).row((this->F)(i,j));
     }
   }
   // Average
-  this->center.array() /= this->getF().size();
+  this->center.array() /= (this->F).size();
 
   //cout<<"min_corner: "<<this->min_corner.transpose()<<endl;
   //cout<<"Center: "<<this->center.transpose()<<endl;
@@ -302,24 +313,24 @@ inline void igl::WindingNumberAABB<Point,DerivedV,DerivedF>::compute_min_max_cor
   this->radius = (max_corner-min_corner).norm()/2.0;
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline typename DerivedV::Scalar
-igl::WindingNumberAABB<Point,DerivedV,DerivedF>::max_abs_winding_number(const Point & p) const
+template <typename Scalar, typename Index>
+inline Scalar
+igl::WindingNumberAABB<Scalar,Index>::max_abs_winding_number(const Point & p) const
 {
   using namespace std;
   // Only valid if not inside
   if(inside(p))
   {
-    return numeric_limits<typename DerivedV::Scalar>::infinity();
+    return numeric_limits<Scalar>::infinity();
   }
   // Q: we know the total positive area so what's the most this could project
   // to? Remember it could be layered in the same direction.
-  return numeric_limits<typename DerivedV::Scalar>::infinity();
+  return numeric_limits<Scalar>::infinity();
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline typename DerivedV::Scalar 
-  igl::WindingNumberAABB<Point,DerivedV,DerivedF>::max_simple_abs_winding_number(
+template <typename Scalar, typename Index>
+inline Scalar 
+  igl::WindingNumberAABB<Scalar,Index>::max_simple_abs_winding_number(
   const Point & p) const
 {
   using namespace std;
@@ -327,7 +338,7 @@ inline typename DerivedV::Scalar
   // Only valid if not inside
   if(inside(p))
   {
-    return numeric_limits<typename DerivedV::Scalar>::infinity();
+    return numeric_limits<Scalar>::infinity();
   }
   // Max simple is the same as sum of positive winding number contributions of
   // bounding box
@@ -335,10 +346,10 @@ inline typename DerivedV::Scalar
   // begin precomputation
   //MatrixXd BV((int)pow(2,3),3);
   typedef
-    Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,Eigen::Dynamic>
+    Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic>
     MatrixXS;
   typedef
-    Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,Eigen::Dynamic>
+    Eigen::Matrix<Index,Eigen::Dynamic,Eigen::Dynamic>
     MatrixXF;
   MatrixXS BV((int)(1<<3),3);
   BV <<
@@ -383,16 +394,4 @@ inline typename DerivedV::Scalar
   return igl::winding_number(BV,PBF,p);
 }
 
-// This is a bullshit template because AABB annoyingly needs templates for bad
-// combinations of 3D V with DIM=2 AABB
-//
-// _Define_ as a no-op rather than monkeying around with the proper code above
-namespace igl
-{
-  template <> inline igl::WindingNumberAABB<Eigen::Matrix<double, 1, 3, 1, 1, 3>,Eigen::Matrix<double, -1, 2, 0, -1, 2>,Eigen::Matrix<int, -1, 2, 0, -1, 2>>::WindingNumberAABB(const Eigen::MatrixBase<Eigen::Matrix<double, -1, 2, 0, -1, 2>> & , const Eigen::MatrixBase<Eigen::Matrix<int, -1, 2, 0, -1, 2>> & ){};
-  template <> inline void igl::WindingNumberAABB<Eigen::Matrix<double, 1, 3, 1, 1, 3>,Eigen::Matrix<double, -1, 2, 0, -1, 2>,Eigen::Matrix<int, -1, 2, 0, -1, 2>>::grow(){};
-  template <> inline void igl::WindingNumberAABB<Eigen::Matrix<double, 1, 3, 1, 1, 3>,Eigen::Matrix<double, -1, 2, 0, -1, 2>,Eigen::Matrix<int, -1, 2, 0, -1, 2>>::init(){};
-
-}
-
 #endif

+ 100 - 127
include/igl/WindingNumberTree.h

@@ -11,73 +11,67 @@
 #include <map>
 #include <Eigen/Dense>
 #include "WindingNumberMethod.h"
+#include <memory>
 
 namespace igl
 {
   /// Space partitioning tree for computing winding number hierarchically.
-  ///
-  /// @tparam Point  type for points in space, e.g. Eigen::Vector3d
   template <
-    typename Point,
-    typename DerivedV, 
-    typename DerivedF >
+    typename Scalar, 
+    typename Index>
   class WindingNumberTree
   {
     public:
+      using Point = Eigen::Matrix<Scalar,1,3>;
       // Method to use (see enum above)
       //static double min_max_w;
       static std::map< 
         std::pair<const WindingNumberTree*,const WindingNumberTree*>, 
-        typename DerivedV::Scalar>
+        Scalar>
           cached;
-      // This is only need to fill in references, it should never actually be touched
-      // and shouldn't cause race conditions. (This is a hack, but I think it's "safe")
-      static DerivedV dummyV;
     protected:
       WindingNumberMethod method;
       const WindingNumberTree * parent;
       std::list<WindingNumberTree * > children;
       typedef 
-        Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,Eigen::Dynamic>
+        Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic>
         MatrixXS;
       typedef 
-        Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,Eigen::Dynamic>
+        Eigen::Matrix<Index,Eigen::Dynamic,Eigen::Dynamic>
         MatrixXF;
-      //// List of boundary edges (recall edges are vertices in 2d)
-      //const Eigen::MatrixXi boundary;
-      // Base mesh vertices
-      DerivedV & V;
-      // Base mesh vertices with duplicates removed
+      // Base mesh vertices with duplicates removed (root will fill this in and
+      // then everyone's Vptr will point to it.
       MatrixXS SV;
+      // Shared pointer to base mesh vertices
+      std::shared_ptr<MatrixXS> Vptr;
       // Facets in this bounding volume
       MatrixXF F;
       // Tessellated boundary curve
       MatrixXF cap;
       // Upper Bound on radius of enclosing ball
-      typename DerivedV::Scalar radius;
+      Scalar radius;
       // (Approximate) center (of mass)
       Point center;
     public:
       inline WindingNumberTree();
       // For root
+      template <typename DerivedV, typename DerivedF>
       inline WindingNumberTree(
         const Eigen::MatrixBase<DerivedV> & V,
         const Eigen::MatrixBase<DerivedF> & F);
       // For chilluns 
       inline WindingNumberTree(
-        const WindingNumberTree<Point,DerivedV,DerivedF> & parent,
-        const Eigen::MatrixBase<DerivedF> & F);
+        const WindingNumberTree<Scalar,Index> & parent,
+        const typename igl::WindingNumberTree<Scalar,Index>::MatrixXF & F);
       inline virtual ~WindingNumberTree();
       inline void delete_children();
-      inline virtual void set_mesh(
+      template <typename DerivedV, typename DerivedF>
+      inline void set_mesh(
         const Eigen::MatrixBase<DerivedV> & V,
         const Eigen::MatrixBase<DerivedF> & F);
       // Set method
       inline void set_method( const WindingNumberMethod & m);
     public:
-      inline const DerivedV & getV() const;
-      inline const MatrixXF & getF() const;
-      inline const MatrixXF & getcap() const;
       // Grow the Tree recursively
       inline virtual void grow();
       // Determine whether a given point is inside the bounding 
@@ -92,12 +86,12 @@ namespace igl
       // Inputs:
       //   p  query point 
       // Returns winding number 
-      inline typename DerivedV::Scalar winding_number(const Point & p) const;
+      inline Scalar winding_number(const Point & p) const;
       // Same as above, but always computes winding number using exact method
       // (sum over every facet)
-      inline typename DerivedV::Scalar winding_number_all(const Point & p) const;
+      inline Scalar winding_number_all(const Point & p) const;
       // Same as above, but always computes using sum over tessllated boundary
-      inline typename DerivedV::Scalar winding_number_boundary(const Point & p) const;
+      inline Scalar winding_number_boundary(const Point & p) const;
       //// Same as winding_number above, but if max_simple_abs_winding_number is
       //// less than some threshold min_max_w just return 0 (colloquially the "fast
       //// multipole method)
@@ -120,10 +114,10 @@ namespace igl
       // Inputs:
       //   p  query point 
       // Returns max winding number of 
-      inline virtual typename DerivedV::Scalar max_abs_winding_number(const Point & p) const; 
+      inline virtual Scalar max_abs_winding_number(const Point & p) const; 
       // Same as above, but stronger assumptions on (V,F). Assumes (V,F) is a
       // simple polyhedron
-      inline virtual typename DerivedV::Scalar max_simple_abs_winding_number(const Point & p) const;
+      inline virtual Scalar max_simple_abs_winding_number(const Point & p) const;
       // Compute or read cached winding number for point p with respect to mesh
       // in bounding box, recursing according to approximation criteria
       //
@@ -131,7 +125,7 @@ namespace igl
       //   p  query point 
       //   that  WindingNumberTree containing mesh w.r.t. which we're computing w.n.
       // Returns cached winding number
-      inline virtual typename DerivedV::Scalar cached_winding_number(const WindingNumberTree & that, const Point & p) const;
+      inline virtual Scalar cached_winding_number(const WindingNumberTree & that, const Point & p) const;
   };
 }
 
@@ -148,45 +142,45 @@ namespace igl
 #include <iostream>
 #include <limits>
 
-//template <typename Point, typename DerivedV, typename DerivedF>
-//WindingNumberMethod WindingNumberTree<Point,DerivedV,DerivedF>::method = EXACT_WINDING_NUMBER_METHOD;
-//template <typename Point, typename DerivedV, typename DerivedF>
-//double WindingNumberTree<Point,DerivedV,DerivedF>::min_max_w = 0;
-template <typename Point, typename DerivedV, typename DerivedF>
-std::map< std::pair<const igl::WindingNumberTree<Point,DerivedV,DerivedF>*,const igl::WindingNumberTree<Point,DerivedV,DerivedF>*>, typename DerivedV::Scalar>
-  igl::WindingNumberTree<Point,DerivedV,DerivedF>::cached;
+//template <typename Scalar, typename Index>
+//WindingNumberMethod WindingNumberTree<Scalar,Index>::method = EXACT_WINDING_NUMBER_METHOD;
+//template <typename Scalar, typename Index>
+//double WindingNumberTree<Scalar,Index>::min_max_w = 0;
+template <typename Scalar, typename Index>
+std::map< std::pair<const igl::WindingNumberTree<Scalar,Index>*,const igl::WindingNumberTree<Scalar,Index>*>, Scalar>
+  igl::WindingNumberTree<Scalar,Index>::cached;
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline igl::WindingNumberTree<Point,DerivedV,DerivedF>::WindingNumberTree():
+template <typename Scalar, typename Index>
+inline igl::WindingNumberTree<Scalar,Index>::WindingNumberTree():
   method(EXACT_WINDING_NUMBER_METHOD),
   parent(NULL),
-  V(dummyV),
   SV(),
   F(),
   cap(),
-  radius(std::numeric_limits<typename DerivedV::Scalar>::infinity()),
+  radius(std::numeric_limits<Scalar>::infinity()),
   center(0,0,0)
 {
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline igl::WindingNumberTree<Point,DerivedV,DerivedF>::WindingNumberTree(
+template <typename Scalar, typename Index>
+template <typename DerivedV, typename DerivedF>
+inline igl::WindingNumberTree<Scalar,Index>::WindingNumberTree(
   const Eigen::MatrixBase<DerivedV> & _V,
   const Eigen::MatrixBase<DerivedF> & _F):
   method(EXACT_WINDING_NUMBER_METHOD),
   parent(NULL),
-  V(dummyV),
   SV(),
   F(),
   cap(),
-  radius(std::numeric_limits<typename DerivedV::Scalar>::infinity()),
+  radius(std::numeric_limits<Scalar>::infinity()),
   center(0,0,0)
 {
   set_mesh(_V,_F);
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline void igl::WindingNumberTree<Point,DerivedV,DerivedF>::set_mesh(
+template <typename Scalar, typename Index>
+template <typename DerivedV, typename DerivedF>
+inline void igl::WindingNumberTree<Scalar,Index>::set_mesh(
     const Eigen::MatrixBase<DerivedV> & _V,
     const Eigen::MatrixBase<DerivedF> & _F)
 {
@@ -196,35 +190,43 @@ inline void igl::WindingNumberTree<Point,DerivedV,DerivedF>::set_mesh(
   // Q: Would we gain even more by remove almost exactly duplicate vertices?
   Eigen::Matrix<typename MatrixXF::Scalar,Eigen::Dynamic,1> SVI,SVJ;
   igl::remove_duplicate_vertices(_V,_F,0.0,SV,SVI,SVJ,F);
-  triangle_fan(igl::exterior_edges(F),cap);
-  V = SV;
+  {
+    Eigen::Matrix<typename MatrixXF::Scalar,Eigen::Dynamic,2> EE;
+    igl::exterior_edges(F,EE);
+    triangle_fan(EE,cap);
+  }
+  // point Vptr to SV
+  Vptr = std::make_shared<MatrixXS>(SV);
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline igl::WindingNumberTree<Point,DerivedV,DerivedF>::WindingNumberTree(
-  const igl::WindingNumberTree<Point,DerivedV,DerivedF> & parent,
-  const Eigen::MatrixBase<DerivedF> & _F):
+template <typename Scalar, typename Index>
+inline igl::WindingNumberTree<Scalar,Index>::WindingNumberTree(
+  const igl::WindingNumberTree<Scalar,Index> & parent,
+  const typename igl::WindingNumberTree<Scalar,Index>::MatrixXF & _F):
   method(parent.method),
   parent(&parent),
-  V(parent.V),
+  Vptr(parent.Vptr),
   SV(),
   F(_F),
-  cap(triangle_fan(igl::exterior_edges(_F)))
+  cap()
 {
+  Eigen::Matrix<typename MatrixXF::Scalar,Eigen::Dynamic,2> EE;
+  igl::exterior_edges(F,EE);
+  triangle_fan(EE,cap);
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline igl::WindingNumberTree<Point,DerivedV,DerivedF>::~WindingNumberTree()
+template <typename Scalar, typename Index>
+inline igl::WindingNumberTree<Scalar,Index>::~WindingNumberTree()
 {
   delete_children();
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline void igl::WindingNumberTree<Point,DerivedV,DerivedF>::delete_children()
+template <typename Scalar, typename Index>
+inline void igl::WindingNumberTree<Scalar,Index>::delete_children()
 {
   using namespace std;
   // Delete children
-  typename list<WindingNumberTree<Point,DerivedV,DerivedF>* >::iterator cit = children.begin();
+  typename list<WindingNumberTree<Scalar,Index>* >::iterator cit = children.begin();
   while(cit != children.end())
   {
     // clear the memory of this item
@@ -234,8 +236,8 @@ inline void igl::WindingNumberTree<Point,DerivedV,DerivedF>::delete_children()
   }
 }
       
-template <typename Point, typename DerivedV, typename DerivedF>
-inline void igl::WindingNumberTree<Point,DerivedV,DerivedF>::set_method(const WindingNumberMethod & m)
+template <typename Scalar, typename Index>
+inline void igl::WindingNumberTree<Scalar,Index>::set_method(const WindingNumberMethod & m)
 {
   this->method = m;
   for(auto child : children)
@@ -244,42 +246,22 @@ inline void igl::WindingNumberTree<Point,DerivedV,DerivedF>::set_method(const Wi
   }
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline const DerivedV & igl::WindingNumberTree<Point,DerivedV,DerivedF>::getV() const
-{
-  return V;
-}
-
-template <typename Point, typename DerivedV, typename DerivedF>
-inline const typename igl::WindingNumberTree<Point,DerivedV,DerivedF>::MatrixXF& 
-  igl::WindingNumberTree<Point,DerivedV,DerivedF>::getF() const
-{
-  return F;
-}
-
-template <typename Point, typename DerivedV, typename DerivedF>
-inline const typename igl::WindingNumberTree<Point,DerivedV,DerivedF>::MatrixXF& 
-  igl::WindingNumberTree<Point,DerivedV,DerivedF>::getcap() const
-{
-  return cap;
-}
-
-template <typename Point, typename DerivedV, typename DerivedF>
-inline void igl::WindingNumberTree<Point,DerivedV,DerivedF>::grow()
+template <typename Scalar, typename Index>
+inline void igl::WindingNumberTree<Scalar,Index>::grow()
 {
   // Don't grow
   return;
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline bool igl::WindingNumberTree<Point,DerivedV,DerivedF>::inside(const Point & /*p*/) const
+template <typename Scalar, typename Index>
+inline bool igl::WindingNumberTree<Scalar,Index>::inside(const Point & /*p*/) const
 {
   return true;
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline typename DerivedV::Scalar 
-igl::WindingNumberTree<Point,DerivedV,DerivedF>::winding_number(const Point & p) const
+template <typename Scalar, typename Index>
+inline Scalar 
+igl::WindingNumberTree<Scalar,Index>::winding_number(const Point & p) const
 {
   using namespace std;
   //cout<<"+"<<boundary.rows();
@@ -290,9 +272,9 @@ igl::WindingNumberTree<Point,DerivedV,DerivedF>::winding_number(const Point & p)
     if(children.size()>0)
     {
       // Recurse on each child and accumulate
-      typename DerivedV::Scalar sum = 0;
+      Scalar sum = 0;
       for(
-        typename list<WindingNumberTree<Point,DerivedV,DerivedF>* >::const_iterator cit = children.begin();
+        typename list<WindingNumberTree<Scalar,Index>* >::const_iterator cit = children.begin();
         cit != children.end();
         cit++)
       {
@@ -330,7 +312,7 @@ igl::WindingNumberTree<Point,DerivedV,DerivedF>::winding_number(const Point & p)
           return winding_number_boundary(p);
         case APPROX_SIMPLE_WINDING_NUMBER_METHOD:
         {
-          typename DerivedV::Scalar dist = (p-center).norm();
+          Scalar dist = (p-center).norm();
           // Radius is already an overestimate of inside
           if(dist>1.0*radius)
           {
@@ -355,24 +337,22 @@ igl::WindingNumberTree<Point,DerivedV,DerivedF>::winding_number(const Point & p)
   return 0;
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline typename DerivedV::Scalar 
-  igl::WindingNumberTree<Point,DerivedV,DerivedF>::winding_number_all(const Point & p) const
+template <typename Scalar, typename Index>
+inline Scalar 
+  igl::WindingNumberTree<Scalar,Index>::winding_number_all(const Point & p) const
 {
-  return igl::winding_number(V,F,p);
+  return igl::winding_number(*Vptr,F,p);
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline typename DerivedV::Scalar 
-igl::WindingNumberTree<Point,DerivedV,DerivedF>::winding_number_boundary(const Point & p) const
+template <typename Scalar, typename Index>
+inline Scalar 
+igl::WindingNumberTree<Scalar,Index>::winding_number_boundary(const Point & p) const
 {
-  using namespace Eigen;
-  using namespace std;
-  return igl::winding_number(V,cap,p);
+  return igl::winding_number(*Vptr,cap,p);
 }
 
-//template <typename Point, typename DerivedV, typename DerivedF>
-//inline double igl::WindingNumberTree<Point,DerivedV,DerivedF>::winding_number_approx_simple(
+//template <typename Scalar, typename Index>
+//inline double igl::WindingNumberTree<Scalar,Index>::winding_number_approx_simple(
 //  const Point & p, 
 //  const double min_max_w)
 //{
@@ -387,15 +367,15 @@ igl::WindingNumberTree<Point,DerivedV,DerivedF>::winding_number_boundary(const P
 //  }
 //}
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline void igl::WindingNumberTree<Point,DerivedV,DerivedF>::print(const char * tab)
+template <typename Scalar, typename Index>
+inline void igl::WindingNumberTree<Scalar,Index>::print(const char * tab)
 {
   using namespace std;
   // Print all facets
   cout<<tab<<"["<<endl<<F<<endl<<"]";
   // Print children
   for(
-      typename list<WindingNumberTree<Point,DerivedV,DerivedF>* >::iterator cit = children.begin();
+      typename list<WindingNumberTree<Scalar,Index>* >::iterator cit = children.begin();
       cit != children.end();
       cit++)
   {
@@ -404,26 +384,26 @@ inline void igl::WindingNumberTree<Point,DerivedV,DerivedF>::print(const char *
   }
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline typename DerivedV::Scalar 
-igl::WindingNumberTree<Point,DerivedV,DerivedF>::max_abs_winding_number(const Point & /*p*/) const
+template <typename Scalar, typename Index>
+inline Scalar 
+igl::WindingNumberTree<Scalar,Index>::max_abs_winding_number(const Point & /*p*/) const
 {
-  return std::numeric_limits<typename DerivedV::Scalar>::infinity();
+  return std::numeric_limits<Scalar>::infinity();
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline typename DerivedV::Scalar 
-igl::WindingNumberTree<Point,DerivedV,DerivedF>::max_simple_abs_winding_number(
+template <typename Scalar, typename Index>
+inline Scalar 
+igl::WindingNumberTree<Scalar,Index>::max_simple_abs_winding_number(
   const Point & /*p*/) const
 {
   using namespace std;
-  return numeric_limits<typename DerivedV::Scalar>::infinity();
+  return numeric_limits<Scalar>::infinity();
 }
 
-template <typename Point, typename DerivedV, typename DerivedF>
-inline typename DerivedV::Scalar 
-igl::WindingNumberTree<Point,DerivedV,DerivedF>::cached_winding_number(
-  const igl::WindingNumberTree<Point,DerivedV,DerivedF> & that,
+template <typename Scalar, typename Index>
+inline Scalar 
+igl::WindingNumberTree<Scalar,Index>::cached_winding_number(
+  const igl::WindingNumberTree<Scalar,Index> & that,
   const Point & p) const
 {
   using namespace std;
@@ -447,7 +427,7 @@ igl::WindingNumberTree<Point,DerivedV,DerivedF>::cached_winding_number(
   bool is_far = this->radius<that.radius;
   if(is_far)
   {
-    typename DerivedV::Scalar a = atan2(
+    Scalar a = atan2(
       that.radius - this->radius,
       (that.center - this->center).norm());
     assert(a>0);
@@ -472,7 +452,7 @@ igl::WindingNumberTree<Point,DerivedV,DerivedF>::cached_winding_number(
   }else
   {
     for(
-      typename list<WindingNumberTree<Point,DerivedV,DerivedF>* >::const_iterator cit = children.begin();
+      typename list<WindingNumberTree<Scalar,Index>* >::const_iterator cit = children.begin();
       cit != children.end();
       cit++)
     {
@@ -490,11 +470,4 @@ igl::WindingNumberTree<Point,DerivedV,DerivedF>::cached_winding_number(
   return 0;
 }
 
-// Explicit instantiation of static variable
-template <
-  typename Point,
-  typename DerivedV, 
-  typename DerivedF >
-DerivedV igl::WindingNumberTree<Point,DerivedV,DerivedF>::dummyV;
-
 #endif

+ 16 - 15
include/igl/active_set.cpp

@@ -12,6 +12,7 @@
 #include "cat.h"
 //#include "matlab_format.h"
 #include "placeholders.h"
+#include "PlainMatrix.h"
 
 #include <iostream>
 #include <limits>
@@ -32,15 +33,15 @@ template <
   >
 IGL_INLINE igl::SolverStatus igl::active_set(
   const Eigen::SparseMatrix<AT>& A,
-  const Eigen::PlainObjectBase<DerivedB> & B,
-  const Eigen::PlainObjectBase<Derivedknown> & known,
-  const Eigen::PlainObjectBase<DerivedY> & Y,
+  const Eigen::MatrixBase<DerivedB> & B,
+  const Eigen::MatrixBase<Derivedknown> & known,
+  const Eigen::MatrixBase<DerivedY> & Y,
   const Eigen::SparseMatrix<AeqT>& Aeq,
-  const Eigen::PlainObjectBase<DerivedBeq> & Beq,
+  const Eigen::MatrixBase<DerivedBeq> & Beq,
   const Eigen::SparseMatrix<AieqT>& Aieq,
-  const Eigen::PlainObjectBase<DerivedBieq> & Bieq,
-  const Eigen::PlainObjectBase<Derivedlx> & p_lx,
-  const Eigen::PlainObjectBase<Derivedux> & p_ux,
+  const Eigen::MatrixBase<DerivedBieq> & Bieq,
+  const Eigen::MatrixBase<Derivedlx> & p_lx,
+  const Eigen::MatrixBase<Derivedux> & p_ux,
   const igl::active_set_params & params,
   Eigen::PlainObjectBase<DerivedZ> & Z
   )
@@ -111,7 +112,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
   Matrix<BOOL,Dynamic,1> as_ieq = Matrix<BOOL,Dynamic,1>::Constant(Aieq.rows(),1,FALSE);
 
   // Keep track of previous Z for comparison
-  DerivedZ old_Z;
+  PlainMatrix<DerivedZ> old_Z;
 
   int iter = 0;
   while(true)
@@ -149,7 +150,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
       }
       if(Aieq.rows() > 0)
       {
-        DerivedZ AieqZ;
+        PlainMatrix<DerivedZ,Eigen::Dynamic> AieqZ;
         AieqZ = Aieq*Z;
         for(int a = 0;a<Aieq.rows();a++)
         {
@@ -203,7 +204,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
     // PREPARE FIXED VALUES
     Eigen::Matrix<typename Derivedknown::Scalar,Eigen::Dynamic,1> known_i;
     known_i.resize(nk + as_lx_count + as_ux_count,1);
-    DerivedY Y_i;
+    PlainMatrix<DerivedY,Eigen::Dynamic,1> Y_i;
     Y_i.resize(nk + as_lx_count + as_ux_count,1);
     {
       known_i.block(0,0,known.rows(),known.cols()) = known;
@@ -236,7 +237,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
     // PREPARE EQUALITY CONSTRAINTS
     Eigen::Matrix<typename DerivedY::Scalar, Eigen::Dynamic, 1> as_ieq_list(as_ieq_count,1);
     // Gather active constraints and resp. rhss
-    DerivedBeq Beq_i;
+    PlainMatrix<DerivedBeq,Eigen::Dynamic,1> Beq_i;
     Beq_i.resize(Beq.rows()+as_ieq_count,1);
     Beq_i.head(Beq.rows()) = Beq;
     {
@@ -273,7 +274,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
     }
 #endif
 
-    DerivedZ sol;
+    PlainMatrix<DerivedZ,Eigen::Dynamic,Eigen::Dynamic> sol;
     if(known_i.size() == A.rows())
     {
       // Everything's fixed?
@@ -329,7 +330,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,igl::placeholders::all);
+    PlainMatrix<DerivedB,Eigen::Dynamic> 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) =
@@ -382,6 +383,6 @@ IGL_INLINE igl::SolverStatus igl::active_set(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template igl::SolverStatus igl::active_set<double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, double, 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::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, igl::active_set_params const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-template igl::SolverStatus igl::active_set<double, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, double, 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::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, igl::active_set_params const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template igl::SolverStatus igl::active_set<double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, double, 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::SparseMatrix<double, 0, int> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::SparseMatrix<double, 0, int> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::SparseMatrix<double, 0, int> const&, Eigen::MatrixBase<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, -1, 1, 0, -1, 1> > const&, igl::active_set_params const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
+template igl::SolverStatus igl::active_set<double, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, double, 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::SparseMatrix<double, 0, int> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::SparseMatrix<double, 0, int> const&, Eigen::MatrixBase<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, -1, -1, 0, -1, -1> > const&, igl::active_set_params const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif

+ 7 - 7
include/igl/active_set.h

@@ -70,15 +70,15 @@ namespace igl
     >
   IGL_INLINE igl::SolverStatus active_set(
     const Eigen::SparseMatrix<AT>& A,
-    const Eigen::PlainObjectBase<DerivedB> & B,
-    const Eigen::PlainObjectBase<Derivedknown> & known,
-    const Eigen::PlainObjectBase<DerivedY> & Y,
+    const Eigen::MatrixBase<DerivedB> & B,
+    const Eigen::MatrixBase<Derivedknown> & known,
+    const Eigen::MatrixBase<DerivedY> & Y,
     const Eigen::SparseMatrix<AeqT>& Aeq,
-    const Eigen::PlainObjectBase<DerivedBeq> & Beq,
+    const Eigen::MatrixBase<DerivedBeq> & Beq,
     const Eigen::SparseMatrix<AieqT>& Aieq,
-    const Eigen::PlainObjectBase<DerivedBieq> & Bieq,
-    const Eigen::PlainObjectBase<Derivedlx> & lx,
-    const Eigen::PlainObjectBase<Derivedux> & ux,
+    const Eigen::MatrixBase<DerivedBieq> & Bieq,
+    const Eigen::MatrixBase<Derivedlx> & lx,
+    const Eigen::MatrixBase<Derivedux> & ux,
     const igl::active_set_params & params,
     Eigen::PlainObjectBase<DerivedZ> & Z
     );

+ 30 - 24
include/igl/ambient_occlusion.cpp

@@ -22,8 +22,8 @@ template <
 IGL_INLINE void igl::ambient_occlusion(
   const std::function<
     bool(
-      const Eigen::Vector3f&,
-      const Eigen::Vector3f&)
+      const Eigen::Matrix<typename DerivedP::Scalar,3,1> &,
+      const Eigen::Matrix<typename DerivedP::Scalar,3,1> &)
       > & shoot_ray,
   const Eigen::MatrixBase<DerivedP> & P,
   const Eigen::MatrixBase<DerivedN> & N,
@@ -35,16 +35,19 @@ IGL_INLINE void igl::ambient_occlusion(
   // Resize output
   S.resize(n,1);
   // Embree seems to be parallel when constructing but not when tracing rays
-  const MatrixXf D = random_dir_stratified(num_samples).cast<float>();
+  typedef typename DerivedP::Scalar Scalar;
+  typedef Eigen::Matrix<Scalar,3,1> Vector3N;
+
+  const Matrix<Scalar,Eigen::Dynamic,3> D = random_dir_stratified(num_samples).cast<Scalar>();
 
   const auto & inner = [&P,&N,&num_samples,&D,&S,&shoot_ray](const int p)
   {
-    const Vector3f origin = P.row(p).template cast<float>();
-    const Vector3f normal = N.row(p).template cast<float>();
+    const Vector3N origin = P.row(p);
+    const Vector3N normal = N.row(p);
     int num_hits = 0;
     for(int s = 0;s<num_samples;s++)
     {
-      Vector3f d = D.row(s);
+      Vector3N d = D.row(s);
       if(d.dot(normal) < 0)
       {
         // reverse ray
@@ -76,17 +79,19 @@ IGL_INLINE void igl::ambient_occlusion(
   const int num_samples,
   Eigen::PlainObjectBase<DerivedS> & S)
 {
+  typedef typename DerivedV::Scalar Scalar;
+  using Vector3S = Eigen::Matrix<Scalar,3,1>;
   const auto & shoot_ray = [&aabb,&V,&F](
-    const Eigen::Vector3f& _s,
-    const Eigen::Vector3f& dir)->bool
+    const Eigen::Matrix<Scalar,3,1> & _s,
+    const Eigen::Matrix<Scalar,3,1> & dir)->bool
   {
-    Eigen::Vector3f s = _s+1e-4*dir;
-    igl::Hit hit;
+    Vector3S s = _s+1e-4*dir;
+    igl::Hit<Scalar> hit;
     return aabb.intersect_ray(
       V,
       F,
-      s  .cast<typename DerivedV::Scalar>().eval(),
-      dir.cast<typename DerivedV::Scalar>().eval(),
+      s,
+      dir,
       hit);
   };
   return ambient_occlusion(shoot_ray,P,N,num_samples,S);
@@ -107,15 +112,17 @@ IGL_INLINE void igl::ambient_occlusion(
   const int num_samples,
   Eigen::PlainObjectBase<DerivedS> & S)
 {
+  typedef typename DerivedV::Scalar Scalar;
+  using Vector3S = Eigen::Matrix<Scalar,3,1>;
   if(F.rows() < 100)
   {
     // Super naive
     const auto & shoot_ray = [&V,&F](
-      const Eigen::Vector3f& _s,
-      const Eigen::Vector3f& dir)->bool
+      const Eigen::Matrix<Scalar,3,1> & _s,
+      const Eigen::Matrix<Scalar,3,1> & dir)->bool
     {
-      Eigen::Vector3f s = _s+1e-4*dir;
-      igl::Hit hit;
+      Vector3S s = _s+1e-4*dir;
+      igl::Hit<Scalar> hit;
       return ray_mesh_intersect(s,dir,V,F,hit);
     };
     return ambient_occlusion(shoot_ray,P,N,num_samples,S);
@@ -127,13 +134,12 @@ IGL_INLINE void igl::ambient_occlusion(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-// generated by autoexplicit.sh
 template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-// generated by autoexplicit.sh
-template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-// generated by autoexplicit.sh
-template void igl::ambient_occlusion<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-// generated by autoexplicit.sh
-template void igl::ambient_occlusion<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
+template void igl::ambient_occlusion<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
+template void igl::ambient_occlusion<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
+template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::function<bool (Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::ambient_occlusion<Eigen::Matrix<float, 1, 3, 1, 1, 3>, Eigen::Matrix<float, 1, 3, 1, 1, 3>, Eigen::Matrix<float, -1, 1, 0, -1, 1>>(std::function<bool (Eigen::Matrix<Eigen::Matrix<float, 1, 3, 1, 1, 3>::Scalar, 3, 1, 0, 3, 1> const&, Eigen::Matrix<Eigen::Matrix<float, 1, 3, 1, 1, 3>::Scalar, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<float, 1, 3, 1, 1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<float, 1, 3, 1, 1, 3>> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1>>&);
+template void igl::ambient_occlusion<Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<float, -1, 1, 0, -1, 1>>(std::function<bool (Eigen::Matrix<Eigen::Matrix<float, -1, 3, 0, -1, 3>::Scalar, 3, 1, 0, 3, 1> const&, Eigen::Matrix<Eigen::Matrix<float, -1, 3, 0, -1, 3>::Scalar, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3>> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1>>&);
+template void igl::ambient_occlusion<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, 1, 0, -1, 1>>(std::function<bool (Eigen::Matrix<Eigen::Matrix<float, -1, -1, 0, -1, -1>::Scalar, 3, 1, 0, 3, 1> const&, Eigen::Matrix<Eigen::Matrix<float, -1, -1, 0, -1, -1>::Scalar, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<float, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<float, -1, -1, 0, -1, -1>> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1>>&);
 #endif

+ 2 - 2
include/igl/ambient_occlusion.h

@@ -31,8 +31,8 @@ namespace igl
   IGL_INLINE void ambient_occlusion(
     const std::function<
       bool(
-        const Eigen::Vector3f&,
-        const Eigen::Vector3f&)
+        const Eigen::Matrix<typename DerivedP::Scalar,3,1>&,
+        const Eigen::Matrix<typename DerivedP::Scalar,3,1>&)
         > & shoot_ray,
     const Eigen::MatrixBase<DerivedP> & P,
     const Eigen::MatrixBase<DerivedN> & N,

+ 3 - 3
include/igl/arap_rhs.cpp

@@ -49,7 +49,7 @@ IGL_INLINE void igl::arap_rhs(
       return;
   }
 
-  DerivedK KX,KY,KZ;
+  Eigen::SparseMatrix<typename DerivedK::Scalar> KX,KY,KZ;
   arap_linear_block(V,F,0,energy,KX);
   arap_linear_block(V,F,1,energy,KY);
   if(Vdim == 2)
@@ -63,7 +63,7 @@ IGL_INLINE void igl::arap_rhs(
       K = cat(2,cat(2,repdiag(KX,dim),repdiag(KY,dim)),repdiag(KZ,dim));
     }else if(dim ==2)
     {
-      DerivedK ZZ(KX.rows()*2,KX.cols());
+      Eigen::SparseMatrix<typename DerivedK::Scalar> ZZ(KX.rows()*2,KX.cols());
       K = cat(2,cat(2,
             cat(2,repdiag(KX,dim),ZZ),
             cat(2,repdiag(KY,dim),ZZ)),
@@ -92,4 +92,4 @@ IGL_INLINE void igl::arap_rhs(
 
 #ifdef IGL_STATIC_LIBRARY
 template void igl::arap_rhs(const Eigen::MatrixBase<Eigen::MatrixXd> & V, const Eigen::MatrixBase<Eigen::MatrixXi> & F,const int dim, const igl::ARAPEnergyType energy,Eigen::SparseCompressedBase<Eigen::SparseMatrix<double>>& K);
-#endif
+#endif

+ 1 - 0
include/igl/barycenter.cpp

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

+ 5 - 5
include/igl/bbw.cpp

@@ -39,10 +39,10 @@ template <
   typename Derivedbc,
   typename DerivedW>
 IGL_INLINE bool igl::bbw(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedEle> & Ele,
-  const Eigen::PlainObjectBase<Derivedb> & b,
-  const Eigen::PlainObjectBase<Derivedbc> & bc,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedEle> & Ele,
+  const Eigen::MatrixBase<Derivedb> & b,
+  const Eigen::MatrixBase<Derivedbc> & bc,
   igl::BBWData & data,
   Eigen::PlainObjectBase<DerivedW> & W
   )
@@ -143,6 +143,6 @@ IGL_INLINE bool igl::bbw(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template bool igl::bbw<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, igl::BBWData&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template bool igl::bbw<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::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::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, igl::BBWData&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>&);
 #endif
 

+ 4 - 4
include/igl/bbw.h

@@ -60,10 +60,10 @@ namespace igl
     typename Derivedbc,
     typename DerivedW>
   IGL_INLINE bool bbw(
-    const Eigen::PlainObjectBase<DerivedV> & V,
-    const Eigen::PlainObjectBase<DerivedEle> & Ele,
-    const Eigen::PlainObjectBase<Derivedb> & b,
-    const Eigen::PlainObjectBase<Derivedbc> & bc,
+    const Eigen::MatrixBase<DerivedV> & V,
+    const Eigen::MatrixBase<DerivedEle> & Ele,
+    const Eigen::MatrixBase<Derivedb> & b,
+    const Eigen::MatrixBase<Derivedbc> & bc,
     BBWData & data,
     Eigen::PlainObjectBase<DerivedW> & W);
 }

+ 2 - 1
include/igl/bezier.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 "bezier.h"
+#include "PlainMatrix.h"
 #include <cassert>
 
 // Adapted from main.c accompanying
@@ -19,7 +20,7 @@ IGL_INLINE void igl::bezier(
   Eigen::PlainObjectBase<DerivedP> & P)
 {
   // working local copy
-  DerivedV Vtemp = V;
+  PlainMatrix<DerivedV> Vtemp = V;
   int degree = Vtemp.rows()-1;
   /* Triangle computation	*/
   for (int i = 1; i <= degree; i++)

+ 1 - 1
include/igl/biharmonic_coordinates.cpp

@@ -149,7 +149,7 @@ IGL_INLINE bool igl::biharmonic_coordinates(
   }
   // Vertices in point handles
   const size_t mp =
-    count_if(S.begin(),S.end(),[](const vector<int> & h){return h.size()==1;});
+    count_if(S.begin(),S.end(),[](const vector<SType> & h){return h.size()==1;});
   // number of region handles
   const size_t r = S.size()-mp;
   // Vertices in region handles

+ 24 - 9
include/igl/boundary_conditions.cpp

@@ -15,16 +15,26 @@
 #include <map>
 #include <iostream>
 
+template <
+  typename DerivedV,
+  typename DerivedEle,
+  typename DerivedC,
+  typename DerivedP,
+  typename DerivedBE,
+  typename DerivedCE,
+  typename DerivedCF,
+  typename Derivedb,
+  typename Derivedbc>
 IGL_INLINE bool igl::boundary_conditions(
-  const Eigen::MatrixXd & V  ,
-  const Eigen::MatrixXi & /*Ele*/,
-  const Eigen::MatrixXd & C  ,
-  const Eigen::VectorXi & P  ,
-  const Eigen::MatrixXi & BE ,
-  const Eigen::MatrixXi & CE ,
-  const Eigen::MatrixXi & CF ,
-  Eigen::VectorXi &       b  ,
-  Eigen::MatrixXd &       bc )
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedEle> & Ele,
+  const Eigen::MatrixBase<DerivedC> & C,
+  const Eigen::MatrixBase<DerivedP> & P,
+  const Eigen::MatrixBase<DerivedBE> & BE,
+  const Eigen::MatrixBase<DerivedCE> & CE,
+  const Eigen::MatrixBase<DerivedCF> & CF,
+  Eigen::PlainObjectBase<Derivedb> & b,
+  Eigen::PlainObjectBase<Derivedbc> & bc)
 {
   using namespace Eigen;
   using namespace std;
@@ -242,3 +252,8 @@ IGL_INLINE bool igl::boundary_conditions(
 
   return true;
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template instantiation
+template bool igl::boundary_conditions<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>&);
+#endif

+ 19 - 9
include/igl/boundary_conditions.h

@@ -36,16 +36,26 @@ namespace igl
   ///   some column of bc doesn't have a 0 (assuming bc has >1 columns)
   ///   some column of bc doesn't have a 1 (assuming bc has >1 columns)
   ///
+  template <
+    typename DerivedV,
+    typename DerivedEle,
+    typename DerivedC,
+    typename DerivedP,
+    typename DerivedBE,
+    typename DerivedCE,
+    typename DerivedCF,
+    typename Derivedb,
+    typename Derivedbc>
   IGL_INLINE bool boundary_conditions(
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & Ele,
-    const Eigen::MatrixXd & C,
-    const Eigen::VectorXi & P,
-    const Eigen::MatrixXi & BE,
-    const Eigen::MatrixXi & CE,
-    const Eigen::MatrixXi & CF,
-    Eigen::VectorXi & b,
-    Eigen::MatrixXd & bc);
+    const Eigen::MatrixBase<DerivedV> & V,
+    const Eigen::MatrixBase<DerivedEle> & Ele,
+    const Eigen::MatrixBase<DerivedC> & C,
+    const Eigen::MatrixBase<DerivedP> & P,
+    const Eigen::MatrixBase<DerivedBE> & BE,
+    const Eigen::MatrixBase<DerivedCE> & CE,
+    const Eigen::MatrixBase<DerivedCF> & CF,
+    Eigen::PlainObjectBase<Derivedb> & b,
+    Eigen::PlainObjectBase<Derivedbc> & bc);
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 2 - 2
include/igl/ceil.cpp

@@ -10,7 +10,7 @@
 
 template < typename DerivedX, typename DerivedY>
 IGL_INLINE void igl::ceil(
-  const Eigen::PlainObjectBase<DerivedX>& X,
+  const Eigen::MatrixBase<DerivedX>& X,
   Eigen::PlainObjectBase<DerivedY>& Y)
 {
   using namespace std;
@@ -20,5 +20,5 @@ IGL_INLINE void igl::ceil(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::ceil<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> >&);
+template void igl::ceil<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> >&);
 #endif

+ 1 - 1
include/igl/ceil.h

@@ -17,7 +17,7 @@ namespace igl
   /// @param[out] Y  m by n matrix of ceiled integers
   template < typename DerivedX, typename DerivedY>
   IGL_INLINE void ceil(
-    const Eigen::PlainObjectBase<DerivedX>& X,
+    const Eigen::MatrixBase<DerivedX>& X,
     Eigen::PlainObjectBase<DerivedY>& Y);
 }
 

+ 23 - 13
include/igl/circulation.cpp

@@ -9,12 +9,13 @@
 #include "list_to_matrix.h"
 #include <cassert>
 
+template <typename DerivedEMAP, typename DerivedEF, typename DerivedEI>
 IGL_INLINE std::vector<int> igl::circulation(
   const int e,
   const bool ccw,
-  const Eigen::VectorXi & EMAP,
-  const Eigen::MatrixXi & EF,
-  const Eigen::MatrixXi & EI)
+  const Eigen::MatrixBase<DerivedEMAP> & EMAP,
+  const Eigen::MatrixBase<DerivedEF> & EF,
+  const Eigen::MatrixBase<DerivedEI> & EI)
 {
   // prepare output
   std::vector<int> N;
@@ -56,28 +57,30 @@ IGL_INLINE std::vector<int> igl::circulation(
   return N;
 }
 
+template <typename DerivedEMAP, typename DerivedEF, typename DerivedEI, typename DerivedvN>
 IGL_INLINE void igl::circulation(
   const int e,
   const bool ccw,
-  const Eigen::VectorXi & EMAP,
-  const Eigen::MatrixXi & EF,
-  const Eigen::MatrixXi & EI,
-  Eigen::VectorXi & vN)
+  const Eigen::MatrixBase<DerivedEMAP> & EMAP,
+  const Eigen::MatrixBase<DerivedEF> & EF,
+  const Eigen::MatrixBase<DerivedEI> & EI,
+  Eigen::PlainObjectBase<DerivedvN> & vN)
 {
   std::vector<int> N = circulation(e,ccw,EMAP,EF,EI);
   igl::list_to_matrix(N,vN);
 }
 
+template <typename DerivedF, typename DerivedEMAP, typename DerivedEF, typename DerivedEI, typename Nv_type>
 IGL_INLINE void igl::circulation(
   const int e,
   const bool ccw,
-  const Eigen::MatrixXi & F,
-  const Eigen::VectorXi & EMAP,
-  const Eigen::MatrixXi & EF,
-  const Eigen::MatrixXi & EI,
+  const Eigen::MatrixBase<DerivedF> & F,
+  const Eigen::MatrixBase<DerivedEMAP> & EMAP,
+  const Eigen::MatrixBase<DerivedEF> & EF,
+  const Eigen::MatrixBase<DerivedEI> & EI,
   /*std::vector<int> & Ne,*/
-  std::vector<int> & Nv,
-  std::vector<int> & Nf)
+  std::vector<Nv_type> & Nv,
+  std::vector<Nv_type> & Nf)
 {
   //
   // for e --> (bf) and ccw=true
@@ -141,3 +144,10 @@ IGL_INLINE void igl::circulation(
     }
   }
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template specialization
+template std::vector<int, std::allocator<int>> igl::circulation<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>>(int, bool, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&);
+template void igl::circulation<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(int, bool, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::circulation<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(int, bool, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&);
+#endif

+ 16 - 13
include/igl/circulation.h

@@ -28,12 +28,13 @@ namespace igl
   /// @return list of faces touched by circulation (in cyclically order).
   ///   
   /// \see edge_flaps
+  template <typename DerivedEMAP, typename DerivedEF, typename DerivedEI>
   IGL_INLINE std::vector<int> circulation(
     const int e,
     const bool ccw,
-    const Eigen::VectorXi & EMAP,
-    const Eigen::MatrixXi & EF,
-    const Eigen::MatrixXi & EI);
+    const Eigen::MatrixBase<DerivedEMAP> & EMAP,
+    const Eigen::MatrixBase<DerivedEF> & EF,
+    const Eigen::MatrixBase<DerivedEI> & EI);
   /// Return list of faces around the end point of an edge. Assumes
   /// data-structures are built from an edge-manifold **closed** mesh.
   ///
@@ -49,13 +50,14 @@ namespace igl
   /// @param[out] #vN list of of faces touched by circulation (in cyclically order).
   ///   
   /// \see edge_flaps
+  template <typename DerivedEMAP, typename DerivedEF, typename DerivedEI, typename DerivedvN>
   IGL_INLINE void circulation(
     const int e,
     const bool ccw,
-    const Eigen::VectorXi & EMAP,
-    const Eigen::MatrixXi & EF,
-    const Eigen::MatrixXi & EI,
-    Eigen::VectorXi & vN);
+    const Eigen::MatrixBase<DerivedEMAP> & EMAP,
+    const Eigen::MatrixBase<DerivedEF> & EF,
+    const Eigen::MatrixBase<DerivedEI> & EI,
+    Eigen::PlainObjectBase<DerivedvN> & vN);
   /// Return list of faces around the end point of an edge. Assumes
   /// data-structures are built from an edge-manifold **closed** mesh.
   ///
@@ -72,16 +74,17 @@ namespace igl
   ///  @param[out] Nf  #Nf list of face indices
   ///   
   /// \see edge_flaps
+  template <typename DerivedF, typename DerivedEMAP, typename DerivedEF, typename DerivedEI, typename Nv_type>
   IGL_INLINE void circulation(
     const int e,
     const bool ccw,
-    const Eigen::MatrixXi & F,
-    const Eigen::VectorXi & EMAP,
-    const Eigen::MatrixXi & EF,
-    const Eigen::MatrixXi & EI,
+    const Eigen::MatrixBase<DerivedF> & F,
+    const Eigen::MatrixBase<DerivedEMAP> & EMAP,
+    const Eigen::MatrixBase<DerivedEF> & EF,
+    const Eigen::MatrixBase<DerivedEI> & EI,
     /*std::vector<int> & Ne,*/
-    std::vector<int> & Nv,
-    std::vector<int> & Nf);
+    std::vector<Nv_type> & Nv,
+    std::vector<Nv_type> & Nf);
 }
 
 #ifndef IGL_STATIC_LIBRARY

Різницю між файлами не показано, бо вона завелика
+ 61 - 83
include/igl/collapse_edge.cpp


+ 58 - 65
include/igl/collapse_edge.h

@@ -108,15 +108,23 @@ namespace igl
   ///   igl::circulation(d1,ccw,F,EMAP,EF,EI,Nv,Nf);
   /// }
   /// ```
+  template <
+    typename Derivedp,
+    typename DerivedV,
+    typename DerivedF,
+    typename DerivedE,
+    typename DerivedEMAP,
+    typename DerivedEF,
+    typename DerivedEI>
   IGL_INLINE bool collapse_edge(
     const int e,
-    const Eigen::RowVectorXd & p,
-    Eigen::MatrixXd & V,
-    Eigen::MatrixXi & F,
-    Eigen::MatrixXi & E,
-    Eigen::VectorXi & EMAP,
-    Eigen::MatrixXi & EF,
-    Eigen::MatrixXi & EI,
+    const Eigen::MatrixBase<Derivedp> & p,
+    Eigen::MatrixBase<DerivedV> & V,
+    Eigen::MatrixBase<DerivedF> & F,
+    Eigen::MatrixBase<DerivedE> & E,
+    Eigen::MatrixBase<DerivedEMAP> & EMAP,
+    Eigen::MatrixBase<DerivedEF> & EF,
+    Eigen::MatrixBase<DerivedEI> & EI,
     int & e1,
     int & e2,
     int & f1,
@@ -127,33 +135,32 @@ namespace igl
   /// @param[in] Nsf #Nsf face circulation around s
   /// @param[in] Ndv #Ndv vertex circulation around d
   /// @param[in] Ndf #Ndf face circulation around d
+  template
+  <
+    typename Derivedp,
+    typename DerivedV,
+    typename DerivedF,
+    typename DerivedE,
+    typename DerivedEMAP,
+    typename DerivedEF,
+    typename DerivedEI>
   IGL_INLINE bool collapse_edge(
     const int e,
-    const Eigen::RowVectorXd & p,
+    const Eigen::MatrixBase<Derivedp> & p,
     /*const*/ std::vector<int> & Nsv,
     const std::vector<int> & Nsf,
     /*const*/ std::vector<int> & Ndv,
     const std::vector<int> & Ndf,
-    Eigen::MatrixXd & V,
-    Eigen::MatrixXi & F,
-    Eigen::MatrixXi & E,
-    Eigen::VectorXi & EMAP,
-    Eigen::MatrixXi & EF,
-    Eigen::MatrixXi & EI,
-    int & e1,
-    int & e2,
-    int & f1,
-    int & f2);
-  /// \overload
-  IGL_INLINE bool collapse_edge(
-    const int e,
-    const Eigen::RowVectorXd & p,
-    Eigen::MatrixXd & V,
-    Eigen::MatrixXi & F,
-    Eigen::MatrixXi & E,
-    Eigen::VectorXi & EMAP,
-    Eigen::MatrixXi & EF,
-    Eigen::MatrixXi & EI);
+    Eigen::MatrixBase<DerivedV> & V,
+    Eigen::MatrixBase<DerivedF> & F,
+    Eigen::MatrixBase<DerivedE> & E,
+    Eigen::MatrixBase<DerivedEMAP> & EMAP,
+    Eigen::MatrixBase<DerivedEF> & EF,
+    Eigen::MatrixBase<DerivedEI> & EI,
+    int & a_e1,
+    int & a_e2,
+    int & a_f1,
+    int & a_f2);
   /// Collapse least-cost edge from a priority queue and update queue 
   ///
   /// See decimate.h for more details.
@@ -190,50 +197,36 @@ namespace igl
   /// @param[out] e2  index into E of edge collpased on right.
   /// @param[out] f1  index into F of face collpased on left.
   /// @param[out] f2  index into F of face collpased on right.
+  template <
+    typename CPFunc,
+    typename PreFunc,
+    typename PostFunc,
+    typename DerivedV,
+    typename DerivedF,
+    typename DerivedE,
+    typename DerivedEMAP,
+    typename DerivedEF,
+    typename DerivedEI,
+    typename DerivedEQ,
+    typename DerivedC>
   IGL_INLINE bool collapse_edge(
-    const decimate_cost_and_placement_callback & cost_and_placement,
-    const decimate_pre_collapse_callback       & pre_collapse,
-    const decimate_post_collapse_callback      & post_collapse,
-    Eigen::MatrixXd & V,
-    Eigen::MatrixXi & F,
-    Eigen::MatrixXi & E,
-    Eigen::VectorXi & EMAP,
-    Eigen::MatrixXi & EF,
-    Eigen::MatrixXi & EI,
+    const CPFunc & cost_and_placement,
+    const PreFunc & pre_collapse,
+    const PostFunc & post_collapse,
+    Eigen::MatrixBase<DerivedV> & V,
+    Eigen::MatrixBase<DerivedF> & F,
+    Eigen::MatrixBase<DerivedE> & E,
+    Eigen::MatrixBase<DerivedEMAP> & EMAP,
+    Eigen::MatrixBase<DerivedEF> & EF,
+    Eigen::MatrixBase<DerivedEI> & EI,
     igl::min_heap< std::tuple<double,int,int> > & Q,
-    Eigen::VectorXi & EQ,
-    Eigen::MatrixXd & C,
+    Eigen::MatrixBase<DerivedEQ> & EQ,
+    Eigen::MatrixBase<DerivedC> & C,
     int & e,
     int & e1,
     int & e2,
     int & f1,
     int & f2);
-  /// \overload
-  IGL_INLINE bool collapse_edge(
-    const decimate_cost_and_placement_callback & cost_and_placement,
-    Eigen::MatrixXd & V,
-    Eigen::MatrixXi & F,
-    Eigen::MatrixXi & E,
-    Eigen::VectorXi & EMAP,
-    Eigen::MatrixXi & EF,
-    Eigen::MatrixXi & EI,
-    igl::min_heap< std::tuple<double,int,int> > & Q,
-    Eigen::VectorXi & EQ,
-    Eigen::MatrixXd & C);
-  /// \overload
-  IGL_INLINE bool collapse_edge(
-    const decimate_cost_and_placement_callback & cost_and_placement,
-    const decimate_pre_collapse_callback       & pre_collapse,
-    const decimate_post_collapse_callback      & post_collapse,
-    Eigen::MatrixXd & V,
-    Eigen::MatrixXi & F,
-    Eigen::MatrixXi & E,
-    Eigen::VectorXi & EMAP,
-    Eigen::MatrixXi & EF,
-    Eigen::MatrixXi & EI,
-    igl::min_heap< std::tuple<double,int,int> > & Q,
-    Eigen::VectorXi & EQ,
-    Eigen::MatrixXd & C);
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 21 - 8
include/igl/collapse_edge_would_create_intersections.cpp

@@ -9,16 +9,24 @@
 #include <algorithm>
 #include <cassert>
 
+template <
+  typename Derivedp,
+  typename DerivedV,
+  typename DerivedF,
+  typename DerivedE,
+  typename DerivedEMAP,
+  typename DerivedEF,
+  typename DerivedEI>
 IGL_INLINE bool igl::collapse_edge_would_create_intersections(
   const int e,
-  const Eigen::RowVectorXd & p,
-  const Eigen::MatrixXd & V,
-  const Eigen::MatrixXi & F,
-  const Eigen::MatrixXi & E,
-  const Eigen::VectorXi & EMAP,
-  const Eigen::MatrixXi & EF,
-  const Eigen::MatrixXi & EI,
-  const igl::AABB<Eigen::MatrixXd,3> & tree,
+  const Eigen::MatrixBase<Derivedp> & p,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
+  const Eigen::MatrixBase<DerivedE> & E,
+  const Eigen::MatrixBase<DerivedEMAP> & EMAP,
+  const Eigen::MatrixBase<DerivedEF> & EF,
+  const Eigen::MatrixBase<DerivedEI> & EI,
+  const igl::AABB<DerivedV,3> & tree,
   const int inf_face_id)
 {
   // Merge two lists of integers
@@ -161,3 +169,8 @@ IGL_INLINE bool igl::collapse_edge_would_create_intersections(
   }
   return found_intersection;
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template instantiation
+template bool igl::collapse_edge_would_create_intersections<Eigen::Matrix<double, 1, -1, 1, 1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>>(int, Eigen::MatrixBase<Eigen::Matrix<double, 1, -1, 1, 1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3> const&, int);
+#endif

+ 17 - 8
include/igl/collapse_edge_would_create_intersections.h

@@ -26,16 +26,25 @@ namespace igl
   ///
   /// \see collapse_edge
   template <typename DerivedV, int DIM> class AABB;
+
+  template <
+    typename Derivedp,
+    typename DerivedV,
+    typename DerivedF,
+    typename DerivedE,
+    typename DerivedEMAP,
+    typename DerivedEF,
+    typename DerivedEI>
   IGL_INLINE bool collapse_edge_would_create_intersections(
     const int e,
-    const Eigen::RowVectorXd & p,
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & F,
-    const Eigen::MatrixXi & E,
-    const Eigen::VectorXi & EMAP,
-    const Eigen::MatrixXi & EF,
-    const Eigen::MatrixXi & EI,
-    const igl::AABB<Eigen::MatrixXd,3> & tree,
+    const Eigen::MatrixBase<Derivedp> & p,
+    const Eigen::MatrixBase<DerivedV> & V,
+    const Eigen::MatrixBase<DerivedF> & F,
+    const Eigen::MatrixBase<DerivedE> & E,
+    const Eigen::MatrixBase<DerivedEMAP> & EMAP,
+    const Eigen::MatrixBase<DerivedEF> & EF,
+    const Eigen::MatrixBase<DerivedEI> & EI,
+    const igl::AABB<DerivedV,3> & tree,
     const int inf_face_id = -1);
 }
 #ifndef IGL_STATIC_LIBRARY

+ 12 - 3
include/igl/collapse_small_triangles.cpp

@@ -17,11 +17,15 @@
 
 #include <iostream>
 
+template <
+  typename DerivedV,
+  typename DerivedF,
+  typename DerivedFF>
 void igl::collapse_small_triangles(
-  const Eigen::MatrixXd & V,
-  const Eigen::MatrixXi & F,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
   const double eps,
-  Eigen::MatrixXi & FF)
+  Eigen::PlainObjectBase<DerivedFF> & FF)
 {
   using namespace Eigen;
   using namespace std;
@@ -141,3 +145,8 @@ void igl::collapse_small_triangles(
   MatrixXi recFF = FF;
   return collapse_small_triangles(V,recFF,eps,FF);
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template instantiation
+template void igl::collapse_small_triangles<Eigen::MatrixXd, Eigen::MatrixXi, Eigen::MatrixXi> ( const Eigen::MatrixBase<Eigen::MatrixXd> &, const Eigen::MatrixBase<Eigen::MatrixXi> &, const double , Eigen::PlainObjectBase<Eigen::MatrixXi> & );
+#endif

+ 7 - 3
include/igl/collapse_small_triangles.h

@@ -24,11 +24,15 @@ namespace igl
   /// @param[out] FF  #FF by 3 list of triangle indices into V
   ///
   ///
+  template <
+    typename DerivedV,
+    typename DerivedF,
+    typename DerivedFF>
   void collapse_small_triangles(
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & F,
+    const Eigen::MatrixBase<DerivedV> & V,
+    const Eigen::MatrixBase<DerivedF> & F,
     const double eps,
-    Eigen::MatrixXi & FF);
+    Eigen::PlainObjectBase<DerivedFF> & FF);
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 5 - 5
include/igl/columnize.cpp

@@ -10,7 +10,7 @@
 
 template <typename DerivedA, typename DerivedB>
 IGL_INLINE void igl::columnize(
-  const Eigen::PlainObjectBase<DerivedA> & A,
+  const Eigen::MatrixBase<DerivedA> & A,
   const int k,
   const int dim,
   Eigen::PlainObjectBase<DerivedB> & B)
@@ -56,8 +56,8 @@ IGL_INLINE void igl::columnize(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::columnize<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&, int, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-template void igl::columnize<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&, int, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::columnize<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, int, int, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);
-template void igl::columnize<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, int, int, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1> >&);
+template void igl::columnize<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&, int, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
+template void igl::columnize<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&, int, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::columnize<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, int, int, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);
+template void igl::columnize<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, int, int, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1> >&);
 #endif

+ 1 - 1
include/igl/columnize.h

@@ -27,7 +27,7 @@ namespace igl
   /// \see transpose_blocks
   template <typename DerivedA, typename DerivedB>
   IGL_INLINE void columnize(
-    const Eigen::PlainObjectBase<DerivedA> & A,
+    const Eigen::MatrixBase<DerivedA> & A,
     const int k,
     const int dim,
     Eigen::PlainObjectBase<DerivedB> & B);

+ 4 - 3
include/igl/comb_cross_field.cpp

@@ -14,6 +14,7 @@
 #include "per_face_normals.h"
 #include "is_border_vertex.h"
 #include "rotation_matrix_from_directions.h"
+#include "PlainMatrix.h"
 
 #include "triangle_triangle_adjacency.h"
 
@@ -27,12 +28,12 @@ namespace igl {
     const Eigen::MatrixBase<DerivedF> &F;
     const Eigen::MatrixBase<DerivedV> &PD1;
     const Eigen::MatrixBase<DerivedV> &PD2;
-    DerivedV N;
+    PlainMatrix<DerivedV> N;
 
   private:
     // internal
-    DerivedF TT;
-    DerivedF TTi;
+    PlainMatrix<DerivedF> TT;
+    PlainMatrix<DerivedF> TTi;
 
 
   private:

+ 11 - 9
include/igl/comb_frame_field.cpp

@@ -14,18 +14,20 @@
 #include "comb_frame_field.h"
 #include "local_basis.h"
 #include "PI.h"
+#include "PlainMatrix.h"
 
 template <typename DerivedV, typename DerivedF, typename DerivedP>
-IGL_INLINE void igl::comb_frame_field(const Eigen::MatrixBase<DerivedV> &V,
-                                      const Eigen::MatrixBase<DerivedF> &F,
-                                      const Eigen::MatrixBase<DerivedP> &PD1,
-                                      const Eigen::MatrixBase<DerivedP> &PD2,
-                                      const Eigen::MatrixBase<DerivedP> &BIS1_combed,
-                                      const Eigen::MatrixBase<DerivedP> &BIS2_combed,
-                                      Eigen::PlainObjectBase<DerivedP> &PD1_combed,
-                                      Eigen::PlainObjectBase<DerivedP> &PD2_combed)
+IGL_INLINE void igl::comb_frame_field(
+  const Eigen::MatrixBase<DerivedV> &V,
+  const Eigen::MatrixBase<DerivedF> &F,
+  const Eigen::MatrixBase<DerivedP> &PD1,
+  const Eigen::MatrixBase<DerivedP> &PD2,
+  const Eigen::MatrixBase<DerivedP> &BIS1_combed,
+  const Eigen::MatrixBase<DerivedP> &BIS2_combed,
+  Eigen::PlainObjectBase<DerivedP> &PD1_combed,
+  Eigen::PlainObjectBase<DerivedP> &PD2_combed)
 {
-  DerivedV B1, B2, B3;
+  PlainMatrix<DerivedV,Eigen::Dynamic> B1, B2, B3;
   igl::local_basis(V,F,B1,B2,B3);
 
   PD1_combed.resize(BIS1_combed.rows(),3);

+ 4 - 3
include/igl/comb_line_field.cpp

@@ -15,6 +15,7 @@
 #include "rotation_matrix_from_directions.h"
 
 #include "triangle_triangle_adjacency.h"
+#include "PlainMatrix.h"
 
 namespace igl {
 template <typename DerivedV, typename DerivedF>
@@ -25,12 +26,12 @@ public:
     const Eigen::MatrixBase<DerivedV> &V;
     const Eigen::MatrixBase<DerivedF> &F;
     const Eigen::MatrixBase<DerivedV> &PD1;
-    DerivedV N;
+    PlainMatrix<DerivedV> N;
 
 private:
     // internal
-    DerivedF TT;
-    DerivedF TTi;
+    PlainMatrix<DerivedF> TT;
+    PlainMatrix<DerivedF> TTi;
 
 
 private:

+ 2 - 1
include/igl/compute_frame_field_bisectors.cpp

@@ -14,6 +14,7 @@
 #include "compute_frame_field_bisectors.h"
 #include "igl/local_basis.h"
 #include "PI.h"
+#include "PlainMatrix.h"
 
 template <typename DerivedV, typename DerivedF>
 IGL_INLINE void igl::compute_frame_field_bisectors(
@@ -71,7 +72,7 @@ IGL_INLINE void igl::compute_frame_field_bisectors(
                                                    Eigen::PlainObjectBase<DerivedV>& BIS1,
                                                    Eigen::PlainObjectBase<DerivedV>& BIS2)
 {
-  DerivedV B1, B2, B3;
+  PlainMatrix<DerivedV,Eigen::Dynamic> B1, B2, B3;
   igl::local_basis(V,F,B1,B2,B3);
 
   compute_frame_field_bisectors( V, F, B1, B2, PD1, PD2, BIS1, BIS2);

+ 7 - 7
include/igl/copyleft/cgal/BinaryWindingNumberOperations.h

@@ -32,7 +32,7 @@ namespace igl
         public:
           template<typename DerivedW>
             typename DerivedW::Scalar operator()(
-                const Eigen::PlainObjectBase<DerivedW>& /*win_nums*/) const {
+                const Eigen::MatrixBase<DerivedW>& /*win_nums*/) const {
               throw (std::runtime_error("not implemented!"));
             }
       };
@@ -43,7 +43,7 @@ namespace igl
         public:
           template<typename DerivedW>
           typename DerivedW::Scalar operator()(
-              const Eigen::PlainObjectBase<DerivedW>& win_nums) const 
+              const Eigen::MatrixBase<DerivedW>& win_nums) const 
           {
             for(int i = 0;i<win_nums.size();i++)
             {
@@ -59,7 +59,7 @@ namespace igl
         public:
           template<typename DerivedW>
           typename DerivedW::Scalar operator()(
-              const Eigen::PlainObjectBase<DerivedW>& win_nums) const 
+              const Eigen::MatrixBase<DerivedW>& win_nums) const 
           {
             for(int i = 0;i<win_nums.size();i++)
             {
@@ -75,7 +75,7 @@ namespace igl
         public:
           template<typename DerivedW>
           typename DerivedW::Scalar operator()(
-              const Eigen::PlainObjectBase<DerivedW>& win_nums) const 
+              const Eigen::MatrixBase<DerivedW>& win_nums) const 
           {
             assert(win_nums.size()>1);
             // Union of objects 1 through n-1
@@ -96,7 +96,7 @@ namespace igl
         public:
           template<typename DerivedW>
           typename DerivedW::Scalar operator()(
-              const Eigen::PlainObjectBase<DerivedW>& win_nums) const 
+              const Eigen::MatrixBase<DerivedW>& win_nums) const 
           {
             // If inside an odd number of objects
             int count = 0;
@@ -114,7 +114,7 @@ namespace igl
         public:
           template<typename DerivedW>
             typename DerivedW::Scalar operator()(
-                const Eigen::PlainObjectBase<DerivedW>& /*win_nums*/) const {
+                const Eigen::MatrixBase<DerivedW>& /*win_nums*/) const {
               return true;
             }
       };
@@ -139,7 +139,7 @@ namespace igl
         public:
           template<typename DerivedW>
             short operator()(
-                const Eigen::PlainObjectBase<DerivedW>& /*win_nums*/) const {
+                const Eigen::MatrixBase<DerivedW>& /*win_nums*/) const {
               throw std::runtime_error("Not implemented");
             }
       };

+ 1 - 1
include/igl/copyleft/cgal/CSGTree.h

@@ -126,7 +126,7 @@ namespace igl
           ///     converted to exact)
           /// @param[in] F  #F by 3 list of mesh face indices into V
           template <typename DerivedV>
-          CSGTree(const Eigen::PlainObjectBase<DerivedV> & V, const POBF & F)//:
+          CSGTree(const Eigen::MatrixBase<DerivedV> & V, const POBF & F)//:
           // Possible Eigen bug:
           // https://forum.kde.org/viewtopic.php?f=74&t=128414
             //m_V(V.template cast<ExactScalar>()),m_F(F)

+ 2 - 6
include/igl/copyleft/cgal/cell_adjacency.cpp

@@ -11,7 +11,7 @@
 
 template <typename DerivedC>
 IGL_INLINE void igl::copyleft::cgal::cell_adjacency(
-    const Eigen::PlainObjectBase<DerivedC>& per_patch_cells,
+    const Eigen::MatrixBase<DerivedC>& per_patch_cells,
     const size_t num_cells,
     std::vector<std::set<std::tuple<typename DerivedC::Scalar, bool, size_t> > >&
     adjacency_list) {
@@ -28,9 +28,5 @@ IGL_INLINE void igl::copyleft::cgal::cell_adjacency(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-// generated by autoexplicit.sh
-template void igl::copyleft::cgal::cell_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, unsigned long, std::vector<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> > >, std::allocator<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> > > > >&);
-#ifdef WIN32
-template void igl::copyleft::cgal::cell_adjacency<class Eigen::Matrix<int, -1, -1, 0, -1, -1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, unsigned __int64, class std::vector<class std::set<class std::tuple<int, bool, unsigned __int64>, struct std::less<class std::tuple<int, bool, unsigned __int64>>, class std::allocator<class std::tuple<int, bool, unsigned __int64>>>, class std::allocator<class std::set<class std::tuple<int, bool, unsigned __int64>, struct std::less<class std::tuple<int, bool, unsigned __int64>>, class std::allocator<class std::tuple<int, bool, unsigned __int64>>>>> &);
-#endif
+template void igl::copyleft::cgal::cell_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, size_t, std::vector<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t> > >, std::allocator<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t> > > > >&);
 #endif

+ 1 - 1
include/igl/copyleft/cgal/cell_adjacency.h

@@ -32,7 +32,7 @@ namespace igl
       ///   adjacency_list[j] will contain the entry {i, true, x}
       template < typename DerivedC >
       IGL_INLINE void cell_adjacency(
-          const Eigen::PlainObjectBase<DerivedC>& per_patch_cells,
+          const Eigen::MatrixBase<DerivedC>& per_patch_cells,
           const size_t num_cells,
           std::vector<std::set<std::tuple<typename DerivedC::Scalar, bool, size_t> > >&
           adjacency_list);

+ 55 - 33
include/igl/copyleft/cgal/closest_facet.cpp

@@ -15,6 +15,7 @@
 #include "order_facets_around_edge.h"
 #include "submesh_aabb_tree.h"
 #include "../../vertex_triangle_adjacency.h"
+#include "../../PlainMatrix.h"
 #include "../../LinSpaced.h"
 //#include "../../writePLY.h"
 
@@ -30,13 +31,13 @@ template<
   typename DerivedR,
   typename DerivedS >
 IGL_INLINE void igl::copyleft::cgal::closest_facet(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
-    const Eigen::PlainObjectBase<DerivedI>& I,
-    const Eigen::PlainObjectBase<DerivedP>& P,
-    const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
-    const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-    const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedI>& I,
+    const Eigen::MatrixBase<DerivedP>& P,
+    const Eigen::MatrixBase<DerivedEMAP>& EMAP,
+    const Eigen::MatrixBase<DeriveduEC>& uEC,
+    const Eigen::MatrixBase<DeriveduEE>& uEE,
     const std::vector<std::vector<size_t> > & VF,
     const std::vector<std::vector<size_t> > & VFi,
     const CGAL::AABB_tree<
@@ -198,7 +199,7 @@ IGL_INLINE void igl::copyleft::cgal::closest_facet(
     }
 
     Eigen::VectorXi order;
-    DerivedP pivot = P.row(query_idx).eval();
+    PlainMatrix<DerivedP,1> pivot = P.row(query_idx).eval();
     igl::copyleft::cgal::order_facets_around_edge(V, F, s, d,
       intersected_face_signed_indices,
       pivot, order);
@@ -350,16 +351,16 @@ IGL_INLINE void igl::copyleft::cgal::closest_facet(
       }
     }
     if (d == std::numeric_limits<size_t>::max()) {
-      Eigen::MatrixXd tmp_vertices(V.rows(), V.cols());
-      for (size_t i=0; i<V.rows(); i++) {
-        for (size_t j=0; j<V.cols(); j++) {
-          tmp_vertices(i,j) = CGAL::to_double(V(i,j));
-        }
-      }
-      Eigen::MatrixXi tmp_faces(adj_faces.size(), 3);
-      for (size_t i=0; i<adj_faces.size(); i++) {
-        tmp_faces.row(i) = F.row(adj_faces[i]);
-      }
+      //PlainMatrix<DerivedV,Eigen::Dynamic> tmp_vertices(V.rows(), V.cols());
+      //for (size_t i=0; i<V.rows(); i++) {
+      //  for (size_t j=0; j<V.cols(); j++) {
+      //    tmp_vertices(i,j) = CGAL::to_double(V(i,j));
+      //  }
+      //}
+      //PlainMatrix<DerivedF,Eigen::Dynamic,3> tmp_faces(adj_faces.size(), 3);
+      //for (size_t i=0; i<adj_faces.size(); i++) {
+      //  tmp_faces.row(i) = F.row(adj_faces[i]);
+      //}
       //igl::writePLY("debug.ply", tmp_vertices, tmp_faces, false);
       throw std::runtime_error("Invalid vertex neighborhood");
     }
@@ -436,13 +437,13 @@ template<
   typename DerivedR,
   typename DerivedS >
 IGL_INLINE void igl::copyleft::cgal::closest_facet(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
-    const Eigen::PlainObjectBase<DerivedI>& I,
-    const Eigen::PlainObjectBase<DerivedP>& P,
-    const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
-    const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-    const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedI>& I,
+    const Eigen::MatrixBase<DerivedP>& P,
+    const Eigen::MatrixBase<DerivedEMAP>& EMAP,
+    const Eigen::MatrixBase<DeriveduEC>& uEC,
+    const Eigen::MatrixBase<DeriveduEE>& uEE,
     Eigen::PlainObjectBase<DerivedR>& R,
     Eigen::PlainObjectBase<DerivedS>& S)
 {
@@ -480,12 +481,12 @@ template<
   typename DerivedR,
   typename DerivedS >
 IGL_INLINE void igl::copyleft::cgal::closest_facet(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
-    const Eigen::PlainObjectBase<DerivedP>& P,
-    const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
-    const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-    const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedP>& P,
+    const Eigen::MatrixBase<DerivedEMAP>& EMAP,
+    const Eigen::MatrixBase<DeriveduEC>& uEC,
+    const Eigen::MatrixBase<DeriveduEE>& uEE,
     Eigen::PlainObjectBase<DerivedR>& R,
     Eigen::PlainObjectBase<DerivedS>& S) {
   const size_t num_faces = F.rows();
@@ -497,7 +498,28 @@ IGL_INLINE void igl::copyleft::cgal::closest_facet(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 // generated by autoexplicit.sh
-template void igl::copyleft::cgal::closest_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<size_t, std::allocator<size_t> >, std::allocator<std::vector<size_t, std::allocator<size_t> > > > const&, std::vector<std::vector<size_t, std::allocator<size_t> >, std::allocator<std::vector<size_t, std::allocator<size_t> > > > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> > const&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> > const&, std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::closest_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 1, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, std::vector<std::vector<size_t, std::allocator<size_t>>, std::allocator<std::vector<size_t, std::allocator<size_t>>>> const&, std::vector<std::vector<size_t, std::allocator<size_t>>, std::allocator<std::vector<size_t, std::allocator<size_t>>>> const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3>>::iterator, CGAL::Boolean_tag<false>>, CGAL::Default>> const&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3>> const&, std::vector<bool, std::allocator<bool>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+// generated by autoexplicit.sh
+template void igl::copyleft::cgal::closest_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const&, std::vector<std::vector<size_t, std::allocator<size_t>>, std::allocator<std::vector<size_t, std::allocator<size_t>>>> const&, std::vector<std::vector<size_t, std::allocator<size_t>>, std::allocator<std::vector<size_t, std::allocator<size_t>>>> const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3>>::iterator, CGAL::Boolean_tag<false>>, CGAL::Default>> const&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3>> const&, std::vector<bool, std::allocator<bool>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+// generated by autoexplicit.sh
+template void igl::copyleft::cgal::closest_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(
+    Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, 
+    Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, 
+    Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, 
+    Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, 
+    Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, 
+    Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, 
+    Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<size_t, std::allocator<size_t> >, std::allocator<std::vector<size_t, std::allocator<size_t> > > > const&, std::vector<std::vector<size_t, std::allocator<size_t> >, std::allocator<std::vector<size_t, std::allocator<size_t> > > > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> > const&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> > const&, std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #include <cstdint>
-template void igl::copyleft::cgal::closest_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<size_t, std::allocator<size_t> >, std::allocator<std::vector<size_t, std::allocator<size_t> > > > const&, std::vector<std::vector<size_t, std::allocator<size_t> >, std::allocator<std::vector<size_t, std::allocator<size_t> > > > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> > const&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> > const&, std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::closest_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(
+Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, 
+Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, 
+Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, 
+Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, 
+Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, 
+Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, 
+Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<size_t, std::allocator<size_t> >, std::allocator<std::vector<size_t, std::allocator<size_t> > > > const&, std::vector<std::vector<size_t, std::allocator<size_t> >, std::allocator<std::vector<size_t, std::allocator<size_t> > > > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> > const&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> > const&, std::vector<bool, std::allocator<bool> > const&, 
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, 
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+
 #endif

+ 27 - 27
include/igl/copyleft/cgal/closest_facet.h

@@ -57,13 +57,13 @@ namespace igl
         typename DerivedR,
         typename DerivedS >
       IGL_INLINE void closest_facet(
-          const Eigen::PlainObjectBase<DerivedV>& V,
-          const Eigen::PlainObjectBase<DerivedF>& F,
-          const Eigen::PlainObjectBase<DerivedI>& I,
-          const Eigen::PlainObjectBase<DerivedP>& P,
-          const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
-          const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-          const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+          const Eigen::MatrixBase<DerivedV>& V,
+          const Eigen::MatrixBase<DerivedF>& F,
+          const Eigen::MatrixBase<DerivedI>& I,
+          const Eigen::MatrixBase<DerivedP>& P,
+          const Eigen::MatrixBase<DerivedEMAP>& EMAP,
+          const Eigen::MatrixBase<DeriveduEC>& uEC,
+          const Eigen::MatrixBase<DeriveduEE>& uEE,
           const std::vector<std::vector<size_t> > & VF,
           const std::vector<std::vector<size_t> > & VFi,
           const CGAL::AABB_tree<
@@ -88,13 +88,13 @@ namespace igl
         typename DerivedR,
         typename DerivedS >
       IGL_INLINE void closest_facet(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedI>& I,
-        const Eigen::PlainObjectBase<DerivedP>& P,
-        const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
-        const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-        const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedI>& I,
+        const Eigen::MatrixBase<DerivedP>& P,
+        const Eigen::MatrixBase<DerivedEMAP>& EMAP,
+        const Eigen::MatrixBase<DeriveduEC>& uEC,
+        const Eigen::MatrixBase<DeriveduEE>& uEE,
               Eigen::PlainObjectBase<DerivedR>& R,
               Eigen::PlainObjectBase<DerivedS>& S);
       /// \overload
@@ -108,12 +108,12 @@ namespace igl
         typename DerivedR,
         typename DerivedS >
       IGL_INLINE void closest_facet(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedP>& P,
-        const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
-        const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-        const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedP>& P,
+        const Eigen::MatrixBase<DerivedEMAP>& EMAP,
+        const Eigen::MatrixBase<DeriveduEC>& uEC,
+        const Eigen::MatrixBase<DeriveduEE>& uEE,
         Eigen::PlainObjectBase<DerivedR>& R,
         Eigen::PlainObjectBase<DerivedS>& S);
       /// \overload
@@ -129,13 +129,13 @@ namespace igl
         typename DerivedR,
         typename DerivedS >
       IGL_INLINE void closest_facet(
-          const Eigen::PlainObjectBase<DerivedV>& V,
-          const Eigen::PlainObjectBase<DerivedF>& F,
-          const Eigen::PlainObjectBase<DerivedI>& I,
-          const Eigen::PlainObjectBase<DerivedP>& P,
-          const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
-          const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-          const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+          const Eigen::MatrixBase<DerivedV>& V,
+          const Eigen::MatrixBase<DerivedF>& F,
+          const Eigen::MatrixBase<DerivedI>& I,
+          const Eigen::MatrixBase<DerivedP>& P,
+          const Eigen::MatrixBase<DerivedEMAP>& EMAP,
+          const Eigen::MatrixBase<DeriveduEC>& uEC,
+          const Eigen::MatrixBase<DeriveduEE>& uEE,
           const std::vector<std::vector<size_t> > & VF,
           const std::vector<std::vector<size_t> > & VFi,
           const CGAL::AABB_tree<

+ 12 - 12
include/igl/copyleft/cgal/component_inside_component.cpp

@@ -23,12 +23,12 @@
 
 template <typename DerivedV, typename DerivedF, typename DerivedI>
 IGL_INLINE bool igl::copyleft::cgal::component_inside_component(
-        const Eigen::PlainObjectBase<DerivedV>& V1,
-        const Eigen::PlainObjectBase<DerivedF>& F1,
-        const Eigen::PlainObjectBase<DerivedI>& I1,
-        const Eigen::PlainObjectBase<DerivedV>& V2,
-        const Eigen::PlainObjectBase<DerivedF>& F2,
-        const Eigen::PlainObjectBase<DerivedI>& I2) {
+        const Eigen::MatrixBase<DerivedV>& V1,
+        const Eigen::MatrixBase<DerivedF>& F1,
+        const Eigen::MatrixBase<DerivedI>& I1,
+        const Eigen::MatrixBase<DerivedV>& V2,
+        const Eigen::MatrixBase<DerivedF>& F2,
+        const Eigen::MatrixBase<DerivedI>& I2) {
     if (F1.rows() <= 0 || I1.rows() <= 0 || F2.rows() <= 0 || I2.rows() <= 0) {
         throw "Component inside test cannot be done on empty component!";
     }
@@ -46,10 +46,10 @@ IGL_INLINE bool igl::copyleft::cgal::component_inside_component(
 
 template<typename DerivedV, typename DerivedF>
 IGL_INLINE bool igl::copyleft::cgal::component_inside_component(
-        const Eigen::PlainObjectBase<DerivedV>& V1,
-        const Eigen::PlainObjectBase<DerivedF>& F1,
-        const Eigen::PlainObjectBase<DerivedV>& V2,
-        const Eigen::PlainObjectBase<DerivedF>& F2) {
+        const Eigen::MatrixBase<DerivedV>& V1,
+        const Eigen::MatrixBase<DerivedF>& F1,
+        const Eigen::MatrixBase<DerivedV>& V2,
+        const Eigen::MatrixBase<DerivedF>& F2) {
     if (F1.rows() <= 0 || F2.rows() <= 0) {
         throw "Component inside test cannot be done on empty component!";
     }
@@ -62,6 +62,6 @@ IGL_INLINE bool igl::copyleft::cgal::component_inside_component(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template bool igl::copyleft::cgal::component_inside_component<Eigen::Matrix<double, -1, -1, 0, -1, -1>,Eigen::Matrix<   int, -1, -1, 0, -1, -1>,Eigen::Matrix<   int, -1, -1, 0, -1, -1> > (Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&);
-template bool igl::copyleft::cgal::component_inside_component<Eigen::Matrix<double, -1, -1, 0, -1, -1>,Eigen::Matrix<   int, -1, -1, 0, -1, -1> > (Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&);
+template bool igl::copyleft::cgal::component_inside_component<Eigen::Matrix<double, -1, -1, 0, -1, -1>,Eigen::Matrix<   int, -1, -1, 0, -1, -1>,Eigen::Matrix<   int, -1, -1, 0, -1, -1> > (Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,Eigen::MatrixBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&,Eigen::MatrixBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&,Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,Eigen::MatrixBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&,Eigen::MatrixBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&);
+template bool igl::copyleft::cgal::component_inside_component<Eigen::Matrix<double, -1, -1, 0, -1, -1>,Eigen::Matrix<   int, -1, -1, 0, -1, -1> > (Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,Eigen::MatrixBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&,Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,Eigen::MatrixBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&);
 #endif

+ 10 - 10
include/igl/copyleft/cgal/component_inside_component.h

@@ -33,19 +33,19 @@ namespace igl {
       /// @return true iff (V1, F1, I1) is entirely inside of (V2, F2, I2).
       template<typename DerivedV, typename DerivedF, typename DerivedI>
           IGL_INLINE bool component_inside_component(
-                  const Eigen::PlainObjectBase<DerivedV>& V1,
-                  const Eigen::PlainObjectBase<DerivedF>& F1,
-                  const Eigen::PlainObjectBase<DerivedI>& I1,
-                  const Eigen::PlainObjectBase<DerivedV>& V2,
-                  const Eigen::PlainObjectBase<DerivedF>& F2,
-                  const Eigen::PlainObjectBase<DerivedI>& I2);
+                  const Eigen::MatrixBase<DerivedV>& V1,
+                  const Eigen::MatrixBase<DerivedF>& F1,
+                  const Eigen::MatrixBase<DerivedI>& I1,
+                  const Eigen::MatrixBase<DerivedV>& V2,
+                  const Eigen::MatrixBase<DerivedF>& F2,
+                  const Eigen::MatrixBase<DerivedI>& I2);
       /// \overload
       template<typename DerivedV, typename DerivedF>
           IGL_INLINE bool component_inside_component(
-                  const Eigen::PlainObjectBase<DerivedV>& V1,
-                  const Eigen::PlainObjectBase<DerivedF>& F1,
-                  const Eigen::PlainObjectBase<DerivedV>& V2,
-                  const Eigen::PlainObjectBase<DerivedF>& F2);
+                  const Eigen::MatrixBase<DerivedV>& V1,
+                  const Eigen::MatrixBase<DerivedF>& F1,
+                  const Eigen::MatrixBase<DerivedV>& V2,
+                  const Eigen::MatrixBase<DerivedF>& F2);
     }
   }
 }

+ 32 - 24
include/igl/copyleft/cgal/extract_cells.cpp

@@ -16,6 +16,7 @@
 #include "../../IGL_ASSERT.h"
 #include "../../parallel_for.h"
 #include "../../get_seconds.h"
+#include "../../PlainMatrix.h"
 #include "../../triangle_triangle_adjacency.h"
 #include "../../unique_edge_map.h"
 #include "../../C_STR.h"
@@ -40,18 +41,24 @@ template<
   typename DerivedF,
   typename DerivedC >
 IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
-  const Eigen::PlainObjectBase<DerivedV>& V,
-  const Eigen::PlainObjectBase<DerivedF>& F,
+  const Eigen::MatrixBase<DerivedV>& V,
+  const Eigen::MatrixBase<DerivedF>& F,
   Eigen::PlainObjectBase<DerivedC>& cells)
 {
+  using Index = typename DerivedF::Scalar;
+  static_assert(
+    std::is_same<Index, typename DerivedC::Scalar>::value,
+    "Index type mismatch");
+  using MatrixXI = Eigen::Matrix<Index, Eigen::Dynamic, Eigen::Dynamic>;
+  using VectorXI = Eigen::Matrix<Index, Eigen::Dynamic, 1>;
   const size_t num_faces = F.rows();
   // Construct edge adjacency
-  Eigen::MatrixXi E, uE;
-  Eigen::VectorXi EMAP;
-  Eigen::VectorXi uEC,uEE;
+  MatrixXI E, uE;
+  VectorXI EMAP;
+  VectorXI uEC,uEE;
   igl::unique_edge_map(F, E, uE, EMAP, uEC, uEE);
   // Cluster into manifold patches
-  Eigen::VectorXi P;
+  VectorXI P;
   igl::extract_manifold_patches(F, EMAP, uEC, uEE, P);
   // Extract cells
   DerivedC per_patch_cells;
@@ -76,13 +83,13 @@ template<
   typename DeriveduEE,
   typename DerivedC >
 IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
-  const Eigen::PlainObjectBase<DerivedV>& V,
-  const Eigen::PlainObjectBase<DerivedF>& F,
-  const Eigen::PlainObjectBase<DerivedP>& P,
-  const Eigen::PlainObjectBase<DeriveduE>& uE,
-  const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
-  const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-  const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+  const Eigen::MatrixBase<DerivedV>& V,
+  const Eigen::MatrixBase<DerivedF>& F,
+  const Eigen::MatrixBase<DerivedP>& P,
+  const Eigen::MatrixBase<DeriveduE>& uE,
+  const Eigen::MatrixBase<DerivedEMAP>& EMAP,
+  const Eigen::MatrixBase<DeriveduEC>& uEC,
+  const Eigen::MatrixBase<DeriveduEE>& uEE,
   Eigen::PlainObjectBase<DerivedC>& cells)
 {
   // Trivial base case
@@ -114,6 +121,7 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
 #endif
   const size_t num_faces = F.rows();
   typedef typename DerivedF::Scalar Index;
+  using VectorXI = Eigen::Matrix<Index, Eigen::Dynamic, 1>;
   assert(P.size() > 0);
   const size_t num_patches = P.maxCoeff()+1;
 
@@ -145,7 +153,7 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
   // and precompute data-structures for each component
   std::vector<std::vector<size_t> > VF,VFi;
   igl::vertex_triangle_adjacency(V.rows(), F, VF, VFi);
-  std::vector<Eigen::VectorXi> Is(num_components);
+  std::vector<VectorXI> Is(num_components);
   std::vector<
     CGAL::AABB_tree<
       CGAL::AABB_traits<
@@ -162,9 +170,9 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
   std::vector<std::vector<bool> > in_Is(num_components);
 
   // Find outer facets, their orientations and cells for each component
-  Eigen::VectorXi outer_facets(num_components);
-  Eigen::VectorXi outer_facet_orientation(num_components);
-  Eigen::VectorXi outer_cells(num_components);
+  VectorXI outer_facets(num_components);
+  VectorXI outer_facet_orientation(num_components);
+  VectorXI outer_cells(num_components);
   igl::parallel_for(num_components,[&](size_t i)
   {
     Is[i].resize(components[i].size());
@@ -194,8 +202,8 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
   if(num_components > 1)
   {
     // construct bounding boxes for each component
-    DerivedV bbox_min(num_components, 3);
-    DerivedV bbox_max(num_components, 3);
+    PlainMatrix<DerivedV,Eigen::Dynamic,3> bbox_min(num_components, 3);
+    PlainMatrix<DerivedV,Eigen::Dynamic,3> bbox_max(num_components, 3);
     // Assuming our mesh (in exact numbers) fits in the range of double.
     bbox_min.setConstant(std::numeric_limits<double>::max());
     bbox_max.setConstant(std::numeric_limits<double>::lowest());
@@ -247,7 +255,7 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
 
       // Get query points on each candidate component: barycenter of
       // outer-facet
-      DerivedV queries(num_candidate_comps, 3);
+      PlainMatrix<DerivedV,Eigen::Dynamic,3> queries(num_candidate_comps, 3);
       for (size_t j=0; j<num_candidate_comps; j++)
       {
         const size_t index = candidate_comps[j];
@@ -261,7 +269,7 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
       const auto& in_I = in_Is[i];
       const auto& triangles = triangle_lists[i];
 
-      Eigen::VectorXi closest_facets, closest_facet_orientations;
+      VectorXI closest_facets, closest_facet_orientations;
       closest_facet(
         V,
         F,
@@ -378,9 +386,9 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 // Explicit template instantiation
 // generated by autoexplicit.sh
-template size_t igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template size_t igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template size_t igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template size_t igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template size_t igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template size_t igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #ifdef WIN32
 #endif
 #endif

+ 9 - 9
include/igl/copyleft/cgal/extract_cells.h

@@ -42,13 +42,13 @@ namespace igl {
         typename DeriveduEE,
         typename DerivedC >
       IGL_INLINE size_t extract_cells(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedP>& P,
-        const Eigen::PlainObjectBase<DeriveduE>& uE,
-        const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
-        const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-        const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedP>& P,
+        const Eigen::MatrixBase<DeriveduE>& uE,
+        const Eigen::MatrixBase<DerivedEMAP>& EMAP,
+        const Eigen::MatrixBase<DeriveduEC>& uEC,
+        const Eigen::MatrixBase<DeriveduEE>& uEE,
         Eigen::PlainObjectBase<DerivedC>& cells);
       /// \overload
       template<
@@ -56,8 +56,8 @@ namespace igl {
         typename DerivedF,
         typename DerivedC >
       IGL_INLINE size_t extract_cells(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
         Eigen::PlainObjectBase<DerivedC>& cells);
     }
   }

+ 10 - 8
include/igl/copyleft/cgal/extract_cells_single_component.cpp

@@ -27,12 +27,12 @@ template<
   typename DeriveduEE,
   typename DerivedC>
 IGL_INLINE int igl::copyleft::cgal::extract_cells_single_component(
-  const Eigen::PlainObjectBase<DerivedV>& V,
-  const Eigen::PlainObjectBase<DerivedF>& F,
-  const Eigen::PlainObjectBase<DerivedP>& P,
-  const Eigen::PlainObjectBase<DeriveduE>& uE,
-  const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-  const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+  const Eigen::MatrixBase<DerivedV>& V,
+  const Eigen::MatrixBase<DerivedF>& F,
+  const Eigen::MatrixBase<DerivedP>& P,
+  const Eigen::MatrixBase<DeriveduE>& uE,
+  const Eigen::MatrixBase<DeriveduEC>& uEC,
+  const Eigen::MatrixBase<DeriveduEE>& uEE,
   Eigen::PlainObjectBase<DerivedC>& cells)
 {
 #ifdef EXTRACT_CELLS_SINGLE_COMPONENT_TIMING
@@ -214,6 +214,8 @@ IGL_INLINE int igl::copyleft::cgal::extract_cells_single_component(
 #ifdef IGL_STATIC_LIBRARY
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 // Explicit template instantiation
-template int igl::copyleft::cgal::extract_cells_single_component<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template int igl::copyleft::cgal::extract_cells_single_component<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template int igl::copyleft::cgal::extract_cells_single_component<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, 
+    Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template int igl::copyleft::cgal::extract_cells_single_component<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, 
+    Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 6 - 6
include/igl/copyleft/cgal/extract_cells_single_component.h

@@ -41,12 +41,12 @@ namespace igl {
         typename DeriveduEE,
         typename DerivedC >
       IGL_INLINE int extract_cells_single_component(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedP>& P,
-        const Eigen::PlainObjectBase<DeriveduE>& uE,
-        const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-        const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedP>& P,
+        const Eigen::MatrixBase<DeriveduE>& uE,
+        const Eigen::MatrixBase<DeriveduEC>& uEC,
+        const Eigen::MatrixBase<DeriveduEE>& uEE,
         Eigen::PlainObjectBase<DerivedC>& cells);
     }
   }

+ 5 - 5
include/igl/copyleft/cgal/extract_feature.cpp

@@ -17,8 +17,8 @@ template<
   typename DerivedF,
   typename Derivedfeature_edges >
 IGL_INLINE void igl::copyleft::cgal::extract_feature(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
     const double tol,
     Eigen::PlainObjectBase<Derivedfeature_edges>& feature_edges) {
 
@@ -38,10 +38,10 @@ template<
   typename Derivedfeature_edges
   >
 IGL_INLINE void igl::copyleft::cgal::extract_feature(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
     const double tol,
-    const Eigen::PlainObjectBase<DeriveduE>& uE,
+    const Eigen::MatrixBase<DeriveduE>& uE,
     const std::vector<std::vector<typename DeriveduE::Scalar> >& uE2E,
     Eigen::PlainObjectBase<Derivedfeature_edges>& feature_edges) 
 {

+ 5 - 5
include/igl/copyleft/cgal/extract_feature.h

@@ -41,8 +41,8 @@ namespace igl
         typename DerivedF,
         typename Derivedfeature_edges>
       IGL_INLINE void extract_feature(
-            const Eigen::PlainObjectBase<DerivedV>& V,
-            const Eigen::PlainObjectBase<DerivedF>& F,
+            const Eigen::MatrixBase<DerivedV>& V,
+            const Eigen::MatrixBase<DerivedF>& F,
             const double tol,
             Eigen::PlainObjectBase<Derivedfeature_edges>& feature_edges);
       // \overload
@@ -56,10 +56,10 @@ namespace igl
         typename Derivedfeature_edges
         >
       IGL_INLINE void extract_feature(
-            const Eigen::PlainObjectBase<DerivedV>& V,
-            const Eigen::PlainObjectBase<DerivedF>& F,
+            const Eigen::MatrixBase<DerivedV>& V,
+            const Eigen::MatrixBase<DerivedF>& F,
             const double tol,
-            const Eigen::PlainObjectBase<DeriveduE>& uE,
+            const Eigen::MatrixBase<DeriveduE>& uE,
             const std::vector<std::vector<typename DeriveduE::Scalar> >& uE2E,
             Eigen::PlainObjectBase<Derivedfeature_edges>& feature_edges);
     }

+ 13 - 13
include/igl/copyleft/cgal/half_space_box.cpp

@@ -3,12 +3,12 @@
 #include <CGAL/Point_3.h>
 #include <CGAL/Vector_3.h>
 
-template <typename DerivedV>
+template <typename DerivedV, typename Index>
 IGL_INLINE void igl::copyleft::cgal::half_space_box(
   const CGAL::Plane_3<CGAL::Epeck> & P,
   const Eigen::MatrixBase<DerivedV> & V,
   Eigen::Matrix<CGAL::Epeck::FT,8,3> & BV,
-  Eigen::Matrix<int,12,3> & BF)
+  Eigen::Matrix<Index,12,3> & BF)
 {
   typedef CGAL::Point_3<CGAL::Epeck> Point;
   typedef CGAL::Vector_3<CGAL::Epeck> Vector;
@@ -78,13 +78,13 @@ IGL_INLINE void igl::copyleft::cgal::half_space_box(
     7,0,4;
 }
 
-template <typename Derivedp, typename Derivedn, typename DerivedV>
+template <typename Derivedp, typename Derivedn, typename DerivedV, typename Index>
 IGL_INLINE void igl::copyleft::cgal::half_space_box(
   const Eigen::MatrixBase<Derivedp> & p,
   const Eigen::MatrixBase<Derivedn> & n,
   const Eigen::MatrixBase<DerivedV> & V,
   Eigen::Matrix<CGAL::Epeck::FT,8,3> & BV,
-  Eigen::Matrix<int,12,3> & BF)
+  Eigen::Matrix<Index,12,3> & BF)
 {
   typedef CGAL::Plane_3<CGAL::Epeck> Plane;
   typedef CGAL::Point_3<CGAL::Epeck> Point;
@@ -93,12 +93,12 @@ IGL_INLINE void igl::copyleft::cgal::half_space_box(
   return half_space_box(P,V,BV,BF);
 }
 
-template <typename Derivedequ, typename DerivedV>
+template <typename Derivedequ, typename DerivedV, typename Index>
 IGL_INLINE void igl::copyleft::cgal::half_space_box(
   const Eigen::MatrixBase<Derivedequ> & equ,
   const Eigen::MatrixBase<DerivedV> & V,
   Eigen::Matrix<CGAL::Epeck::FT,8,3> & BV,
-  Eigen::Matrix<int,12,3> & BF)
+  Eigen::Matrix<Index,12,3> & BF)
 {
   typedef CGAL::Plane_3<CGAL::Epeck> Plane;
   Plane P(equ(0),equ(1),equ(2),equ(3));
@@ -108,12 +108,12 @@ IGL_INLINE void igl::copyleft::cgal::half_space_box(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 // generated by autoexplicit.sh
-template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<double, 1, 4, 1, 1, 4>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<double, 1, 4, 1, 1, 4>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
-template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<double, -1, 3, 1, -1, 3> >(CGAL::Plane_3<CGAL::Epeck> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
+template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<double, 1, 4, 1, 1, 4>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, int>(Eigen::MatrixBase<Eigen::Matrix<double, 1, 4, 1, 1, 4>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
+template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<double, -1, 3, 1, -1, 3>, int>(CGAL::Plane_3<CGAL::Epeck> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
 // generated by autoexplicit.sh
-template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<float, -1, 3, 1, -1, 3> >(CGAL::Plane_3<CGAL::Epeck> const&, Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
-template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4>, Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
-template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4>, Eigen::Matrix<CGAL::Epeck::FT, -1, 4, 0, -1, 4> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 4, 0, -1, 4> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
-template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
-template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
+template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<float, -1, 3, 1, -1, 3>, int>(CGAL::Plane_3<CGAL::Epeck> const&, Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
+template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4>, Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, int>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
+template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4>, Eigen::Matrix<CGAL::Epeck::FT, -1, 4, 0, -1, 4>, int>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 4, 0, -1, 4> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
+template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, int>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, 4, 1, 1, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
+template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, int>(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<CGAL::Epeck::FT, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
 #endif

+ 6 - 6
include/igl/copyleft/cgal/half_space_box.h

@@ -19,30 +19,30 @@ namespace igl
       /// @param[in] V  #V by 3 list of vertex positions
       /// @param[out] BV  #BV by 3 list of box vertex positions
       /// @param[out] BF  #BF b3 list of box triangle indices into BV
-      template <typename DerivedV>
+      template <typename DerivedV, typename Index>
       IGL_INLINE void half_space_box(
         const CGAL::Plane_3<CGAL::Epeck> & P,
         const Eigen::MatrixBase<DerivedV> & V,
         Eigen::Matrix<CGAL::Epeck::FT,8,3> & BV,
-        Eigen::Matrix<int,12,3> & BF);
+        Eigen::Matrix<Index,12,3> & BF);
       /// \overload
       /// @param[in] p  3d point on plane
       /// @param[in] n  3d vector of normal of plane pointing away from inside
-      template <typename Derivedp, typename Derivedn, typename DerivedV>
+      template <typename Derivedp, typename Derivedn, typename DerivedV, typename Index>
       IGL_INLINE void half_space_box(
         const Eigen::MatrixBase<Derivedp> & p,
         const Eigen::MatrixBase<Derivedn> & n,
         const Eigen::MatrixBase<DerivedV> & V,
         Eigen::Matrix<CGAL::Epeck::FT,8,3> & BV,
-        Eigen::Matrix<int,12,3> & BF);
+        Eigen::Matrix<Index,12,3> & BF);
       /// \overload
       /// @param[in] equ  plane equation: a*x+b*y+c*z + d = 0
-      template <typename Derivedequ, typename DerivedV>
+      template <typename Derivedequ, typename DerivedV, typename Index>
       IGL_INLINE void half_space_box(
         const Eigen::MatrixBase<Derivedequ> & equ,
         const Eigen::MatrixBase<DerivedV> & V,
         Eigen::Matrix<CGAL::Epeck::FT,8,3> & BV,
-        Eigen::Matrix<int,12,3> & BF);
+        Eigen::Matrix<Index,12,3> & BF);
     }
   }
 }

+ 45 - 20
include/igl/copyleft/cgal/intersect_other.cpp

@@ -10,6 +10,7 @@
 #include "mesh_to_cgal_triangle_list.h"
 #include "remesh_intersections.h"
 #include "../../remove_unreferenced.h"
+#include "../../PlainMatrix.h"
 
 #ifndef IGL_FIRST_HIT_EXCEPTION
 #define IGL_FIRST_HIT_EXCEPTION 10
@@ -54,10 +55,10 @@ namespace igl
         typename DerivedJAB,
         typename DerivedIMAB>
       static IGL_INLINE bool intersect_other_helper(
-        const Eigen::PlainObjectBase<DerivedVA> & VA,
-        const Eigen::PlainObjectBase<DerivedFA> & FA,
-        const Eigen::PlainObjectBase<DerivedVB> & VB,
-        const Eigen::PlainObjectBase<DerivedFB> & FB,
+        const Eigen::MatrixBase<DerivedVA> & VA,
+        const Eigen::MatrixBase<DerivedFA> & FA,
+        const Eigen::MatrixBase<DerivedVB> & VB,
+        const Eigen::MatrixBase<DerivedFB> & FB,
         const RemeshSelfIntersectionsParam & params,
         Eigen::PlainObjectBase<DerivedIF> & IF,
         Eigen::PlainObjectBase<DerivedVVAB> & VVAB,
@@ -170,9 +171,9 @@ namespace igl
           // remesh_intersections(VA,FA,TA,offendingA,VVA,FFA,JA,IMA);
           // remesh_intersections(VB,FB,TB,offendingB,VVB,FFB,JB,IMB);
           // Combine mesh and offending maps
-          DerivedVA VAB(VA.rows()+VB.rows(),3);
+          PlainMatrix<DerivedVA,Eigen::Dynamic> VAB(VA.rows()+VB.rows(),3);
           VAB<<VA,VB;
-          DerivedFA FAB(FA.rows()+FB.rows(),3);
+          PlainMatrix<DerivedFA,Eigen::Dynamic> FAB(FA.rows()+FB.rows(),3);
           FAB<<FA,(FB.array()+VA.rows());
           Triangles TAB;
           TAB.reserve(TA.size()+TB.size());
@@ -219,10 +220,10 @@ template <
   typename DerivedJAB,
   typename DerivedIMAB>
 IGL_INLINE bool igl::copyleft::cgal::intersect_other(
-    const Eigen::PlainObjectBase<DerivedVA> & VA,
-    const Eigen::PlainObjectBase<DerivedFA> & FA,
-    const Eigen::PlainObjectBase<DerivedVB> & VB,
-    const Eigen::PlainObjectBase<DerivedFB> & FB,
+    const Eigen::MatrixBase<DerivedVA> & VA,
+    const Eigen::MatrixBase<DerivedFA> & FA,
+    const Eigen::MatrixBase<DerivedVB> & VB,
+    const Eigen::MatrixBase<DerivedFB> & FB,
     const RemeshSelfIntersectionsParam & params,
     Eigen::PlainObjectBase<DerivedIF> & IF,
     Eigen::PlainObjectBase<DerivedVVAB> & VVAB,
@@ -246,23 +247,47 @@ IGL_INLINE bool igl::copyleft::cgal::intersect_other(
   }
 }
 
+template <
+  typename DerivedVA,
+  typename DerivedFA,
+  typename DerivedVB,
+  typename DerivedFB,
+  typename DerivedIF>
 IGL_INLINE bool igl::copyleft::cgal::intersect_other(
-  const Eigen::MatrixXd & VA,
-  const Eigen::MatrixXi & FA,
-  const Eigen::MatrixXd & VB,
-  const Eigen::MatrixXi & FB,
+  const Eigen::MatrixBase<DerivedVA> & VA,
+  const Eigen::MatrixBase<DerivedFA> & FA,
+  const Eigen::MatrixBase<DerivedVB> & VB,
+  const Eigen::MatrixBase<DerivedFB> & FB,
   const bool first_only,
-  Eigen::MatrixXi & IF)
+  Eigen::PlainObjectBase<DerivedIF> & IF)
 {
-  Eigen::MatrixXd VVAB;
-  Eigen::MatrixXi FFAB;
-  Eigen::VectorXi JAB,IMAB;
+  PlainMatrix<DerivedVA,Eigen::Dynamic> VVAB;
+  PlainMatrix<DerivedFA,Eigen::Dynamic> FFAB;
+  Eigen::VectorXi JAB, IMAB;
   return intersect_other(
     VA,FA,VB,FB,{true,first_only},IF,VVAB,FFAB,JAB,IMAB);
 }
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template bool igl::copyleft::cgal::intersect_other<Eigen::Matrix<double, -1, -1, 0, -1, -1>,   Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>,   Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>,   Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1,   -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,   Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&,   Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,   Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&,   igl::copyleft::cgal::RemeshSelfIntersectionsParam const&,   Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&,   Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> >&,   Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&,   Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&,   Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template bool igl::copyleft::cgal::intersect_other<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::cgal::RemeshSelfIntersectionsParam const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template bool igl::copyleft::cgal::intersect_other<Eigen::Matrix<double, -1, -1, 0, -1, -1>,   Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>,   Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>,   Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1,   -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(
+Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,   
+Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&,   
+Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,   
+Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&,   igl::copyleft::cgal::RemeshSelfIntersectionsParam const&,   
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&,   
+Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> >&,   
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&,   
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&,   
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template bool igl::copyleft::cgal::intersect_other<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(
+Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, 
+Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, 
+Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, 
+Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::cgal::RemeshSelfIntersectionsParam const&, 
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, 
+Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> >&, 
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, 
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, 
+Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

+ 15 - 9
include/igl/copyleft/cgal/intersect_other.h

@@ -46,10 +46,10 @@ namespace igl
         typename DerivedJAB,
         typename DerivedIMAB>
       IGL_INLINE bool intersect_other(
-        const Eigen::PlainObjectBase<DerivedVA> & VA,
-        const Eigen::PlainObjectBase<DerivedFA> & FA,
-        const Eigen::PlainObjectBase<DerivedVB> & VB,
-        const Eigen::PlainObjectBase<DerivedFB> & FB,
+        const Eigen::MatrixBase<DerivedVA> & VA,
+        const Eigen::MatrixBase<DerivedFA> & FA,
+        const Eigen::MatrixBase<DerivedVB> & VB,
+        const Eigen::MatrixBase<DerivedFB> & FB,
         const RemeshSelfIntersectionsParam & params,
         Eigen::PlainObjectBase<DerivedIF> & IF,
         Eigen::PlainObjectBase<DerivedVVAB> & VVAB,
@@ -58,13 +58,19 @@ namespace igl
         Eigen::PlainObjectBase<DerivedIMAB> & IMAB);
       /// \overload
       /// @param[in] first_only  whether to only find first intersection
+      template <
+        typename DerivedVA,
+        typename DerivedFA,
+        typename DerivedVB,
+        typename DerivedFB,
+        typename DerivedIF>
       IGL_INLINE bool intersect_other(
-        const Eigen::MatrixXd & VA,
-        const Eigen::MatrixXi & FA,
-        const Eigen::MatrixXd & VB,
-        const Eigen::MatrixXi & FB,
+        const Eigen::MatrixBase<DerivedVA> & VA,
+        const Eigen::MatrixBase<DerivedFA> & FA,
+        const Eigen::MatrixBase<DerivedVB> & VB,
+        const Eigen::MatrixBase<DerivedFB> & FB,
         const bool first_only,
-        Eigen::MatrixXi & IF);
+        Eigen::PlainObjectBase<DerivedIF> & IF);
     }
   }
 }

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

@@ -61,7 +61,7 @@ IGL_INLINE bool igl::copyleft::cgal::intersect_with_half_space(
   Eigen::PlainObjectBase<DerivedJ > & J)
 {
   Eigen::Matrix<CGAL::Epeck::FT,8,3> BV;
-  Eigen::Matrix<int,12,3> BF;
+  Eigen::Matrix<typename DerivedF::Scalar,12,3> BF;
   half_space_box(P,V,BV,BF);
   // Disturbingly, (BV,BF) must be first argument
   const bool ret = mesh_boolean(BV,BF,V,F,MESH_BOOLEAN_TYPE_INTERSECT,VC,FC,J);

+ 3 - 3
include/igl/copyleft/cgal/is_self_intersecting.cpp

@@ -11,8 +11,8 @@ template <
   typename DerivedV,
   typename DerivedF>
 bool igl::copyleft::cgal::is_self_intersecting(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedF> & F)
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F)
 {
   assert(V.cols() == 3);
   assert(F.cols() == 3);
@@ -60,5 +60,5 @@ bool igl::copyleft::cgal::is_self_intersecting(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template bool igl::copyleft::cgal::is_self_intersecting<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
+template bool igl::copyleft::cgal::is_self_intersecting<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
 #endif

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

@@ -23,8 +23,8 @@ namespace igl
         typename DerivedV,
         typename DerivedF>
       bool is_self_intersecting(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F);
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF> & F);
     }
   }
 }

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

@@ -16,7 +16,7 @@ template<
   typename DerivedF
   >
 IGL_INLINE void igl::copyleft::cgal::lexicographic_triangulation(
-    const Eigen::PlainObjectBase<DerivedP>& P,
+    const Eigen::MatrixBase<DerivedP>& P,
     Eigen::PlainObjectBase<DerivedF>& F)
 {
   typedef typename DerivedP::Scalar Scalar;

+ 1 - 1
include/igl/copyleft/cgal/lexicographic_triangulation.h

@@ -28,7 +28,7 @@ namespace igl
         typename DerivedF
         >
       IGL_INLINE void lexicographic_triangulation(
-          const Eigen::PlainObjectBase<DerivedP>& P,
+          const Eigen::MatrixBase<DerivedP>& P,
           Eigen::PlainObjectBase<DerivedF>& F);
     }
   }

+ 7 - 5
include/igl/copyleft/cgal/mesh_boolean.cpp

@@ -16,6 +16,8 @@
 #include "remesh_self_intersections.h"
 #include "string_to_mesh_boolean_type.h"
 #include "../../combine.h"
+#include "../../PlainVector.h"
+#include "../../PlainMatrix.h"
 #include "../../cumsum.h"
 #include "../../extract_manifold_patches.h"
 #include "../../get_seconds.h"
@@ -139,8 +141,8 @@ IGL_INLINE bool igl::copyleft::cgal::mesh_boolean(
     Eigen::PlainObjectBase<DerivedFC > & FC,
     Eigen::PlainObjectBase<DerivedJ > & J)
 {
-  DerivedV VV;
-  DerivedF FF;
+  PlainMatrix<DerivedV,Eigen::Dynamic> VV;
+  PlainMatrix<DerivedF,Eigen::Dynamic> FF;
   Eigen::Matrix<size_t,Eigen::Dynamic,1> Vsizes,Fsizes;
   igl::combine(Vlist,Flist,VV,FF,Vsizes,Fsizes);
   return mesh_boolean(VV,FF,Fsizes,wind_num_op,keep,VC,FC,J);
@@ -160,8 +162,8 @@ IGL_INLINE bool igl::copyleft::cgal::mesh_boolean(
     Eigen::PlainObjectBase<DerivedFC > & FC,
     Eigen::PlainObjectBase<DerivedJ > & J)
 {
-  DerivedV VV;
-  DerivedF FF;
+  PlainMatrix<DerivedV,Eigen::Dynamic> VV;
+  PlainMatrix<DerivedF,Eigen::Dynamic> FF;
   Eigen::Matrix<size_t,Eigen::Dynamic,1> Vsizes,Fsizes;
   igl::combine(Vlist,Flist,VV,FF,Vsizes,Fsizes);
   std::function<int(const int, const int)> keep;
@@ -252,7 +254,7 @@ IGL_INLINE bool igl::copyleft::cgal::mesh_boolean(
   // labels(f) = i means that face f comes from mesh i
   Eigen::VectorXi labels(num_faces);
   // cumulative sizes
-  Derivedsizes cumsizes;
+  PlainVector<Derivedsizes,Eigen::Dynamic> cumsizes;
   igl::cumsum(sizes,1,cumsizes);
   const size_t num_inputs = sizes.size();
   std::transform(

+ 26 - 21
include/igl/copyleft/cgal/order_facets_around_edge.cpp

@@ -1,4 +1,5 @@
 #include "order_facets_around_edge.h"
+#include "../../PlainMatrix.h"
 #include <Eigen/Geometry>
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 
@@ -10,8 +11,8 @@ template<
   typename DerivedF,
   typename DerivedI >
 void igl::copyleft::cgal::order_facets_around_edge(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
     size_t s,
     size_t d, 
     const std::vector<int>& adj_faces,
@@ -276,15 +277,16 @@ void igl::copyleft::cgal::order_facets_around_edge(
 template<
   typename DerivedV,
   typename DerivedF,
+  typename Derivedpivot_point,
   typename DerivedI>
 IGL_INLINE
 void igl::copyleft::cgal::order_facets_around_edge(
-  const Eigen::PlainObjectBase<DerivedV>& V,
-  const Eigen::PlainObjectBase<DerivedF>& F,
+  const Eigen::MatrixBase<DerivedV>& V,
+  const Eigen::MatrixBase<DerivedF>& F,
   size_t s,
   size_t d, 
   const std::vector<int>& adj_faces,
-  const Eigen::PlainObjectBase<DerivedV>& pivot_point,
+  const Eigen::MatrixBase<Derivedpivot_point>& pivot_point,
   Eigen::PlainObjectBase<DerivedI>& order)
 {
   assert(V.cols() == 3);
@@ -331,7 +333,7 @@ void igl::copyleft::cgal::order_facets_around_edge(
   for (size_t i=0; i<N; i++) adj_order[i] = i;
   std::sort(adj_order.begin(), adj_order.end(), comp);
 
-  DerivedV vertices(num_faces + 2, 3);
+  PlainMatrix<DerivedV,Eigen::Dynamic> vertices(num_faces + 2, 3);
   for (size_t i=0; i<N; i++) 
   {
     const size_t fid = signed_index_to_index(adj_faces[adj_order[i]]);
@@ -341,7 +343,7 @@ void igl::copyleft::cgal::order_facets_around_edge(
   vertices.row(N+1) = V.row(s);
   vertices.row(N+2) = V.row(d);
 
-  DerivedF faces(num_faces, 3);
+  PlainMatrix<DerivedF,Eigen::Dynamic> faces(num_faces, 3);
   for (size_t i=0; i<N; i++)
   {
     if (adj_faces[adj_order[i]] < 0) 
@@ -398,20 +400,23 @@ void igl::copyleft::cgal::order_facets_around_edge(
 
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instantiation
-#include <cstdint>
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, bool);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, bool);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, bool);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, bool);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, bool);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, size_t, size_t, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, bool);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, 1, -1, 1, 1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, -1, 1, 1, -1>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, 1, 3, 1, 1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, 3, 1, 1, 3>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&, bool);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, 1, -1, 1, 1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, -1, 1, 1, -1>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, 1, 3, 1, 1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, 3, 1, 1, 3>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&, bool);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<CGAL::Epeck::FT, 1, 3, 1, 1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, 1, 3, 1, 1, 3>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&, bool);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 1, -1, 1, 1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, -1, 1, 1, -1>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&, bool);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3>> const&, size_t, size_t, std::vector<int, std::allocator<int>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&, bool);
 #ifdef WIN32
 #endif
 #endif

+ 6 - 5
include/igl/copyleft/cgal/order_facets_around_edge.h

@@ -40,8 +40,8 @@ namespace igl
         typename DerivedI >
       IGL_INLINE
       void order_facets_around_edge(
-          const Eigen::PlainObjectBase<DerivedV>& V,
-          const Eigen::PlainObjectBase<DerivedF>& F,
+          const Eigen::MatrixBase<DerivedV>& V,
+          const Eigen::MatrixBase<DerivedF>& F,
           size_t s, 
           size_t d, 
           const std::vector<int>& adj_faces,
@@ -57,15 +57,16 @@ namespace igl
       template<
         typename DerivedV,
         typename DerivedF,
+        typename Derivedpivot_point,
         typename DerivedI>
       IGL_INLINE
       void order_facets_around_edge(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
         size_t s, 
         size_t d, 
         const std::vector<int>& adj_faces,
-        const Eigen::PlainObjectBase<DerivedV>& pivot_point,
+        const Eigen::MatrixBase<Derivedpivot_point>& pivot_point,
         Eigen::PlainObjectBase<DerivedI>& order);
     }
   }

+ 17 - 17
include/igl/copyleft/cgal/order_facets_around_edges.cpp

@@ -24,10 +24,10 @@ IGL_INLINE
 typename std::enable_if<!std::is_same<typename DerivedV::Scalar,
 typename CGAL::Exact_predicates_exact_constructions_kernel::FT>::value, void>::type
 igl::copyleft::cgal::order_facets_around_edges(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedN>& N,
-        const Eigen::PlainObjectBase<DeriveduE>& uE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedN>& N,
+        const Eigen::MatrixBase<DeriveduE>& uE,
         const std::vector<std::vector<uE2EType> >& uE2E,
         std::vector<std::vector<uE2oEType> >& uE2oE,
         std::vector<std::vector<uE2CType > >& uE2C ) {
@@ -164,10 +164,10 @@ IGL_INLINE
 typename std::enable_if<std::is_same<typename DerivedV::Scalar,
 typename CGAL::Exact_predicates_exact_constructions_kernel::FT>::value, void>::type
 igl::copyleft::cgal::order_facets_around_edges(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedN>& N,
-        const Eigen::PlainObjectBase<DeriveduE>& uE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedN>& N,
+        const Eigen::MatrixBase<DeriveduE>& uE,
         const std::vector<std::vector<uE2EType> >& uE2E,
         std::vector<std::vector<uE2oEType> >& uE2oE,
         std::vector<std::vector<uE2CType > >& uE2C ) {
@@ -255,9 +255,9 @@ template<
     typename uE2oEType,
     typename uE2CType >
 IGL_INLINE void igl::copyleft::cgal::order_facets_around_edges(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DeriveduE>& uE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DeriveduE>& uE,
         const std::vector<std::vector<uE2EType> >& uE2E,
         std::vector<std::vector<uE2oEType> >& uE2oE,
         std::vector<std::vector<uE2CType > >& uE2C ) {
@@ -322,12 +322,12 @@ IGL_INLINE void igl::copyleft::cgal::order_facets_around_edges(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 #include <cstdint>
-template std::enable_if<!(std::is_same<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, CGAL::Epeck::FT >::value), void>::type igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int, int, bool>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
-template void igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, std::ptrdiff_t, std::ptrdiff_t, bool>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
-template void igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, std::ptrdiff_t, std::ptrdiff_t, bool>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
-template void igl::copyleft::cgal::order_facets_around_edges<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, bool>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
-template void igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, std::ptrdiff_t, std::ptrdiff_t, bool>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
-template void igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, std::ptrdiff_t, std::ptrdiff_t, bool>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
+template std::enable_if<!(std::is_same<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, CGAL::Epeck::FT >::value), void>::type igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int, int, bool>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
+template void igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, std::ptrdiff_t, std::ptrdiff_t, bool>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
+template void igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, std::ptrdiff_t, std::ptrdiff_t, bool>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
+template void igl::copyleft::cgal::order_facets_around_edges<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, bool>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
+template void igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, std::ptrdiff_t, std::ptrdiff_t, bool>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
+template void igl::copyleft::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, std::ptrdiff_t, std::ptrdiff_t, bool>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > > const&, std::vector<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> >, std::allocator<std::vector<std::ptrdiff_t, std::allocator<std::ptrdiff_t> > > >&, std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&);
 #ifdef WIN32
 #endif
 #endif

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

@@ -49,10 +49,10 @@ namespace igl
       typename std::enable_if<!std::is_same<typename DerivedV::Scalar,
       typename CGAL::Exact_predicates_exact_constructions_kernel::FT>::value, void>::type
       order_facets_around_edges(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedN>& N,
-        const Eigen::PlainObjectBase<DeriveduE>& uE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedN>& N,
+        const Eigen::MatrixBase<DeriveduE>& uE,
         const std::vector<std::vector<uE2EType> >& uE2E,
         std::vector<std::vector<uE2oEType> >& uE2oE,
         std::vector<std::vector<uE2CType > >& uE2C );
@@ -69,10 +69,10 @@ namespace igl
       typename std::enable_if<std::is_same<typename DerivedV::Scalar,
       typename CGAL::Exact_predicates_exact_constructions_kernel::FT>::value, void>::type
       order_facets_around_edges(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedN>& N,
-        const Eigen::PlainObjectBase<DeriveduE>& uE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedN>& N,
+        const Eigen::MatrixBase<DeriveduE>& uE,
         const std::vector<std::vector<uE2EType> >& uE2E,
         std::vector<std::vector<uE2oEType> >& uE2oE,
         std::vector<std::vector<uE2CType > >& uE2C );
@@ -87,9 +87,9 @@ namespace igl
           typename uE2oEType,
           typename uE2CType >
       IGL_INLINE void order_facets_around_edges(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DeriveduE>& uE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DeriveduE>& uE,
         const std::vector<std::vector<uE2EType> >& uE2E,
         std::vector<std::vector<uE2oEType> >& uE2oE,
         std::vector<std::vector<uE2CType > >& uE2C );

+ 16 - 15
include/igl/copyleft/cgal/outer_edge.cpp

@@ -19,12 +19,13 @@ template<
     typename DerivedA
     >
 IGL_INLINE void igl::copyleft::cgal::outer_edge(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F,
-        const Eigen::PlainObjectBase<DerivedI> & I,
-        IndexType & v1,
-        IndexType & v2,
-        Eigen::PlainObjectBase<DerivedA> & A) {
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
+  const Eigen::MatrixBase<DerivedI> & I,
+  IndexType & v1,
+  IndexType & v2,
+  Eigen::PlainObjectBase<DerivedA> & A) 
+{
     // Algorithm:
     //    Find an outer vertex first.
     //    Find the incident edge with largest abs slope when projected onto XY plane.
@@ -144,16 +145,16 @@ IGL_INLINE void igl::copyleft::cgal::outer_edge(
 // Explicit template instantiation
 // generated by autoexplicit.sh
 #include <cstdint>
-template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<CGAL::Epeck::FT,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT,-1,-1,0,-1,-1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,1,0,-1,1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
-template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<CGAL::Epeck::FT,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT,-1,-1,0,-1,-1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
-template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::PlainObjectBase<Eigen::Matrix<double,-1,-1,0,-1,-1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
-template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::PlainObjectBase<Eigen::Matrix<double,-1,-1,0,-1,-1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,1,0,-1,1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
-template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<double,-1,3,0,-1,3>,Eigen::Matrix<int,-1,3,0,-1,3>,Eigen::Matrix<int,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::PlainObjectBase<Eigen::Matrix<double,-1,3,0,-1,3> > const &,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,3,0,-1,3> > const &,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,1,0,-1,1> > const &,std::ptrdiff_t &,std::ptrdiff_t &,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > &);
-template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<double,-1,3,0,-1,3>,Eigen::Matrix<int,-1,3,0,-1,3>,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::PlainObjectBase<Eigen::Matrix<double,-1,3,0,-1,3> > const&,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,3,0,-1,3> > const&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
+template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<CGAL::Epeck::FT,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT,-1,-1,0,-1,-1> > const&,Eigen::MatrixBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,Eigen::MatrixBase<Eigen::Matrix<int,-1,1,0,-1,1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
+template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<CGAL::Epeck::FT,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT,-1,-1,0,-1,-1> > const&,Eigen::MatrixBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,Eigen::MatrixBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
+template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::MatrixBase<Eigen::Matrix<double,-1,-1,0,-1,-1> > const&,Eigen::MatrixBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,Eigen::MatrixBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
+template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::MatrixBase<Eigen::Matrix<double,-1,-1,0,-1,-1> > const&,Eigen::MatrixBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > const&,Eigen::MatrixBase<Eigen::Matrix<int,-1,1,0,-1,1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
+template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<double,-1,3,0,-1,3>,Eigen::Matrix<int,-1,3,0,-1,3>,Eigen::Matrix<int,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::MatrixBase<Eigen::Matrix<double,-1,3,0,-1,3> > const &,Eigen::MatrixBase<Eigen::Matrix<int,-1,3,0,-1,3> > const &,Eigen::MatrixBase<Eigen::Matrix<int,-1,1,0,-1,1> > const &,std::ptrdiff_t &,std::ptrdiff_t &,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > &);
+template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<double,-1,3,0,-1,3>,Eigen::Matrix<int,-1,3,0,-1,3>,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1>,std::ptrdiff_t,Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(Eigen::MatrixBase<Eigen::Matrix<double,-1,3,0,-1,3> > const&,Eigen::MatrixBase<Eigen::Matrix<int,-1,3,0,-1,3> > const&,Eigen::MatrixBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > const&,std::ptrdiff_t&,std::ptrdiff_t&,Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >&);
 
 #ifdef WIN32
-template void __cdecl igl::copyleft::cgal::outer_edge<class Eigen::Matrix<class CGAL::Epeck::FT,-1,-1,0,-1,-1>,class Eigen::Matrix<int,-1,-1,0,-1,-1>,class Eigen::Matrix<long,-1,1,0,-1,1>,std::ptrdiff_t,class Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Epeck::FT,-1,-1,0,-1,-1> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<long,-1,1,0,-1,1> > const &,std::ptrdiff_t &,std::ptrdiff_t &,class Eigen::PlainObjectBase<class Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > &);
-template void __cdecl igl::copyleft::cgal::outer_edge<class Eigen::Matrix<double,-1,3,0,-1,3>,class Eigen::Matrix<int,-1,3,0,-1,3>,class Eigen::Matrix<long,-1,1,0,-1,1>,std::ptrdiff_t,class Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(class Eigen::PlainObjectBase<class Eigen::Matrix<double,-1,3,0,-1,3> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,3,0,-1,3> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<long,-1,1,0,-1,1> > const &,std::ptrdiff_t &,std::ptrdiff_t &,class Eigen::PlainObjectBase<class Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > &);
+template void __cdecl igl::copyleft::cgal::outer_edge<class Eigen::Matrix<class CGAL::Epeck::FT,-1,-1,0,-1,-1>,class Eigen::Matrix<int,-1,-1,0,-1,-1>,class Eigen::Matrix<long,-1,1,0,-1,1>,std::ptrdiff_t,class Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(class Eigen::MatrixBase<class Eigen::Matrix<class CGAL::Epeck::FT,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<long,-1,1,0,-1,1> > const &,std::ptrdiff_t &,std::ptrdiff_t &,class Eigen::PlainObjectBase<class Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > &);
+template void __cdecl igl::copyleft::cgal::outer_edge<class Eigen::Matrix<double,-1,3,0,-1,3>,class Eigen::Matrix<int,-1,3,0,-1,3>,class Eigen::Matrix<long,-1,1,0,-1,1>,std::ptrdiff_t,class Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> >(class Eigen::MatrixBase<class Eigen::Matrix<double,-1,3,0,-1,3> > const &,class Eigen::MatrixBase<class Eigen::Matrix<int,-1,3,0,-1,3> > const &,class Eigen::MatrixBase<class Eigen::Matrix<long,-1,1,0,-1,1> > const &,std::ptrdiff_t &,std::ptrdiff_t &,class Eigen::PlainObjectBase<class Eigen::Matrix<std::ptrdiff_t,-1,1,0,-1,1> > &);
 #endif
 #endif

+ 3 - 3
include/igl/copyleft/cgal/outer_edge.h

@@ -38,9 +38,9 @@ namespace igl
           typename DerivedA
           >
       IGL_INLINE void outer_edge(
-              const Eigen::PlainObjectBase<DerivedV> & V,
-              const Eigen::PlainObjectBase<DerivedF> & F,
-              const Eigen::PlainObjectBase<DerivedI> & I,
+              const Eigen::MatrixBase<DerivedV> & V,
+              const Eigen::MatrixBase<DerivedF> & F,
+              const Eigen::MatrixBase<DerivedI> & I,
               IndexType & v1,
               IndexType & v2,
               Eigen::PlainObjectBase<DerivedA> & A);

+ 18 - 17
include/igl/copyleft/cgal/outer_facet.cpp

@@ -9,6 +9,7 @@
 #include "outer_facet.h"
 #include "outer_edge.h"
 #include "order_facets_around_edge.h"
+#include "../../PlainMatrix.h"
 #include <algorithm>
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 
@@ -19,9 +20,9 @@ template<
     typename IndexType
     >
 IGL_INLINE void igl::copyleft::cgal::outer_facet(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F,
-        const Eigen::PlainObjectBase<DerivedI> & I,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF> & F,
+        const Eigen::MatrixBase<DerivedI> & I,
         IndexType & f,
         bool & flipped) {
 
@@ -69,7 +70,7 @@ IGL_INLINE void igl::copyleft::cgal::outer_facet(
             adj_faces.begin(),
             convert_to_signed_index);
 
-    DerivedV pivot_point = V.row(s);
+    PlainMatrix<DerivedV,1> pivot_point = V.row(s);
     pivot_point(0, 0) += 1.0;
 
     Eigen::VectorXi order;
@@ -89,10 +90,10 @@ template<
     typename IndexType
     >
 IGL_INLINE void igl::copyleft::cgal::outer_facet(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F,
-        const Eigen::PlainObjectBase<DerivedN> & N,
-        const Eigen::PlainObjectBase<DerivedI> & I,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF> & F,
+        const Eigen::MatrixBase<DerivedN> & N,
+        const Eigen::MatrixBase<DerivedI> & I,
         IndexType & f,
         bool & flipped) {
     // Algorithm:
@@ -153,16 +154,16 @@ IGL_INLINE void igl::copyleft::cgal::outer_facet(
 // Explicit template instantiation
 // generated by autoexplicit.sh
 #include <cstdint>
-template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, bool&);
+template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, bool&);
 // generated by autoexplicit.sh
-template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int&, bool&);
-template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Index>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Index &, bool&);
-template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int&, bool&);
-template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Index>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Index&, bool&);
-template void igl::copyleft::cgal::outer_facet<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>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int&, bool&);
-template void igl::copyleft::cgal::outer_facet<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>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int&, bool&);
-//template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, int&, bool&);
-//template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, int&, bool&);
+template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, int>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int&, bool&);
+template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Index>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Index &, bool&);
+template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, int>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int&, bool&);
+template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Index>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Index&, bool&);
+template void igl::copyleft::cgal::outer_facet<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>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int&, bool&);
+template void igl::copyleft::cgal::outer_facet<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>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int&, bool&);
+//template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, int>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, int&, bool&);
+//template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, int>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, int&, bool&);
 #ifdef WIN32
 #endif
 #endif

+ 7 - 7
include/igl/copyleft/cgal/outer_facet.h

@@ -42,10 +42,10 @@ namespace igl
           typename IndexType
           >
       IGL_INLINE void outer_facet(
-              const Eigen::PlainObjectBase<DerivedV> & V,
-              const Eigen::PlainObjectBase<DerivedF> & F,
-              const Eigen::PlainObjectBase<DerivedN> & N,
-              const Eigen::PlainObjectBase<DerivedI> & I,
+              const Eigen::MatrixBase<DerivedV> & V,
+              const Eigen::MatrixBase<DerivedF> & F,
+              const Eigen::MatrixBase<DerivedN> & N,
+              const Eigen::MatrixBase<DerivedI> & I,
               IndexType & f,
               bool & flipped);
       /// \overload
@@ -56,9 +56,9 @@ namespace igl
           typename IndexType
           >
       IGL_INLINE void outer_facet(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F,
-        const Eigen::PlainObjectBase<DerivedI> & I,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF> & F,
+        const Eigen::MatrixBase<DerivedI> & I,
         IndexType & f,
         bool & flipped);
     }

+ 3 - 3
include/igl/copyleft/cgal/outer_hull.cpp

@@ -25,8 +25,8 @@ template <
   typename DerivedJ,
   typename Derivedflip>
 IGL_INLINE void igl::copyleft::cgal::outer_hull(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedF> & F,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
   Eigen::PlainObjectBase<DerivedHV> & HV,
   Eigen::PlainObjectBase<DerivedHF> & HF,
   Eigen::PlainObjectBase<DerivedJ> & J,
@@ -103,7 +103,7 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::copyleft::cgal::outer_hull<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_hull<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, 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> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #ifdef WIN32
 #endif
 #endif

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

@@ -33,8 +33,8 @@ namespace igl
         typename DerivedJ,
         typename Derivedflip>
       IGL_INLINE void outer_hull(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF> & F,
         Eigen::PlainObjectBase<DerivedHV> & HV,
         Eigen::PlainObjectBase<DerivedHF> & HF,
         Eigen::PlainObjectBase<DerivedJ> & J,

+ 14 - 13
include/igl/copyleft/cgal/outer_hull_legacy.cpp

@@ -27,6 +27,7 @@
 #include "../../unique_edge_map.h"
 #include "../../barycenter.h"
 #include "../../per_face_normals.h"
+#include "../../PlainMatrix.h"
 #include "../../sort_angles.h"
 #include <Eigen/Geometry>
 #include <vector>
@@ -44,8 +45,8 @@ template <
   typename DerivedJ,
   typename Derivedflip>
 IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedF> & F,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
   Eigen::PlainObjectBase<DerivedG> & G,
   Eigen::PlainObjectBase<DerivedJ> & J,
   Eigen::PlainObjectBase<Derivedflip> & flip)
@@ -336,16 +337,16 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
   // Is A inside B? Assuming A and B are consistently oriented but closed and
   // non-intersecting.
   const auto & has_overlapping_bbox = [](
-    const Eigen::PlainObjectBase<DerivedV> & V,
+    const Eigen::MatrixBase<DerivedV> & V,
     const MatrixXG & A,
     const MatrixXG & B)->bool
   {
     const auto & bounding_box = [](
-      const Eigen::PlainObjectBase<DerivedV> & V,
+      const Eigen::MatrixBase<DerivedV> & V,
       const MatrixXG & F)->
-        DerivedV
+        PlainMatrix<DerivedV,2,3>
     {
-      DerivedV BB(2,3);
+      PlainMatrix<DerivedV,2,3> BB(2,3);
       BB<<
          1e26,1e26,1e26,
         -1e26,-1e26,-1e26;
@@ -367,8 +368,8 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
     };
     // A lot of the time we're dealing with unrelated, distant components: cull
     // them.
-    DerivedV ABB = bounding_box(V,A);
-    DerivedV BBB = bounding_box(V,B);
+    PlainMatrix<DerivedV,2,3> ABB = bounding_box(V,A);
+    PlainMatrix<DerivedV,2,3> BBB = bounding_box(V,B);
     if( (BBB.row(0)-ABB.row(1)).maxCoeff()>0  ||
         (ABB.row(0)-BBB.row(1)).maxCoeff()>0 )
     {
@@ -398,10 +399,10 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
       }
     }
     const size_t num_unresolved_components = unresolved.size();
-    DerivedV query_points(num_unresolved_components, 3);
+    PlainMatrix<DerivedV,Eigen::Dynamic,3> query_points(num_unresolved_components, 3);
     for (size_t i=0; i<num_unresolved_components; i++) {
         const size_t oid = unresolved[i];
-        DerivedF f = vG[oid].row(0);
+        PlainMatrix<DerivedF,1> f = vG[oid].row(0);
         query_points(i,0) = (V(f(0,0), 0) + V(f(0,1), 0) + V(f(0,2), 0))/3.0;
         query_points(i,1) = (V(f(0,0), 1) + V(f(0,1), 1) + V(f(0,2), 1))/3.0;
         query_points(i,2) = (V(f(0,0), 2) + V(f(0,1), 2) + V(f(0,2), 2))/3.0;
@@ -444,9 +445,9 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 // generated by autoexplicit.sh
-template void igl::copyleft::cgal::outer_hull_legacy<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::outer_hull_legacy< Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > &, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > &, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > &);
-template void igl::copyleft::cgal::outer_hull_legacy<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::copyleft::cgal::outer_hull_legacy<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_hull_legacy< Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > &, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > &, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > &);
+template void igl::copyleft::cgal::outer_hull_legacy<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #ifdef WIN32
 #endif
 #endif

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

@@ -41,8 +41,8 @@ namespace igl
         typename DerivedJ,
         typename Derivedflip>
       IGL_INLINE void outer_hull_legacy(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF> & F,
         Eigen::PlainObjectBase<DerivedG> & G,
         Eigen::PlainObjectBase<DerivedJ> & J,
         Eigen::PlainObjectBase<Derivedflip> & flip);

+ 13 - 13
include/igl/copyleft/cgal/outer_vertex.cpp

@@ -19,9 +19,9 @@ template <
      typename DerivedA
      >
 IGL_INLINE void igl::copyleft::cgal::outer_vertex(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F,
-        const Eigen::PlainObjectBase<DerivedI> & I,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF> & F,
+        const Eigen::MatrixBase<DerivedI> & I,
         IndexType & v_index,
         Eigen::PlainObjectBase<DerivedA> & A)
 {
@@ -85,19 +85,19 @@ IGL_INLINE void igl::copyleft::cgal::outer_vertex(
 // Explicit template instantiation
 // generated by autoexplicit.sh
 #include <cstdint>
-template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
 // Linux
-template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_vertex<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, std::ptrdiff_t, Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::ptrdiff_t&, Eigen::PlainObjectBase<Eigen::Matrix<std::ptrdiff_t, -1, 1, 0, -1, 1> >&);
 #ifdef WIN32
 
-template void __cdecl igl::copyleft::cgal::outer_vertex<class Eigen::Matrix<class CGAL::Epeck::FT,-1,-1,0,-1,-1>,class Eigen::Matrix<int,-1,-1,0,-1,-1>,class Eigen::Matrix<long,-1,1,0,-1,1>,__int64,class Eigen::Matrix<__int64,-1,1,0,-1,1> >(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Epeck::FT,-1,-1,0,-1,-1> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<long,-1,1,0,-1,1> > const &,__int64 &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &);
-template void __cdecl igl::copyleft::cgal::outer_vertex<class Eigen::Matrix<double,-1,3,0,-1,3>,class Eigen::Matrix<int,-1,3,0,-1,3>,class Eigen::Matrix<int,-1,1,0,-1,1>,__int64,class Eigen::Matrix<__int64,-1,1,0,-1,1> >(class Eigen::PlainObjectBase<class Eigen::Matrix<double,-1,3,0,-1,3> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,3,0,-1,3> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,1,0,-1,1> > const &,__int64 &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &);
-template void __cdecl igl::copyleft::cgal::outer_vertex<class Eigen::Matrix<double,-1,3,0,-1,3>,class Eigen::Matrix<int,-1,3,0,-1,3>,class Eigen::Matrix<long,-1,1,0,-1,1>,__int64,class Eigen::Matrix<__int64,-1,1,0,-1,1> >(class Eigen::PlainObjectBase<class Eigen::Matrix<double,-1,3,0,-1,3> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,3,0,-1,3> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<long,-1,1,0,-1,1> > const &,__int64 &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &);
+template void __cdecl igl::copyleft::cgal::outer_vertex<class Eigen::Matrix<class CGAL::Epeck::FT,-1,-1,0,-1,-1>,class Eigen::Matrix<int,-1,-1,0,-1,-1>,class Eigen::Matrix<long,-1,1,0,-1,1>,__int64,class Eigen::Matrix<__int64,-1,1,0,-1,1> >(class Eigen::MatrixBase<class Eigen::Matrix<class CGAL::Epeck::FT,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<long,-1,1,0,-1,1> > const &,__int64 &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &);
+template void __cdecl igl::copyleft::cgal::outer_vertex<class Eigen::Matrix<double,-1,3,0,-1,3>,class Eigen::Matrix<int,-1,3,0,-1,3>,class Eigen::Matrix<int,-1,1,0,-1,1>,__int64,class Eigen::Matrix<__int64,-1,1,0,-1,1> >(class Eigen::MatrixBase<class Eigen::Matrix<double,-1,3,0,-1,3> > const &,class Eigen::MatrixBase<class Eigen::Matrix<int,-1,3,0,-1,3> > const &,class Eigen::MatrixBase<class Eigen::Matrix<int,-1,1,0,-1,1> > const &,__int64 &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &);
+template void __cdecl igl::copyleft::cgal::outer_vertex<class Eigen::Matrix<double,-1,3,0,-1,3>,class Eigen::Matrix<int,-1,3,0,-1,3>,class Eigen::Matrix<long,-1,1,0,-1,1>,__int64,class Eigen::Matrix<__int64,-1,1,0,-1,1> >(class Eigen::MatrixBase<class Eigen::Matrix<double,-1,3,0,-1,3> > const &,class Eigen::MatrixBase<class Eigen::Matrix<int,-1,3,0,-1,3> > const &,class Eigen::MatrixBase<class Eigen::Matrix<long,-1,1,0,-1,1> > const &,__int64 &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &);
 
 #endif
 #endif

+ 3 - 3
include/igl/copyleft/cgal/outer_vertex.h

@@ -36,9 +36,9 @@ namespace igl
           typename DerivedA
           >
       IGL_INLINE void outer_vertex(
-              const Eigen::PlainObjectBase<DerivedV> & V,
-              const Eigen::PlainObjectBase<DerivedF> & F,
-              const Eigen::PlainObjectBase<DerivedI> & I,
+              const Eigen::MatrixBase<DerivedV> & V,
+              const Eigen::MatrixBase<DerivedF> & F,
+              const Eigen::MatrixBase<DerivedI> & I,
               IndexType & v_index,
               Eigen::PlainObjectBase<DerivedA> & A);
     }

+ 3 - 3
include/igl/copyleft/cgal/peel_outer_hull_layers.cpp

@@ -23,8 +23,8 @@ template <
   typename DerivedI,
   typename Derivedflip>
 IGL_INLINE int igl::copyleft::cgal::peel_outer_hull_layers(
-  const Eigen::PlainObjectBase<DerivedV > & V,
-  const Eigen::PlainObjectBase<DerivedF > & F,
+  const Eigen::MatrixBase<DerivedV > & V,
+  const Eigen::MatrixBase<DerivedF > & F,
   Eigen::PlainObjectBase<DerivedI> & I,
   Eigen::PlainObjectBase<Derivedflip > & flip)
 {
@@ -118,5 +118,5 @@ IGL_INLINE int igl::copyleft::cgal::peel_outer_hull_layers(
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
 // generated by autoexplicit.sh
-template int igl::copyleft::cgal::peel_outer_hull_layers<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template int igl::copyleft::cgal::peel_outer_hull_layers<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

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

@@ -31,8 +31,8 @@ namespace igl
         typename DerivedI,
         typename Derivedflip>
       IGL_INLINE int peel_outer_hull_layers(
-        const Eigen::PlainObjectBase<DerivedV > & V,
-        const Eigen::PlainObjectBase<DerivedF > & F,
+        const Eigen::MatrixBase<DerivedV > & V,
+        const Eigen::MatrixBase<DerivedF > & F,
         Eigen::PlainObjectBase<DerivedI > & I,
         Eigen::PlainObjectBase<Derivedflip > & flip);
     }

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

@@ -9,8 +9,8 @@ typename DerivedV,
 typename DerivedF,
 typename DerivedW >
 IGL_INLINE size_t igl::copyleft::cgal::peel_winding_number_layers(
-        const Eigen::PlainObjectBase<DerivedV > & V,
-        const Eigen::PlainObjectBase<DerivedF > & F,
+        const Eigen::MatrixBase<DerivedV > & V,
+        const Eigen::MatrixBase<DerivedF > & F,
         Eigen::PlainObjectBase<DerivedW>& W) {
     const size_t num_faces = F.rows();
     Eigen::VectorXi labels(num_faces);

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

@@ -16,8 +16,8 @@ namespace igl {
           typename DerivedF,
           typename DerivedW >
       IGL_INLINE size_t peel_winding_number_layers(
-              const Eigen::PlainObjectBase<DerivedV > & V,
-              const Eigen::PlainObjectBase<DerivedF > & F,
+              const Eigen::MatrixBase<DerivedV > & V,
+              const Eigen::MatrixBase<DerivedF > & F,
               Eigen::PlainObjectBase<DerivedW>& W);
     }
   }

+ 3 - 3
include/igl/copyleft/cgal/piecewise_constant_winding_number.cpp

@@ -13,8 +13,8 @@
 
 template < typename DerivedV, typename DerivedF>
 IGL_INLINE bool igl::copyleft::cgal::piecewise_constant_winding_number(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedF> & F)
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F)
 {
   Eigen::Matrix<CGAL::Epeck::FT,Eigen::Dynamic,3> VV;
   Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,3> FF;
@@ -29,5 +29,5 @@ IGL_INLINE bool igl::copyleft::cgal::piecewise_constant_winding_number(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 // generated by autoexplicit.sh
-template bool igl::copyleft::cgal::piecewise_constant_winding_number<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
+template bool igl::copyleft::cgal::piecewise_constant_winding_number<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
 #endif

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

@@ -27,8 +27,8 @@ namespace igl
         typename DerivedV,
         typename DerivedF>
       IGL_INLINE bool piecewise_constant_winding_number(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF>& F);
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF>& F);
     }
   }
 }

+ 13 - 11
include/igl/copyleft/cgal/point_mesh_squared_distance.cpp

@@ -19,9 +19,9 @@ template <
   typename DerivedI,
   typename DerivedC>
 IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance(
-  const Eigen::PlainObjectBase<DerivedP> & P,
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedF> & F,
+  const Eigen::MatrixBase<DerivedP> & P,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
         Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
         Eigen::PlainObjectBase<DerivedI> & I,
         Eigen::PlainObjectBase<DerivedC> & C)
@@ -40,8 +40,8 @@ IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance(
 
 template <typename Kernel, typename DerivedV, typename DerivedF>
 IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance_precompute(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedF> & F,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
   CGAL::AABB_tree<
     CGAL::AABB_traits<Kernel, 
       CGAL::AABB_triangle_primitive<Kernel, 
@@ -88,7 +88,7 @@ template <
   typename DerivedI,
   typename DerivedC>
 IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance(
-  const Eigen::PlainObjectBase<DerivedP> & P,
+  const Eigen::MatrixBase<DerivedP> & P,
   const CGAL::AABB_tree<
     CGAL::AABB_traits<Kernel, 
       CGAL::AABB_triangle_primitive<Kernel, 
@@ -130,9 +130,11 @@ IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Epeck,   Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>,   Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1,   -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, 1, 0, -1, 1>,   Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>   >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3,   0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0,   -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>   > const&,   Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 1,   0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&,   Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Epeck, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<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> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Simple_cartesian<double>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Simple_cartesian<double>, CGAL::AABB_triangle_primitive<CGAL::Simple_cartesian<double>, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> > const&, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&);
-template void igl::copyleft::cgal::point_mesh_squared_distance_precompute<CGAL::Simple_cartesian<double>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Simple_cartesian<double>, CGAL::AABB_triangle_primitive<CGAL::Simple_cartesian<double>, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> >&, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >&);
-template void igl::copyleft::cgal::point_mesh_squared_distance_precompute<CGAL::Simple_cartesian<double>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Simple_cartesian<double>, CGAL::AABB_triangle_primitive<CGAL::Simple_cartesian<double>, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> >&, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >&);
+// generated by autoexplicit.sh
+template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Epeck, Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 1, 0, -1, 1>>&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Epeck,   Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>,   Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1,   -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, 1, 0, -1, 1>,   Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>   >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3,   0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0,   -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>   > const&,   Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 1,   0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&,   Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Epeck, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Simple_cartesian<double>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Simple_cartesian<double>, CGAL::AABB_triangle_primitive<CGAL::Simple_cartesian<double>, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> > const&, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&);
+template void igl::copyleft::cgal::point_mesh_squared_distance_precompute<CGAL::Simple_cartesian<double>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Simple_cartesian<double>, CGAL::AABB_triangle_primitive<CGAL::Simple_cartesian<double>, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> >&, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >&);
+template void igl::copyleft::cgal::point_mesh_squared_distance_precompute<CGAL::Simple_cartesian<double>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Simple_cartesian<double>, CGAL::AABB_triangle_primitive<CGAL::Simple_cartesian<double>, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> >&, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >&);
 #endif

+ 6 - 6
include/igl/copyleft/cgal/point_mesh_squared_distance.h

@@ -39,9 +39,9 @@ namespace igl
         typename DerivedI,
         typename DerivedC>
       IGL_INLINE void point_mesh_squared_distance(
-        const Eigen::PlainObjectBase<DerivedP> & P,
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F,
+        const Eigen::MatrixBase<DerivedP> & P,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF> & F,
               Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
               Eigen::PlainObjectBase<DerivedI> & I,
               Eigen::PlainObjectBase<DerivedC> & C);
@@ -60,8 +60,8 @@ namespace igl
         typename DerivedF
         >
       IGL_INLINE void point_mesh_squared_distance_precompute(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedF> & F,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedF> & F,
         CGAL::AABB_tree<
           CGAL::AABB_traits<Kernel, 
             CGAL::AABB_triangle_primitive<Kernel, 
@@ -87,7 +87,7 @@ namespace igl
         typename DerivedI,
         typename DerivedC>
       IGL_INLINE void point_mesh_squared_distance(
-        const Eigen::PlainObjectBase<DerivedP> & P,
+        const Eigen::MatrixBase<DerivedP> & P,
         const CGAL::AABB_tree<
           CGAL::AABB_traits<Kernel, 
             CGAL::AABB_triangle_primitive<Kernel, 

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

@@ -13,6 +13,7 @@
 #include "../../find.h"
 #include "../../placeholders.h"
 #include "../../parallel_for.h"
+#include "../../PlainMatrix.h"
 #include <vector>
 #include <Eigen/Core>
 
@@ -22,19 +23,19 @@ template <
   typename DerivedFB,
   typename DerivedD>
 IGL_INLINE void igl::copyleft::cgal::point_solid_signed_squared_distance(
-  const Eigen::PlainObjectBase<DerivedQ> & Q,
-  const Eigen::PlainObjectBase<DerivedVB> & VB,
-  const Eigen::PlainObjectBase<DerivedFB> & FB,
+  const Eigen::MatrixBase<DerivedQ> & Q,
+  const Eigen::MatrixBase<DerivedVB> & VB,
+  const Eigen::MatrixBase<DerivedFB> & FB,
   Eigen::PlainObjectBase<DerivedD> & D)
 {
   // compute unsigned distances
   Eigen::VectorXi I;
-  DerivedVB C;
+  PlainMatrix<DerivedVB,Eigen::Dynamic> C;
   point_mesh_squared_distance<CGAL::Epeck>(Q,VB,FB,D,I,C);
   // 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),igl::placeholders::all);
+  PlainMatrix<DerivedQ,Eigen::Dynamic> 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
@@ -53,5 +54,5 @@ IGL_INLINE void igl::copyleft::cgal::point_solid_signed_squared_distance(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::copyleft::cgal::point_solid_signed_squared_distance<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::point_solid_signed_squared_distance<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 1, 0, -1, 1> >&);
 #endif

+ 3 - 3
include/igl/copyleft/cgal/point_solid_signed_squared_distance.h

@@ -31,9 +31,9 @@ namespace igl
         typename DerivedFB,
         typename DerivedD>
       IGL_INLINE void point_solid_signed_squared_distance(
-        const Eigen::PlainObjectBase<DerivedQ> & Q,
-        const Eigen::PlainObjectBase<DerivedVB> & VB,
-        const Eigen::PlainObjectBase<DerivedFB> & FB,
+        const Eigen::MatrixBase<DerivedQ> & Q,
+        const Eigen::MatrixBase<DerivedVB> & VB,
+        const Eigen::MatrixBase<DerivedFB> & FB,
         Eigen::PlainObjectBase<DerivedD> & D);
     }
   }

+ 45 - 38
include/igl/copyleft/cgal/points_inside_component.cpp

@@ -8,6 +8,7 @@
 #include "points_inside_component.h"
 #include "../../LinSpaced.h"
 #include "../../parallel_for.h"
+#include "../../PlainMatrix.h"
 #include "order_facets_around_edge.h"
 #include "assign_scalar.h"
 
@@ -40,13 +41,13 @@ namespace igl {
 
             template<typename DerivedF, typename DerivedI>
             void extract_adj_faces(
-                    const Eigen::PlainObjectBase<DerivedF>& F,
-                    const Eigen::PlainObjectBase<DerivedI>& I,
+                    const Eigen::MatrixBase<DerivedF>& F,
+                    const Eigen::MatrixBase<DerivedI>& I,
                     const size_t s, const size_t d,
                     std::vector<int>& adj_faces) {
                 const size_t num_faces = I.rows();
                 for (size_t i=0; i<num_faces; i++) {
-                    Eigen::Vector3i f = F.row(I(i, 0));
+                    Eigen::Matrix<typename DerivedF::Scalar,3,1> f = F.row(I(i, 0));
                     if (((size_t)f[0] == s && (size_t)f[1] == d) ||
                         ((size_t)f[1] == s && (size_t)f[2] == d) ||
                         ((size_t)f[2] == s && (size_t)f[0] == d)) {
@@ -64,13 +65,13 @@ namespace igl {
 
             template<typename DerivedF, typename DerivedI>
             void extract_adj_vertices(
-                    const Eigen::PlainObjectBase<DerivedF>& F,
-                    const Eigen::PlainObjectBase<DerivedI>& I,
+                    const Eigen::MatrixBase<DerivedF>& F,
+                    const Eigen::MatrixBase<DerivedI>& I,
                     const size_t v, std::vector<int>& adj_vertices) {
                 std::set<size_t> unique_adj_vertices;
                 const size_t num_faces = I.rows();
                 for (size_t i=0; i<num_faces; i++) {
-                    Eigen::Vector3i f = F.row(I(i, 0));
+                    Eigen::Matrix<typename DerivedF::Scalar,3,1> f = F.row(I(i, 0));
                     if ((size_t)f[0] == v) {
                         unique_adj_vertices.insert(f[1]);
                         unique_adj_vertices.insert(f[2]);
@@ -90,9 +91,9 @@ namespace igl {
 
             template<typename DerivedV, typename DerivedF, typename DerivedI>
             bool determine_point_edge_orientation(
-                    const Eigen::PlainObjectBase<DerivedV>& V,
-                    const Eigen::PlainObjectBase<DerivedF>& F,
-                    const Eigen::PlainObjectBase<DerivedI>& I,
+                    const Eigen::MatrixBase<DerivedV>& V,
+                    const Eigen::MatrixBase<DerivedF>& F,
+                    const Eigen::MatrixBase<DerivedI>& I,
                     const Point_3& query, size_t s, size_t d) {
                 // Algorithm:
                 //
@@ -132,11 +133,12 @@ namespace igl {
                 const size_t num_adj_faces = adj_faces.size();
                 assert(num_adj_faces > 0);
 
-                DerivedV pivot_point(1, 3);
+                PlainMatrix<DerivedV,1> pivot_point(1, 3);
                 igl::copyleft::cgal::assign_scalar(query.x(), pivot_point(0, 0));
                 igl::copyleft::cgal::assign_scalar(query.y(), pivot_point(0, 1));
                 igl::copyleft::cgal::assign_scalar(query.z(), pivot_point(0, 2));
-                Eigen::VectorXi order;
+                using VectorXI = Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, 1>;
+                VectorXI order;
                 order_facets_around_edge(V, F, s, d,
                         adj_faces, pivot_point, order);
                 assert((size_t)order.size() == num_adj_faces);
@@ -155,9 +157,9 @@ namespace igl {
 
             template<typename DerivedV, typename DerivedF, typename DerivedI>
             bool determine_point_vertex_orientation(
-                    const Eigen::PlainObjectBase<DerivedV>& V,
-                    const Eigen::PlainObjectBase<DerivedF>& F,
-                    const Eigen::PlainObjectBase<DerivedI>& I,
+                    const Eigen::MatrixBase<DerivedV>& V,
+                    const Eigen::MatrixBase<DerivedF>& F,
+                    const Eigen::MatrixBase<DerivedI>& I,
                     const Point_3& query, size_t s) {
                 std::vector<int> adj_vertices;
                 extract_adj_vertices(F, I, s, adj_vertices);
@@ -222,14 +224,14 @@ namespace igl {
 
             template<typename DerivedV, typename DerivedF, typename DerivedI>
             bool determine_point_face_orientation(
-                    const Eigen::PlainObjectBase<DerivedV>& V,
-                    const Eigen::PlainObjectBase<DerivedF>& F,
-                    const Eigen::PlainObjectBase<DerivedI>& I,
+                    const Eigen::MatrixBase<DerivedV>& V,
+                    const Eigen::MatrixBase<DerivedF>& F,
+                    const Eigen::MatrixBase<DerivedI>& I,
                     const Point_3& query, size_t fid) {
                 // Algorithm: A point is on the inside of a face if the
                 // tetrahedron formed by them is negatively oriented.
 
-                Eigen::Vector3i f = F.row(I(fid, 0));
+                Eigen::Matrix<typename DerivedF::Scalar,3,1> f = F.row(I(fid, 0));
                 const Point_3 v0(V(f[0], 0), V(f[0], 1), V(f[0], 2));
                 const Point_3 v1(V(f[1], 0), V(f[1], 1), V(f[1], 2));
                 const Point_3 v2(V(f[2], 0), V(f[2], 1), V(f[2], 2));
@@ -247,10 +249,10 @@ namespace igl {
 template<typename DerivedV, typename DerivedF, typename DerivedI,
     typename DerivedP, typename DerivedB>
 IGL_INLINE void igl::copyleft::cgal::points_inside_component(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedI>& I,
-        const Eigen::PlainObjectBase<DerivedP>& P,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedI>& I,
+        const Eigen::MatrixBase<DerivedP>& P,
         Eigen::PlainObjectBase<DerivedB>& inside) {
     using namespace igl::copyleft::cgal::points_inside_component_helper;
     if (F.rows() <= 0 || I.rows() <= 0) {
@@ -260,7 +262,7 @@ IGL_INLINE void igl::copyleft::cgal::points_inside_component(
     const size_t num_faces = I.rows();
     std::vector<Triangle> triangles;
     for (size_t i=0; i<num_faces; i++) {
-        const Eigen::Vector3i f = F.row(I(i, 0));
+        const Eigen::Matrix<typename DerivedF::Scalar,3,1> f = F.row(I(i, 0));
         triangles.emplace_back(
                 Point_3(V(f[0], 0), V(f[0], 1), V(f[0], 2)),
                 Point_3(V(f[1], 0), V(f[1], 1), V(f[1], 2)),
@@ -275,7 +277,7 @@ IGL_INLINE void igl::copyleft::cgal::points_inside_component(
     enum ElementType { VERTEX, EDGE, FACE };
     auto determine_element_type = [&](
             size_t fid, const Point_3& p, size_t& element_index) -> ElementType{
-        const Eigen::Vector3i f = F.row(I(fid, 0));
+        const Eigen::Matrix<typename DerivedF::Scalar,3,1> f = F.row(I(fid, 0));
         const Point_3 p0(V(f[0], 0), V(f[0], 1), V(f[0], 2));
         const Point_3 p1(V(f[1], 0), V(f[1], 1), V(f[1], 2));
         const Point_3 p2(V(f[2], 0), V(f[2], 1), V(f[2], 2));
@@ -305,7 +307,7 @@ IGL_INLINE void igl::copyleft::cgal::points_inside_component(
             case VERTEX:
                 {
                     const size_t s = F(I(fid, 0), element_index);
-                    inside(i,0) = determine_point_vertex_orientation(
+                    inside(i) = determine_point_vertex_orientation(
                             V, F, I, query, s);
                 }
                 break;
@@ -313,12 +315,12 @@ IGL_INLINE void igl::copyleft::cgal::points_inside_component(
                 {
                     const size_t s = F(I(fid, 0), (element_index+1)%3);
                     const size_t d = F(I(fid, 0), (element_index+2)%3);
-                    inside(i,0) = determine_point_edge_orientation(
+                    inside(i) = determine_point_edge_orientation(
                             V, F, I, query, s, d);
                 }
                 break;
             case FACE:
-                inside(i,0) = determine_point_face_orientation(V, F, I, query, fid);
+                inside(i) = determine_point_face_orientation(V, F, I, query, fid);
                 break;
             default:
                 throw "Unknown closest element type!";
@@ -329,21 +331,26 @@ IGL_INLINE void igl::copyleft::cgal::points_inside_component(
 template<typename DerivedV, typename DerivedF, typename DerivedP,
     typename DerivedB>
 IGL_INLINE void igl::copyleft::cgal::points_inside_component(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedP>& P,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedP>& P,
         Eigen::PlainObjectBase<DerivedB>& inside) {
-    Eigen::VectorXi I = igl::LinSpaced<Eigen::VectorXi>(F.rows(), 0, F.rows()-1);
+    using VectorXI = Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, 1>;
+    VectorXI I = igl::LinSpaced<VectorXI>(F.rows(), 0, F.rows()-1);
     igl::copyleft::cgal::points_inside_component(V, F, I, P, inside);
 }
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::copyleft::cgal::points_inside_component< Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1> > ( Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> >&);
-template void igl::copyleft::cgal::points_inside_component< Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1> > ( Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix< int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> >&);
-template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<double, -1,   -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>,   Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>,   Eigen::Array<bool, -1, 1, 0, -1, 1>   >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,   Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&,   Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3,   0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1>   >&);
-template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+// generated by autoexplicit.sh
+template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+// generated by autoexplicit.sh
+template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>&);
+template void igl::copyleft::cgal::points_inside_component< Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1> > ( Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> >&);
+template void igl::copyleft::cgal::points_inside_component< Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<   int, -1, -1, 0, -1, -1> > ( Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix< int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<   int, -1, -1, 0, -1, -1> >&);
+template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<double, -1,   -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>,   Eigen::Matrix<CGAL::Epeck::FT, -1, 3, 0, -1, 3>,   Eigen::Array<bool, -1, 1, 0, -1, 1>   >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&,   Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&,   Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, 3,   0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1>   >&);
+template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::points_inside_component<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

+ 7 - 7
include/igl/copyleft/cgal/points_inside_component.h

@@ -38,10 +38,10 @@ namespace igl
         typename DerivedP,
         typename DerivedB>
       IGL_INLINE void points_inside_component(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedI>& I,
-        const Eigen::PlainObjectBase<DerivedP>& P,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedI>& I,
+        const Eigen::MatrixBase<DerivedP>& P,
         Eigen::PlainObjectBase<DerivedB>& inside);
       /// \overload
       template<
@@ -50,9 +50,9 @@ namespace igl
         typename DerivedP,
         typename DerivedB>
       IGL_INLINE void points_inside_component(
-          const Eigen::PlainObjectBase<DerivedV>& V,
-          const Eigen::PlainObjectBase<DerivedF>& F,
-          const Eigen::PlainObjectBase<DerivedP>& P,
+          const Eigen::MatrixBase<DerivedV>& V,
+          const Eigen::MatrixBase<DerivedF>& F,
+          const Eigen::MatrixBase<DerivedP>& P,
           Eigen::PlainObjectBase<DerivedB>& inside);
     }
   }

+ 33 - 26
include/igl/copyleft/cgal/propagate_winding_numbers.cpp

@@ -35,11 +35,15 @@ template<
   typename DerivedL,
   typename DerivedW>
 IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
-    const Eigen::PlainObjectBase<DerivedL>& labels,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedL>& labels,
     Eigen::PlainObjectBase<DerivedW>& W) 
 {
+  using Index = typename DerivedF::Scalar;
+  using MatrixXI = Eigen::Matrix<Index, Eigen::Dynamic, Eigen::Dynamic>;
+  using VectorXI = Eigen::Matrix<Index, Eigen::Dynamic, 1>;
+
 #ifdef PROPAGATE_WINDING_NUMBER_TIMING
   const auto & tictoc = []() -> double
   {
@@ -55,11 +59,11 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
   tictoc();
 #endif
 
-  Eigen::MatrixXi E, uE;
-  Eigen::VectorXi EMAP, uEC, uEE;
+  MatrixXI E, uE;
+  VectorXI EMAP, uEC, uEE;
   igl::unique_edge_map(F, E, uE, EMAP, uEC, uEE);
 
-  Eigen::VectorXi P;
+  VectorXI P;
   const size_t num_patches = igl::extract_manifold_patches(F,EMAP,uEC,uEE,P);
 
   DerivedW per_patch_cells;
@@ -88,18 +92,21 @@ template<
   typename DerivedL,
   typename DerivedW>
 IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
-    const Eigen::PlainObjectBase<DeriveduE>& uE,
-    const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-    const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
+    const Eigen::MatrixBase<DeriveduE>& uE,
+    const Eigen::MatrixBase<DeriveduEC>& uEC,
+    const Eigen::MatrixBase<DeriveduEE>& uEE,
     const size_t num_patches,
-    const Eigen::PlainObjectBase<DerivedP>& P,
+    const Eigen::MatrixBase<DerivedP>& P,
     const size_t num_cells,
-    const Eigen::PlainObjectBase<DerivedC>& C,
-    const Eigen::PlainObjectBase<DerivedL>& labels,
+    const Eigen::MatrixBase<DerivedC>& C,
+    const Eigen::MatrixBase<DerivedL>& labels,
     Eigen::PlainObjectBase<DerivedW>& W)
 {
+  using Index = typename DerivedF::Scalar;
+  using MatrixXI = Eigen::Matrix<Index, Eigen::Dynamic, Eigen::Dynamic>;
+  using VectorXI = Eigen::Matrix<Index, Eigen::Dynamic, 1>;
 #ifdef PROPAGATE_WINDING_NUMBER_TIMING
   const auto & tictoc = []() -> double
   {
@@ -131,7 +138,7 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
   log_time("cell_connectivity");
 #endif
 
-#ifndef NDEBUG
+#ifdef IGL_COPYLEFT_CGAL_PROPAGATE_WINDING_NUMBERS_DEBUG
   auto save_cell = [&](const std::string& filename, size_t cell_id) -> void{
     std::vector<size_t> faces;
     for (size_t i=0; i<num_patches; i++) {
@@ -143,7 +150,7 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
         }
       }
     }
-    Eigen::MatrixXi cell_faces(faces.size(), 3);
+    MatrixXI cell_faces(faces.size(), 3);
     for (size_t i=0; i<faces.size(); i++) {
       cell_faces.row(i) = F.row(faces[i]);
     }
@@ -153,12 +160,12 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
   };
 #endif
 
-#ifndef NDEBUG
+#ifdef IGL_COPYLEFT_CGAL_PROPAGATE_WINDING_NUMBERS_DEBUG
   {
     // Check for odd cycle.
-    Eigen::VectorXi cell_labels(num_cells);
+    VectorXI cell_labels(num_cells);
     cell_labels.setZero();
-    Eigen::VectorXi parents(num_cells);
+    VectorXI parents(num_cells);
     parents.setConstant(-1);
     auto trace_parents = [&](size_t idx) -> std::list<size_t> {
       std::list<size_t> path;
@@ -221,7 +228,7 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
 
   Eigen::Index outer_facet;
   bool flipped;
-  Eigen::VectorXi I = igl::LinSpaced<Eigen::VectorXi>(num_faces, 0, num_faces-1);
+  VectorXI I = igl::LinSpaced<VectorXI>(num_faces, 0, num_faces-1);
   igl::copyleft::cgal::outer_facet(V, F, I, outer_facet, flipped);
 #ifdef PROPAGATE_WINDING_NUMBER_TIMING
   log_time("outer_facet");
@@ -230,7 +237,7 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
   const size_t outer_patch = P[outer_facet];
   const size_t infinity_cell = C(outer_patch, flipped?1:0);
 
-  Eigen::VectorXi patch_labels(num_patches);
+  VectorXI patch_labels(num_patches);
   const int INVALID = std::numeric_limits<int>::max();
   patch_labels.setConstant(INVALID);
   for (size_t i=0; i<num_faces; i++) {
@@ -243,7 +250,7 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
   assert((patch_labels.array() != INVALID).all());
   const size_t num_labels = patch_labels.maxCoeff()+1;
 
-  Eigen::MatrixXi per_cell_W(num_cells, num_labels);
+  MatrixXI per_cell_W(num_cells, num_labels);
   per_cell_W.setConstant(INVALID);
   per_cell_W.row(infinity_cell).setZero();
   std::queue<size_t> Q;
@@ -265,7 +272,7 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
         }
         Q.push(neighbor_cell);
       } else {
-#ifndef NDEBUG
+#ifdef IGL_COPYLEFT_CGAL_PROPAGATE_WINDING_NUMBERS_DEBUG
         // Checking for winding number consistency.
         // This check would inevitably fail for meshes that contain open
         // boundary or non-orientable.  However, the inconsistent winding number
@@ -313,9 +320,9 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template bool igl::copyleft::cgal::propagate_winding_numbers<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, size_t, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, size_t, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template bool igl::copyleft::cgal::propagate_winding_numbers<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, size_t, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, size_t, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template bool igl::copyleft::cgal::propagate_winding_numbers<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template bool igl::copyleft::cgal::propagate_winding_numbers<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, size_t, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, size_t, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template bool igl::copyleft::cgal::propagate_winding_numbers<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, size_t, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, size_t, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template bool igl::copyleft::cgal::propagate_winding_numbers<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #ifdef WIN32
 #endif
 #endif

+ 11 - 11
include/igl/copyleft/cgal/propagate_winding_numbers.h

@@ -50,9 +50,9 @@ namespace igl
         typename DerivedL,
         typename DerivedW>
       IGL_INLINE bool propagate_winding_numbers(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedL>& labels,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedL>& labels,
         Eigen::PlainObjectBase<DerivedW>& W);
       // \overload
       //
@@ -74,16 +74,16 @@ namespace igl
         typename DerivedL,
         typename DerivedW>
       IGL_INLINE bool propagate_winding_numbers(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DeriveduE>& uE,
-        const Eigen::PlainObjectBase<DeriveduEC>& uEC,
-        const Eigen::PlainObjectBase<DeriveduEE>& uEE,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DeriveduE>& uE,
+        const Eigen::MatrixBase<DeriveduEC>& uEC,
+        const Eigen::MatrixBase<DeriveduEE>& uEE,
         const size_t num_patches,
-        const Eigen::PlainObjectBase<DerivedP>& P,
+        const Eigen::MatrixBase<DerivedP>& P,
         const size_t num_cells,
-        const Eigen::PlainObjectBase<DerivedC>& C,
-        const Eigen::PlainObjectBase<DerivedL>& labels,
+        const Eigen::MatrixBase<DerivedC>& C,
+        const Eigen::MatrixBase<DerivedL>& labels,
         Eigen::PlainObjectBase<DerivedW>& W);
     }
   }

+ 6 - 5
include/igl/copyleft/cgal/relabel_small_immersed_cells.cpp

@@ -9,6 +9,7 @@
 
 #include "relabel_small_immersed_cells.h"
 #include "../../centroid.h"
+#include "../../PlainMatrix.h"
 #include "assign.h"
 #include "cell_adjacency.h"
 
@@ -22,12 +23,12 @@ template<
   typename FT,
   typename DerivedW>
 IGL_INLINE void igl::copyleft::cgal::relabel_small_immersed_cells(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
     const size_t num_patches,
-    const Eigen::PlainObjectBase<DerivedP>& P,
+    const Eigen::MatrixBase<DerivedP>& P,
     const size_t num_cells,
-    const Eigen::PlainObjectBase<DerivedC>& C,
+    const Eigen::MatrixBase<DerivedC>& C,
     const FT vol_threashold,
     Eigen::PlainObjectBase<DerivedW>& W)
 {
@@ -67,7 +68,7 @@ IGL_INLINE void igl::copyleft::cgal::relabel_small_immersed_cells(
 
     const size_t num_positive_faces = involved_positive_faces.size();
     const size_t num_negative_faces = involved_negative_faces.size();
-    DerivedF selected_faces(num_positive_faces + num_negative_faces, 3);
+    PlainMatrix<DerivedF,Eigen::Dynamic,3> selected_faces(num_positive_faces + num_negative_faces, 3);
     for (size_t i=0; i<num_positive_faces; i++) {
       selected_faces.row(i) = F.row(involved_positive_faces[i]);
     }

+ 4 - 4
include/igl/copyleft/cgal/relabel_small_immersed_cells.h

@@ -40,12 +40,12 @@ namespace igl
         typename FT,
         typename DerivedW>
       IGL_INLINE void relabel_small_immersed_cells(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
         const size_t num_patches,
-        const Eigen::PlainObjectBase<DerivedP>& P,
+        const Eigen::MatrixBase<DerivedP>& P,
         const size_t num_cells,
-        const Eigen::PlainObjectBase<DerivedC>& C,
+        const Eigen::MatrixBase<DerivedC>& C,
         const FT vol_threashold,
         Eigen::PlainObjectBase<DerivedW>& W);
     }

+ 3 - 3
include/igl/copyleft/cgal/resolve_intersections.cpp

@@ -24,8 +24,8 @@ template <
   typename DerivedJ,
   typename DerivedIM>
 IGL_INLINE void igl::copyleft::cgal::resolve_intersections(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedE> & E,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedE> & E,
   Eigen::PlainObjectBase<DerivedVI> & VI,
   Eigen::PlainObjectBase<DerivedEI> & EI,
   Eigen::PlainObjectBase<DerivedJ> & J,
@@ -91,5 +91,5 @@ IGL_INLINE void igl::copyleft::cgal::resolve_intersections(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::copyleft::cgal::resolve_intersections<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -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> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::resolve_intersections<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -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> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

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

@@ -34,8 +34,8 @@ namespace igl
         typename DerivedJ,
         typename DerivedIM>
       IGL_INLINE void resolve_intersections(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedE> & E,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedE> & E,
         Eigen::PlainObjectBase<DerivedVI> & VI,
         Eigen::PlainObjectBase<DerivedEI> & EI,
         Eigen::PlainObjectBase<DerivedJ> & J,

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

@@ -11,7 +11,7 @@ template <
   typename Kernel,
   typename DerivedV>
 IGL_INLINE CGAL::Point_2<Kernel> igl::copyleft::cgal::row_to_point(
-  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedV> & V,
   const typename DerivedV::Index & i)
 {
   return CGAL::Point_2<Kernel>(V(i,0),V(i,1));
@@ -21,5 +21,5 @@ IGL_INLINE CGAL::Point_2<Kernel> igl::copyleft::cgal::row_to_point(
 // Explicit template instantiation
 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
-template CGAL::Point_2<CGAL::Epeck> igl::copyleft::cgal::row_to_point<CGAL::Epeck, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>::Index const&);
+template CGAL::Point_2<CGAL::Epeck> igl::copyleft::cgal::row_to_point<CGAL::Epeck, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>::Index const&);
 #endif

+ 1 - 1
include/igl/copyleft/cgal/row_to_point.h

@@ -26,7 +26,7 @@ namespace igl
         typename Kernel,
         typename DerivedV>
       IGL_INLINE CGAL::Point_2<Kernel> row_to_point(
-        const Eigen::PlainObjectBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedV> & V,
         const typename DerivedV::Index & i);
     }
   }

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

@@ -58,7 +58,7 @@ IGL_INLINE bool igl::copyleft::cgal::signed_distance_isosurface(
   Eigen::MatrixXd FN,VN,EN;
   Eigen::MatrixXi E;
   Eigen::VectorXi EMAP;
-  WindingNumberAABB< Eigen::Vector3d, Eigen::MatrixXd, Eigen::MatrixXi > hier;
+  WindingNumberAABB<double,int> hier;
   switch(sign_type)
   {
     default:

+ 3 - 3
include/igl/copyleft/cgal/snap_rounding.cpp

@@ -23,8 +23,8 @@ template <
   typename DerivedEI,
   typename DerivedJ>
 IGL_INLINE void igl::copyleft::cgal::snap_rounding(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedE> & E,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedE> & E,
   Eigen::PlainObjectBase<DerivedVI> & VI,
   Eigen::PlainObjectBase<DerivedEI> & EI,
   Eigen::PlainObjectBase<DerivedJ> & J)
@@ -207,5 +207,5 @@ IGL_INLINE void igl::copyleft::cgal::snap_rounding(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::copyleft::cgal::snap_rounding<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::snap_rounding<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, 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 

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

@@ -33,8 +33,8 @@ namespace igl
         typename DerivedEI,
         typename DerivedJ>
       IGL_INLINE void snap_rounding(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedE> & E,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedE> & E,
         Eigen::PlainObjectBase<DerivedVI> & VI,
         Eigen::PlainObjectBase<DerivedEI> & EI,
         Eigen::PlainObjectBase<DerivedJ> & J);

+ 4 - 4
include/igl/copyleft/cgal/subdivide_segments.cpp

@@ -25,8 +25,8 @@ template <
   typename DerivedJ,
   typename DerivedIM>
 IGL_INLINE void igl::copyleft::cgal::subdivide_segments(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedE> & E,
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedE> & E,
   const std::vector<std::vector<CGAL::Point_2<Kernel> > > & _steiner,
   Eigen::PlainObjectBase<DerivedVI> & VI,
   Eigen::PlainObjectBase<DerivedEI> & EI,
@@ -132,6 +132,6 @@ IGL_INLINE void igl::copyleft::cgal::subdivide_segments(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-template void igl::copyleft::cgal::subdivide_segments<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<CGAL::Point_2<CGAL::Epeck>, std::allocator<CGAL::Point_2<CGAL::Epeck> > >, std::allocator<std::vector<CGAL::Point_2<CGAL::Epeck>, std::allocator<CGAL::Point_2<CGAL::Epeck> > > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -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> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::copyleft::cgal::subdivide_segments<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<CGAL::Point_2<CGAL::Epeck>, std::allocator<CGAL::Point_2<CGAL::Epeck> > >, std::allocator<std::vector<CGAL::Point_2<CGAL::Epeck>, std::allocator<CGAL::Point_2<CGAL::Epeck> > > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -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> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::subdivide_segments<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<CGAL::Point_2<CGAL::Epeck>, std::allocator<CGAL::Point_2<CGAL::Epeck> > >, std::allocator<std::vector<CGAL::Point_2<CGAL::Epeck>, std::allocator<CGAL::Point_2<CGAL::Epeck> > > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -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> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::subdivide_segments<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck, Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<CGAL::Point_2<CGAL::Epeck>, std::allocator<CGAL::Point_2<CGAL::Epeck> > >, std::allocator<std::vector<CGAL::Point_2<CGAL::Epeck>, std::allocator<CGAL::Point_2<CGAL::Epeck> > > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -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> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

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

@@ -38,8 +38,8 @@ namespace igl
         typename DerivedJ,
         typename DerivedIM>
       IGL_INLINE void subdivide_segments(
-        const Eigen::PlainObjectBase<DerivedV> & V,
-        const Eigen::PlainObjectBase<DerivedE> & E,
+        const Eigen::MatrixBase<DerivedV> & V,
+        const Eigen::MatrixBase<DerivedE> & E,
         const std::vector<std::vector<CGAL::Point_2<Kernel> > > & steiner,
         Eigen::PlainObjectBase<DerivedVI> & VI,
         Eigen::PlainObjectBase<DerivedEI> & EI,

+ 7 - 7
include/igl/copyleft/cgal/submesh_aabb_tree.cpp

@@ -14,9 +14,9 @@ template<
   typename DerivedI,
   typename Kernel>
 IGL_INLINE void igl::copyleft::cgal::submesh_aabb_tree(
-  const Eigen::PlainObjectBase<DerivedV>& V,
-  const Eigen::PlainObjectBase<DerivedF>& F,
-  const Eigen::PlainObjectBase<DerivedI>& I,
+  const Eigen::MatrixBase<DerivedV>& V,
+  const Eigen::MatrixBase<DerivedF>& F,
+  const Eigen::MatrixBase<DerivedI>& I,
   CGAL::AABB_tree<
     CGAL::AABB_traits<
       Kernel, 
@@ -30,7 +30,7 @@ IGL_INLINE void igl::copyleft::cgal::submesh_aabb_tree(
   const size_t num_faces = I.rows();
   for (size_t i=0; i<num_faces; i++) 
   {
-    const Eigen::Vector3i f = F.row(I(i, 0));
+    const Eigen::Matrix<typename DerivedF::Scalar,3,1> f = F.row(I(i, 0));
     in_I[I(i,0)] = true;
     triangles.emplace_back(
       typename Kernel::Point_3(V(f[0], 0), V(f[0], 1), V(f[0], 2)),
@@ -51,7 +51,7 @@ IGL_INLINE void igl::copyleft::cgal::submesh_aabb_tree(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 // generated by autoexplicit.sh
-template void igl::copyleft::cgal::submesh_aabb_tree<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> > > >&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >&, std::vector<bool, std::allocator<bool> >&);
-template void igl::copyleft::cgal::submesh_aabb_tree<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> > > >&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >&, std::vector<bool, std::allocator<bool> >&);
-template void igl::copyleft::cgal::submesh_aabb_tree<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> > > >&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >&, std::vector<bool, std::allocator<bool> >&);
+template void igl::copyleft::cgal::submesh_aabb_tree<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> > > >&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >&, std::vector<bool, std::allocator<bool> >&);
+template void igl::copyleft::cgal::submesh_aabb_tree<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> > > >&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >&, std::vector<bool, std::allocator<bool> >&);
+template void igl::copyleft::cgal::submesh_aabb_tree<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Epeck::FT, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> > > >&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >&, std::vector<bool, std::allocator<bool> >&);
 #endif

+ 3 - 3
include/igl/copyleft/cgal/submesh_aabb_tree.h

@@ -40,9 +40,9 @@ namespace igl
         typename DerivedI,
         typename Kernel>
       IGL_INLINE void submesh_aabb_tree(
-        const Eigen::PlainObjectBase<DerivedV>& V,
-        const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedI>& I,
+        const Eigen::MatrixBase<DerivedV>& V,
+        const Eigen::MatrixBase<DerivedF>& F,
+        const Eigen::MatrixBase<DerivedI>& I,
         CGAL::AABB_tree<
           CGAL::AABB_traits<
             Kernel, 

Деякі файли не було показано, через те що забагато файлів було змінено