Browse Source

No longer using namespace std; and using namespace Eigen; to avoid issues with other libs (#2483)

* remove `using namespace std;` and fix resulting errors with missing namespaces

* remove `using namespace Eigen;` and fix resulting errors with missing namespaces

This should fix issues like https://github.com/libigl/libigl/issues/2480

* Add missing namespaces

fixup for 9ef213ba342b1c52011793972500c6e0b1df2a25
fixup for 3e88aa04fdd7b1ee0c9a7ea6a0c0454b773969e9

* missing Eigen::

* missing std::

* more missing std::

---------

Co-authored-by: BruegelN <[email protected]>
Alec Jacobson 5 months ago
parent
commit
182e36df24
100 changed files with 615 additions and 837 deletions
  1. 9 25
      include/igl/AABB.cpp
  2. 7 14
      include/igl/WindingNumberAABB.h
  3. 9 15
      include/igl/WindingNumberTree.h
  4. 10 12
      include/igl/active_set.cpp
  5. 4 9
      include/igl/adjacency_matrix.cpp
  6. 2 2
      include/igl/adjacency_matrix.h
  7. 1 1
      include/igl/all_pairs_distances.h
  8. 1 2
      include/igl/ambient_occlusion.cpp
  9. 21 25
      include/igl/arap.cpp
  10. 29 32
      include/igl/arap_dof.cpp
  11. 21 27
      include/igl/arap_linear_block.cpp
  12. 0 2
      include/igl/arap_rhs.cpp
  13. 3 3
      include/igl/avg_edge_length.h
  14. 1 3
      include/igl/barycentric_coordinates.cpp
  15. 17 20
      include/igl/bbw.cpp
  16. 5 5
      include/igl/bbw.h
  17. 6 8
      include/igl/bfs_orient.cpp
  18. 19 22
      include/igl/biharmonic_coordinates.cpp
  19. 2 2
      include/igl/biharmonic_coordinates.h
  20. 21 24
      include/igl/boundary_conditions.cpp
  21. 7 16
      include/igl/boundary_loop.cpp
  22. 0 1
      include/igl/bounding_box.cpp
  23. 2 3
      include/igl/bounding_box_diagonal.cpp
  24. 9 13
      include/igl/cat.cpp
  25. 2 2
      include/igl/cat.h
  26. 0 1
      include/igl/ceil.cpp
  27. 0 1
      include/igl/centroid.cpp
  28. 0 2
      include/igl/collapse_edge.cpp
  29. 1 2
      include/igl/collapse_least_cost_edge.cpp
  30. 4 7
      include/igl/collapse_small_triangles.cpp
  31. 1 2
      include/igl/column_to_quats.cpp
  32. 0 7
      include/igl/copyleft/cgal/SelfIntersectMesh.h
  33. 2 3
      include/igl/copyleft/cgal/complex_to_mesh.cpp
  34. 8 8
      include/igl/copyleft/cgal/extract_cells.cpp
  35. 1 5
      include/igl/copyleft/cgal/intersect_other.cpp
  36. 17 21
      include/igl/copyleft/cgal/minkowski_sum.cpp
  37. 32 34
      include/igl/copyleft/cgal/outer_hull_legacy.cpp
  38. 9 11
      include/igl/copyleft/cgal/peel_outer_hull_layers.cpp
  39. 3 6
      include/igl/copyleft/cgal/point_mesh_squared_distance.cpp
  40. 0 1
      include/igl/copyleft/cgal/polyhedron_to_mesh.cpp
  41. 0 1
      include/igl/copyleft/cgal/projected_delaunay.cpp
  42. 0 1
      include/igl/copyleft/cgal/remesh_self_intersections.cpp
  43. 1 3
      include/igl/copyleft/cgal/resolve_intersections.cpp
  44. 4 7
      include/igl/copyleft/cgal/signed_distance_isosurface.cpp
  45. 13 15
      include/igl/copyleft/cgal/snap_rounding.cpp
  46. 3 4
      include/igl/copyleft/cgal/string_to_mesh_boolean_type.cpp
  47. 2 5
      include/igl/copyleft/cgal/subdivide_segments.cpp
  48. 0 2
      include/igl/copyleft/opengl2/texture_from_tga.cpp
  49. 21 23
      include/igl/copyleft/progressive_hulls_cost_and_placement.cpp
  50. 16 17
      include/igl/copyleft/quadprog.cpp
  51. 2 4
      include/igl/copyleft/tetgen/cdt.cpp
  52. 0 1
      include/igl/copyleft/tetgen/mesh_to_tetgenio.cpp
  53. 16 18
      include/igl/copyleft/tetgen/mesh_with_skeleton.cpp
  54. 7 10
      include/igl/cotmatrix.cpp
  55. 2 2
      include/igl/cotmatrix.h
  56. 10 13
      include/igl/cotmatrix_entries.cpp
  57. 7 9
      include/igl/cotmatrix_intrinsic.cpp
  58. 3 4
      include/igl/covariance_scatter_matrix.cpp
  59. 3 5
      include/igl/crouzeix_raviart_massmatrix.cpp
  60. 0 2
      include/igl/cumprod.cpp
  61. 0 2
      include/igl/cumsum.cpp
  62. 15 16
      include/igl/dated_copy.cpp
  63. 6 8
      include/igl/decimate.cpp
  64. 7 9
      include/igl/deform_skeleton.cpp
  65. 2 3
      include/igl/dihedral_angles.cpp
  66. 1 2
      include/igl/dihedral_angles_intrinsic.cpp
  67. 46 50
      include/igl/direct_delta_mush.cpp
  68. 1 2
      include/igl/directed_edge_orientations.cpp
  69. 0 2
      include/igl/directed_edge_parents.cpp
  70. 2 4
      include/igl/doublearea.cpp
  71. 3 3
      include/igl/doublearea.h
  72. 1 2
      include/igl/dqs.cpp
  73. 9 11
      include/igl/edge_collapse_is_valid.cpp
  74. 3 3
      include/igl/edge_lengths.h
  75. 5 7
      include/igl/eigs.cpp
  76. 9 11
      include/igl/embree/EmbreeIntersector.cpp
  77. 2 3
      include/igl/embree/EmbreeRenderer.cpp
  78. 0 1
      include/igl/embree/ambient_occlusion.cpp
  79. 16 18
      include/igl/embree/bone_heat.cpp
  80. 9 11
      include/igl/embree/bone_visible.cpp
  81. 30 32
      include/igl/embree/reorient_facets_raycast.cpp
  82. 0 1
      include/igl/embree/shape_diameter_function.cpp
  83. 0 2
      include/igl/embree/unproject_in_mesh.cpp
  84. 0 2
      include/igl/embree/unproject_onto_mesh.cpp
  85. 1 2
      include/igl/example_fun.cpp
  86. 3 5
      include/igl/exterior_edges.cpp
  87. 2 3
      include/igl/face_areas.cpp
  88. 2 4
      include/igl/face_occurrences.cpp
  89. 3 5
      include/igl/faces_first.cpp
  90. 3 3
      include/igl/faces_first.h
  91. 2 3
      include/igl/facet_adjacency_matrix.cpp
  92. 3 4
      include/igl/facet_components.cpp
  93. 0 1
      include/igl/false_barycentric_subdivision.cpp
  94. 1 1
      include/igl/find_zero.cpp
  95. 0 2
      include/igl/fit_rotations.cpp
  96. 0 6
      include/igl/flip_avoiding_line_search.cpp
  97. 1 3
      include/igl/flood_fill.cpp
  98. 0 1
      include/igl/floor.cpp
  99. 8 12
      include/igl/forward_kinematics.cpp
  100. 23 32
      include/igl/frame_field_deformer.cpp

+ 9 - 25
include/igl/AABB.cpp

@@ -817,8 +817,6 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
     const Eigen::MatrixBase<Derivedelements> & elements,
     const int i)
 {
-  using namespace std;
-  using namespace Eigen;
   clear();
   if(bb_mins.size() > 0)
   {
@@ -844,7 +842,7 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
     }
   }else
   {
-    VectorXi allI = colon<int>(0,Ele.rows()-1);
+    Eigen::VectorXi allI = colon<int>(0,Ele.rows()-1);
     MatrixXDIMS BC;
     if(Ele.cols() == 1)
     {
@@ -855,10 +853,10 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
       // Simplices
       barycenter(V,Ele,BC);
     }
-    MatrixXi SI(BC.rows(),BC.cols());
+    Eigen::MatrixXi SI(BC.rows(),BC.cols());
     {
       MatrixXDIMS _;
-      MatrixXi IS;
+      Eigen::MatrixXi IS;
       igl::sort(BC,1,true,_,IS);
       // Need SI(i) to tell which place i would be sorted into
       const int dim = IS.cols();
@@ -880,9 +878,8 @@ void igl::AABB<DerivedV,DIM>::init(
     const Eigen::MatrixBase<DerivedV> & V,
     const Eigen::MatrixBase<DerivedEle> & Ele)
 {
-  using namespace Eigen;
   // clear will be immediately called...
-  return init(V,Ele,MatrixXDIMS(),MatrixXDIMS(),VectorXi(),0);
+  return init(V,Ele,MatrixXDIMS(),MatrixXDIMS(),Eigen::VectorXi(),0);
 }
 
   template <typename DerivedV, int DIM>
@@ -896,8 +893,6 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
     const Eigen::MatrixBase<DerivedSI> & SI,
     const Eigen::MatrixBase<DerivedI> & I)
 {
-  using namespace Eigen;
-  using namespace std;
   clear();
   if(V.size() == 0 || Ele.size() == 0 || I.size() == 0)
   {
@@ -905,7 +900,7 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
   }
   assert(DIM == V.cols() && "V.cols() should matched declared dimension");
   //const Scalar inf = numeric_limits<Scalar>::infinity();
-  m_box = AlignedBox<Scalar,DIM>();
+  m_box = Eigen::AlignedBox<Scalar,DIM>();
   // Compute bounding box
   for(int i = 0;i<I.rows();i++)
   {
@@ -933,20 +928,20 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
         m_box.diagonal().maxCoeff(&max_d);
         // Can't use median on BC directly because many may have same value,
         // but can use median on sorted BC indices
-        VectorXi SIdI(I.rows());
+        Eigen::VectorXi SIdI(I.rows());
         for(int i = 0;i<I.rows();i++)
         {
           SIdI(i) = SI(I(i),max_d);
         }
         // Pass by copy to avoid changing input
-        const auto median = [](VectorXi A)->int
+        const auto median = [](Eigen::VectorXi A)->int
         {
           size_t n = (A.size()-1)/2;
-          nth_element(A.data(),A.data()+n,A.data()+A.size());
+          std::nth_element(A.data(),A.data()+n,A.data()+A.size());
           return A(n);
         };
         const int med = median(SIdI);
-        VectorXi LI((I.rows()+1)/2),RI(I.rows()/2);
+        Eigen::VectorXi LI((I.rows()+1)/2),RI(I.rows()/2);
         assert(LI.rows()+RI.rows() == I.rows());
         // Distribute left and right
         {
@@ -1051,8 +1046,6 @@ IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
     const Eigen::MatrixBase<Derivedq> & q,
     const bool first) const
 {
-  using namespace std;
-  using namespace Eigen;
   assert(q.size() == DIM &&
       "Query dimension should match aabb dimension");
   assert(Ele.cols() == V.cols()+1 &&
@@ -1099,8 +1092,6 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::serialize(
     Eigen::PlainObjectBase<Derivedelements> & elements,
     const int i) const
 {
-  using namespace std;
-  using namespace Eigen;
   // Calling for root then resize output
   if(i==0)
   {
@@ -1150,8 +1141,6 @@ igl::AABB<DerivedV,DIM>::squared_distance(
   int & i,
   Eigen::PlainObjectBase<RowVectorDIMS> & c) const
 {
-  using namespace Eigen;
-  using namespace std;
   //assert(low_sqr_d <= up_sqr_d);
   if(low_sqr_d > up_sqr_d)
   {
@@ -1331,9 +1320,6 @@ IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
   Eigen::PlainObjectBase<DerivedI> & I,
   Eigen::PlainObjectBase<DerivedC> & C) const
 {
-  using namespace std;
-  using namespace Eigen;
-
   // This implementation is a bit disappointing. There's no major speed up. Any
   // performance gains seem to come from accidental cache coherency and
   // diminish for larger "other" (the opposite of what was intended).
@@ -1433,8 +1419,6 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
   int & i,
   Eigen::PlainObjectBase<RowVectorDIMS> & c) const
 {
-  using namespace Eigen;
-  using namespace std;
   if(low_sqr_d > sqr_d)
   {
     sqr_d = low_sqr_d;

+ 7 - 14
include/igl/WindingNumberAABB.h

@@ -108,7 +108,6 @@ inline void igl::WindingNumberAABB<Scalar,Index>::set_mesh(
 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();
@@ -149,8 +148,6 @@ inline igl::WindingNumberAABB<Scalar,Index>::WindingNumberAABB(
 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();
 
@@ -169,7 +166,7 @@ inline void igl::WindingNumberAABB<Scalar,Index>::grow()
   // Compute longest direction
   int max_d = -1;
   Scalar max_len = 
-    -numeric_limits<Scalar>::infinity();
+    -std::numeric_limits<Scalar>::infinity();
   for(int d = 0;d<min_corner.size();d++)
   {
     if( (max_corner[d] - min_corner[d]) > max_len )
@@ -202,7 +199,7 @@ inline void igl::WindingNumberAABB<Scalar,Index>::grow()
   //cout<<"c: "<<0.5*(max_corner[max_d] + min_corner[max_d])<<" "<<
   //  "m: "<<split_value<<endl;;
 
-  vector<int> id( (this->F).rows());
+  std::vector<int> id( (this->F).rows());
   for(int i = 0;i<(this->F).rows();i++)
   {
     if(BC(i,max_d) <= split_value)
@@ -273,12 +270,11 @@ inline bool igl::WindingNumberAABB<Scalar,Index>::inside(const Point & p) const
 template <typename Scalar, typename Index>
 inline void igl::WindingNumberAABB<Scalar,Index>::compute_min_max_corners()
 {
-  using namespace std;
   // initialize corners
   for(int d = 0;d<min_corner.size();d++)
   {
-    min_corner[d] =  numeric_limits<typename Point::Scalar>::infinity();
-    max_corner[d] = -numeric_limits<typename Point::Scalar>::infinity();
+    min_corner[d] =  std::numeric_limits<typename Point::Scalar>::infinity();
+    max_corner[d] = -std::numeric_limits<typename Point::Scalar>::infinity();
   }
 
   this->center = Point(0,0,0);
@@ -317,15 +313,14 @@ 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<Scalar>::infinity();
+    return std::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<Scalar>::infinity();
+  return std::numeric_limits<Scalar>::infinity();
 }
 
 template <typename Scalar, typename Index>
@@ -333,12 +328,10 @@ inline Scalar
   igl::WindingNumberAABB<Scalar,Index>::max_simple_abs_winding_number(
   const Point & p) const
 {
-  using namespace std;
-  using namespace Eigen;
   // Only valid if not inside
   if(inside(p))
   {
-    return numeric_limits<Scalar>::infinity();
+    return std::numeric_limits<Scalar>::infinity();
   }
   // Max simple is the same as sum of positive winding number contributions of
   // bounding box

+ 9 - 15
include/igl/WindingNumberTree.h

@@ -184,7 +184,6 @@ inline void igl::WindingNumberTree<Scalar,Index>::set_mesh(
     const Eigen::MatrixBase<DerivedV> & _V,
     const Eigen::MatrixBase<DerivedF> & _F)
 {
-  using namespace std;
   // Remove any exactly duplicate vertices
   // Q: Can this ever increase the complexity of the boundary?
   // Q: Would we gain even more by remove almost exactly duplicate vertices?
@@ -224,9 +223,8 @@ inline igl::WindingNumberTree<Scalar,Index>::~WindingNumberTree()
 template <typename Scalar, typename Index>
 inline void igl::WindingNumberTree<Scalar,Index>::delete_children()
 {
-  using namespace std;
   // Delete children
-  typename list<WindingNumberTree<Scalar,Index>* >::iterator cit = children.begin();
+  typename std::list<WindingNumberTree<Scalar,Index>* >::iterator cit = children.begin();
   while(cit != children.end())
   {
     // clear the memory of this item
@@ -263,7 +261,6 @@ template <typename Scalar, typename Index>
 inline Scalar 
 igl::WindingNumberTree<Scalar,Index>::winding_number(const Point & p) const
 {
-  using namespace std;
   //cout<<"+"<<boundary.rows();
   // If inside then we need to be careful
   if(inside(p))
@@ -274,7 +271,7 @@ igl::WindingNumberTree<Scalar,Index>::winding_number(const Point & p) const
       // Recurse on each child and accumulate
       Scalar sum = 0;
       for(
-        typename list<WindingNumberTree<Scalar,Index>* >::const_iterator cit = children.begin();
+        typename std::list<WindingNumberTree<Scalar,Index>* >::const_iterator cit = children.begin();
         cit != children.end();
         cit++)
       {
@@ -370,17 +367,16 @@ igl::WindingNumberTree<Scalar,Index>::winding_number_boundary(const Point & p) c
 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<<"]";
+  std::cout<<tab<<"["<<std::endl<<F<<std::endl<<"]";
   // Print children
   for(
-      typename list<WindingNumberTree<Scalar,Index>* >::iterator cit = children.begin();
+      typename std::list<WindingNumberTree<Scalar,Index>* >::iterator cit = children.begin();
       cit != children.end();
       cit++)
   {
-    cout<<","<<endl;
-    (*cit)->print((string(tab)+"").c_str());
+    std::cout<<","<<std::endl;
+    (*cit)->print((std::string(tab)+"").c_str());
   }
 }
 
@@ -396,8 +392,7 @@ inline Scalar
 igl::WindingNumberTree<Scalar,Index>::max_simple_abs_winding_number(
   const Point & /*p*/) const
 {
-  using namespace std;
-  return numeric_limits<Scalar>::infinity();
+  return std::numeric_limits<Scalar>::infinity();
 }
 
 template <typename Scalar, typename Index>
@@ -406,7 +401,6 @@ igl::WindingNumberTree<Scalar,Index>::cached_winding_number(
   const igl::WindingNumberTree<Scalar,Index> & that,
   const Point & p) const
 {
-  using namespace std;
   // Simple metric for `is_far`
   //
   //   this             that
@@ -437,7 +431,7 @@ igl::WindingNumberTree<Scalar,Index>::cached_winding_number(
   if(is_far)
   {
     // Not implemented yet
-    pair<const WindingNumberTree*,const WindingNumberTree*> this_that(this,&that);
+    std::pair<const WindingNumberTree*,const WindingNumberTree*> this_that(this,&that);
     // Need to compute it for first time?
     if(cached.count(this_that)==0)
     {
@@ -452,7 +446,7 @@ igl::WindingNumberTree<Scalar,Index>::cached_winding_number(
   }else
   {
     for(
-      typename list<WindingNumberTree<Scalar,Index>* >::const_iterator cit = children.begin();
+      typename std::list<WindingNumberTree<Scalar,Index>* >::const_iterator cit = children.begin();
       cit != children.end();
       cit++)
     {

+ 10 - 12
include/igl/active_set.cpp

@@ -51,8 +51,6 @@ IGL_INLINE igl::SolverStatus igl::active_set(
 #if defined(ACTIVE_SET_CPP_DEBUG) && !defined(_MSC_VER)
 #  warning "ACTIVE_SET_CPP_DEBUG"
 #endif
-  using namespace Eigen;
-  using namespace std;
   SolverStatus ret = SOLVER_STATUS_ERROR;
   const int n = A.rows();
   assert(n == A.cols() && "A must be square");
@@ -75,7 +73,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
   if(p_lx.size() == 0)
   {
     lx = Derivedlx::Constant(
-      n,1,-numeric_limits<typename Derivedlx::Scalar>::max());
+      n,1,-std::numeric_limits<typename Derivedlx::Scalar>::max());
   }else
   {
     lx = p_lx;
@@ -83,7 +81,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
   if(p_ux.size() == 0)
   {
     ux = Derivedux::Constant(
-      n,1,numeric_limits<typename Derivedux::Scalar>::max());
+      n,1,std::numeric_limits<typename Derivedux::Scalar>::max());
   }else
   {
     ux = p_ux;
@@ -107,9 +105,9 @@ IGL_INLINE igl::SolverStatus igl::active_set(
   typedef int BOOL;
 #define TRUE 1
 #define FALSE 0
-  Matrix<BOOL,Dynamic,1> as_lx = Matrix<BOOL,Dynamic,1>::Constant(n,1,FALSE);
-  Matrix<BOOL,Dynamic,1> as_ux = Matrix<BOOL,Dynamic,1>::Constant(n,1,FALSE);
-  Matrix<BOOL,Dynamic,1> as_ieq = Matrix<BOOL,Dynamic,1>::Constant(Aieq.rows(),1,FALSE);
+  Eigen::Matrix<BOOL,Eigen::Dynamic,1> as_lx = Eigen::Matrix<BOOL,Eigen::Dynamic,1>::Constant(n,1,FALSE);
+  Eigen::Matrix<BOOL,Eigen::Dynamic,1> as_ux = Eigen::Matrix<BOOL,Eigen::Dynamic,1>::Constant(n,1,FALSE);
+  Eigen::Matrix<BOOL,Eigen::Dynamic,1> as_ieq = Eigen::Matrix<BOOL,Eigen::Dynamic,1>::Constant(Aieq.rows(),1,FALSE);
 
   // Keep track of previous Z for comparison
   PlainMatrix<DerivedZ> old_Z;
@@ -255,7 +253,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
       assert(k == as_ieq_count);
     }
     // extract active constraint rows
-    SparseMatrix<AeqT> Aeq_i,Aieq_i;
+    Eigen::SparseMatrix<AeqT> Aeq_i,Aieq_i;
     slice(Aieq,as_ieq_list,1,Aieq_i);
     // Append to equality constraints
     cat(1,Aeq,Aieq_i,Aeq_i);
@@ -265,7 +263,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
 #ifndef NDEBUG
     {
       // NO DUPES!
-      Matrix<BOOL,Dynamic,1> fixed = Matrix<BOOL,Dynamic,1>::Constant(n,1,FALSE);
+      Eigen::Matrix<BOOL ,Eigen::Dynamic,1> fixed = Eigen::Matrix<BOOL ,Eigen::Dynamic,1>::Constant(n,1,FALSE);
       for(int k = 0;k<known_i.size();k++)
       {
         assert(!fixed[known_i(k)]);
@@ -326,18 +324,18 @@ IGL_INLINE igl::SolverStatus igl::active_set(
     }
 
     // Compute Lagrange multiplier values for known_i
-    SparseMatrix<AT> Ak;
+    Eigen::SparseMatrix<AT> Ak;
     // Slow
     slice(A,known_i,1,Ak);
     //slice(B,known_i,Bk);
     PlainMatrix<DerivedB,Eigen::Dynamic> Bk = B(known_i,igl::placeholders::all);
-    MatrixXd Lambda_known_i = -(0.5*Ak*Z + 0.5*Bk);
+    Eigen::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) =
       (-1*Lambda_known_i.block(nk,0,as_lx_count,1)).eval();
 
     // Extract Lagrange multipliers for Aieq_i (always at back of sol)
-    VectorXd Lambda_Aieq_i(Aieq_i.rows(),1);
+    Eigen::VectorXd Lambda_Aieq_i(Aieq_i.rows(),1);
     for(int l = 0;l<Aieq_i.rows();l++)
     {
       Lambda_Aieq_i(Aieq_i.rows()-1-l) = sol(sol.rows()-1-l);

+ 4 - 9
include/igl/adjacency_matrix.cpp

@@ -16,12 +16,10 @@ IGL_INLINE void igl::adjacency_matrix(
   const Eigen::MatrixBase<DerivedF> & F,
   Eigen::SparseMatrix<T>& A)
 {
-  using namespace std;
-  using namespace Eigen;
   typedef typename DerivedF::Scalar Index;
 
-  typedef Triplet<T> IJV;
-  vector<IJV > ijv;
+  typedef Eigen::Triplet<T> IJV;
+  std::vector<IJV > ijv;
   ijv.reserve(F.size()*2);
   // Loop over **simplex** (i.e., **not quad**)
   for(int i = 0;i<F.rows();i++)
@@ -71,11 +69,8 @@ IGL_INLINE void igl::adjacency_matrix(
   const Eigen::MatrixBase<DerivedC> & C,
   Eigen::SparseMatrix<T>& A)
 {
-  using namespace std;
-  using namespace Eigen;
-
-  typedef Triplet<T> IJV;
-  vector<IJV > ijv;
+  typedef Eigen::Triplet<T> IJV;
+  std::vector<IJV > ijv;
   ijv.reserve(C(C.size()-1)*2);
   typedef typename DerivedI::Scalar Index;
   const Index n = I.maxCoeff()+1;

+ 2 - 2
include/igl/adjacency_matrix.h

@@ -30,10 +30,10 @@ namespace igl
   ///   SparseVector<double> Asum;
   ///   sum(A,1,Asum);
   ///   // Convert row sums into diagonal of sparse matrix
-  ///   SparseMatrix<double> Adiag;
+  ///   Eigen::SparseMatrix<double> Adiag;
   ///   diag(Asum,Adiag);
   ///   // Build uniform laplacian
-  ///   SparseMatrix<double> U;
+  ///   Eigen::SparseMatrix<double> U;
   ///   U = A-Adiag;
   /// \endcode
   ///

+ 1 - 1
include/igl/all_pairs_distances.h

@@ -15,7 +15,7 @@ namespace igl
   /// 
   ///     D = all_pairs_distances(V,U)
   /// 
-  /// @tparam matrix class like MatrixXd
+  /// @tparam matrix class like Eigen::MatrixXd
   /// @param[in] V  #V by dim list of points
   /// @param[in] U  #U by dim list of points
   /// @param[in] squared  whether to return squared distances

+ 1 - 2
include/igl/ambient_occlusion.cpp

@@ -30,7 +30,6 @@ IGL_INLINE void igl::ambient_occlusion(
   const int num_samples,
   Eigen::PlainObjectBase<DerivedS> & S)
 {
-  using namespace Eigen;
   const int n = P.rows();
   // Resize output
   S.resize(n,1);
@@ -38,7 +37,7 @@ IGL_INLINE void igl::ambient_occlusion(
   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 Eigen::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)
   {

+ 21 - 25
include/igl/arap.cpp

@@ -35,8 +35,6 @@ IGL_INLINE bool igl::arap_precomputation(
   const Eigen::MatrixBase<Derivedb> & b,
   ARAPData & data)
 {
-  using namespace std;
-  using namespace Eigen;
   typedef typename DerivedV::Scalar Scalar;
   typedef typename DerivedF::Scalar Integer;
   // number of vertices
@@ -53,14 +51,14 @@ IGL_INLINE bool igl::arap_precomputation(
   data.dim = dim;
   //assert(dim == 3 && "Only 3d supported");
   // Defaults
-  data.f_ext = MatrixXd::Zero(n,data.dim);
+  data.f_ext = Eigen::MatrixXd::Zero(n,data.dim);
 
   assert(data.dim <= V.cols() && "solve dim should be <= embedding");
   bool flat = (V.cols() - data.dim)==1;
 
   MatrixXX<Scalar> plane_V;
   MatrixXX<Integer> plane_F;
-  typedef SparseMatrix<Scalar> SparseMatrixS;
+  typedef Eigen::SparseMatrix<Scalar> SparseMatrixS;
   SparseMatrixS ref_map,ref_map_dim;
   if(flat)
   {
@@ -106,7 +104,7 @@ IGL_INLINE bool igl::arap_precomputation(
 
   // Get group sum scatter matrix, when applied sums all entries of the same
   // group according to G
-  SparseMatrix<double> G_sum;
+  Eigen::SparseMatrix<double> G_sum;
   if(data.G.size() == 0)
   {
     if(eff_energy == ARAP_ENERGY_TYPE_ELEMENTS)
@@ -122,7 +120,7 @@ IGL_INLINE bool igl::arap_precomputation(
     if(eff_energy == ARAP_ENERGY_TYPE_ELEMENTS)
     {
       Eigen::Matrix<int,Eigen::Dynamic,1> GG;
-      MatrixXi GF(F.rows(),F.cols());
+      Eigen::MatrixXi GF(F.rows(),F.cols());
       for(int j = 0;j<F.cols();j++)
       {
         GF.col(j) = data.G(F.col(j));
@@ -133,7 +131,7 @@ IGL_INLINE bool igl::arap_precomputation(
     //printf("group_sum_matrix()\n");
     group_sum_matrix(data.G,G_sum);
   }
-  SparseMatrix<double> G_sum_dim;
+  Eigen::SparseMatrix<double> G_sum_dim;
   repdiag(G_sum,data.dim,G_sum_dim);
   assert(G_sum_dim.cols() == data.CSM.rows());
   data.CSM = (G_sum_dim * data.CSM).eval();
@@ -146,24 +144,24 @@ IGL_INLINE bool igl::arap_precomputation(
   }
   assert(data.K.rows() == data.n*data.dim);
 
-  SparseMatrix<double> Q = (-L).eval();
+  Eigen::SparseMatrix<double> Q = (-L).eval();
 
   if(data.with_dynamics)
   {
     const double h = data.h;
     assert(h != 0);
-    SparseMatrix<double> M;
+    Eigen::SparseMatrix<double> M;
     massmatrix(V,F,MASSMATRIX_TYPE_DEFAULT,data.M);
     const double dw = (1./data.ym)*(h*h);
-    SparseMatrix<double> DQ = dw * 1./(h*h)*data.M;
+    Eigen::SparseMatrix<double> DQ = dw * 1./(h*h)*data.M;
     Q += DQ;
     // Dummy external forces
-    data.f_ext = MatrixXd::Zero(n,data.dim);
-    data.vel = MatrixXd::Zero(n,data.dim);
+    data.f_ext = Eigen::MatrixXd::Zero(n,data.dim);
+    data.vel = Eigen::MatrixXd::Zero(n,data.dim);
   }
 
   return min_quad_with_fixed_precompute(
-    Q,b,SparseMatrix<double>(),true,data.solver_data);
+    Q,b,Eigen::SparseMatrix<double>(),true,data.solver_data);
 }
 
 template <
@@ -174,8 +172,6 @@ IGL_INLINE bool igl::arap_solve(
   ARAPData & data,
   Eigen::MatrixBase<DerivedU> & U)
 {
-  using namespace Eigen;
-  using namespace std;
   assert(data.b.size() == bc.rows());
   assert(U.size() != 0 && "U cannot be empty");
   assert(U.cols() == data.dim && "U.cols() match data.dim");
@@ -185,9 +181,9 @@ IGL_INLINE bool igl::arap_solve(
   const int n = data.n;
   int iter = 0;
   // changes each arap iteration
-  MatrixXd U_prev = U;
+  Eigen::MatrixXd U_prev = U;
   // doesn't change for fixed with_dynamics timestep
-  MatrixXd U0;
+  Eigen::MatrixXd U0;
   if(data.with_dynamics)
   {
     U0 = U_prev;
@@ -204,13 +200,13 @@ IGL_INLINE bool igl::arap_solve(
     const auto & Udim = U.replicate(data.dim,1);
     assert(U.cols() == data.dim);
     // As if U.col(2) was 0
-    MatrixXd S = data.CSM * Udim;
+    Eigen::MatrixXd S = data.CSM * Udim;
     // THIS NORMALIZATION IS IMPORTANT TO GET SINGLE PRECISION SVD CODE TO WORK
     // CORRECTLY.
     S /= S.array().abs().maxCoeff();
 
     const int Rdim = data.dim;
-    MatrixXd R(Rdim,data.CSM.rows());
+    Eigen::MatrixXd R(Rdim,data.CSM.rows());
     if(R.rows() == 2)
     {
       fit_rotations_planar(S,R);
@@ -225,14 +221,14 @@ IGL_INLINE bool igl::arap_solve(
     }
     //for(int k = 0;k<(data.CSM.rows()/dim);k++)
     //{
-    //  R.block(0,dim*k,dim,dim) = MatrixXd::Identity(dim,dim);
+    //  R.block(0,dim*k,dim,dim) = Eigen::MatrixXd::Identity(dim,dim);
     //}
 
 
     // Number of rotations: #vertices or #elements
     int num_rots = data.K.cols()/Rdim/Rdim;
     // distribute group rotations to vertices in each group
-    MatrixXd eff_R;
+    Eigen::MatrixXd eff_R;
     if(data.G.size() == 0)
     {
       // copy...
@@ -247,7 +243,7 @@ IGL_INLINE bool igl::arap_solve(
       }
     }
 
-    MatrixXd Dl;
+    Eigen::MatrixXd Dl;
     if(data.with_dynamics)
     {
       assert(data.M.rows() == n &&
@@ -263,13 +259,13 @@ IGL_INLINE bool igl::arap_solve(
       Dl = dw * (1./(h*h)*data.M*(-U0 - h*data.vel) - data.f_ext);
     }
 
-    VectorXd Rcol;
+    Eigen::VectorXd Rcol;
     columnize(eff_R,num_rots,2,Rcol);
-    VectorXd Bcol = -data.K * Rcol;
+    Eigen::VectorXd Bcol = -data.K * Rcol;
     assert(Bcol.size() == data.n*data.dim);
     for(int c = 0;c<data.dim;c++)
     {
-      VectorXd Uc,Bc,bcc,Beq;
+      Eigen::VectorXd Uc,Bc,bcc,Beq;
       Bc = Bcol.block(c*n,0,n,1);
       if(data.with_dynamics)
       {

+ 29 - 32
include/igl/arap_dof.cpp

@@ -66,8 +66,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
   const Eigen::Matrix<int,Eigen::Dynamic,1> & G,
   ArapDOFData<LbsMatrixType, SSCALAR> & data)
 {
-  using namespace Eigen;
-  typedef Matrix<SSCALAR, Dynamic, Dynamic> MatrixXS;
+  typedef Eigen::Matrix<SSCALAR, Eigen::Dynamic, Eigen::Dynamic> MatrixXS;
   // number of mesh (domain) vertices
   int n = V.rows();
   // cache problem size
@@ -95,11 +94,11 @@ IGL_INLINE bool igl::arap_dof_precomputation(
   //printf("n=%d; dim=%d; m=%d;\n",n,data.dim,data.m);
 
   // Build cotangent laplacian
-  SparseMatrix<double> Lcot;
+  Eigen::SparseMatrix<double> Lcot;
   //printf("cotmatrix()\n");
   cotmatrix(V,F,Lcot);
   // Discrete laplacian (should be minus matlab version)
-  SparseMatrix<double> Lapl = -2.0*Lcot;
+  Eigen::SparseMatrix<double> Lapl = -2.0*Lcot;
 #ifdef EXTREME_VERBOSE
   cout<<"LaplIJV=["<<endl;print_ijv(Lapl,1);cout<<endl<<"];"<<
     endl<<"Lapl=sparse(LaplIJV(:,1),LaplIJV(:,2),LaplIJV(:,3),"<<
@@ -108,7 +107,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
 
   // Get group sum scatter matrix, when applied sums all entries of the same
   // group according to G
-  SparseMatrix<double> G_sum;
+  Eigen::SparseMatrix<double> G_sum;
   if(G.size() == 0)
   {
     speye(n,G_sum);
@@ -118,7 +117,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
     Eigen::Matrix<int,Eigen::Dynamic,1> GG;
     if(data.energy == ARAP_ENERGY_TYPE_ELEMENTS)
     {
-      MatrixXi GF(F.rows(),F.cols());
+      Eigen::MatrixXi GF(F.rows(),F.cols());
       for(int j = 0;j<F.cols();j++)
       {
         GF.col(j) = G(F.col(j));
@@ -140,7 +139,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
 
   // Get covariance scatter matrix, when applied collects the covariance matrices
   // used to fit rotations to during optimization
-  SparseMatrix<double> CSM;
+  Eigen::SparseMatrix<double> CSM;
   //printf("covariance_scatter_matrix()\n");
   covariance_scatter_matrix(V,F,data.energy,CSM);
 #ifdef EXTREME_VERBOSE
@@ -167,7 +166,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
   // S((k-1)*dim + 1:dim,:)
 
   // Apply group sum to each dimension's block of covariance scatter matrix
-  SparseMatrix<double> G_sum_dim;
+  Eigen::SparseMatrix<double> G_sum_dim;
   repdiag(G_sum,data.dim,G_sum_dim);
   CSM = (G_sum_dim * CSM).eval();
 #ifdef EXTREME_VERBOSE
@@ -205,7 +204,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
     //printf("CSM_M(): slice\n");
 #if __cplusplus >= 201703L
     // Check if LbsMatrixType is a sparse matrix
-    if constexpr (std::is_base_of<SparseMatrixBase<LbsMatrixType>, LbsMatrixType>::value)
+    if constexpr (std::is_base_of<Eigen::SparseMatrixBase<LbsMatrixType>, LbsMatrixType>::value)
     {
       slice(M,(span_n.array()+i*n).matrix().eval(),span_mlbs_cols,M_i);
     }
@@ -214,7 +213,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
       M_i = M((span_n.array()+i*n).eval(),span_mlbs_cols);
     }
 #else
-    constexpr bool LbsMatrixTypeIsSparse = std::is_base_of<SparseMatrixBase<LbsMatrixType>, LbsMatrixType>::value;
+    constexpr bool LbsMatrixTypeIsSparse = std::is_base_of<Eigen::SparseMatrixBase<LbsMatrixType>, LbsMatrixType>::value;
     arap_dof_slice_helper<LbsMatrixType,LbsMatrixTypeIsSparse>::slice(M,(span_n.array()+i*n).matrix().eval(),span_mlbs_cols,M_i);
 #endif
     LbsMatrixType M_i_dim;
@@ -222,7 +221,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
     assert(data.CSM_M[i].cols() == M.cols());
     for(int j = 0;j<data.dim;j++)
     {
-      SparseMatrix<double> CSMj;
+      Eigen::SparseMatrix<double> CSMj;
       //printf("CSM_M(): slice\n");
       slice(
         CSM,
@@ -236,7 +235,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
       {
         // Convert to full
         //printf("CSM_M(): full\n");
-        MatrixXd CSMjM_ifull(CSMjM_i);
+        Eigen::MatrixXd CSMjM_ifull(CSMjM_i);
 //        printf("CSM_M[%d]: %d %d\n",i,data.CSM_M[i].rows(),data.CSM_M[i].cols());
 //        printf("CSM_M[%d].block(%d*%d=%d,0,%d,%d): %d %d\n",i,j,k,CSMjM_i.rows(),CSMjM_i.cols(),
 //            data.CSM_M[i].block(j*k,0,CSMjM_i.rows(),CSMjM_i.cols()).rows(),
@@ -256,7 +255,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
 
   // precompute arap_rhs matrix
   //printf("arap_rhs()\n");
-  SparseMatrix<double> K;
+  Eigen::SparseMatrix<double> K;
   arap_rhs(V,F,V.cols(),data.energy,K);
 //#ifdef EXTREME_VERBOSE
 //  cout<<"KIJV=["<<endl;print_ijv(K,1);cout<<endl<<"];"<<
@@ -264,8 +263,8 @@ IGL_INLINE bool igl::arap_dof_precomputation(
 //    K.rows()<<","<<K.cols()<<");"<<endl;
 //#endif
   // Precompute left muliplication by M and right multiplication by G_sum
-  SparseMatrix<double> G_sumT = G_sum.transpose();
-  SparseMatrix<double> G_sumT_dim_dim;
+  Eigen::SparseMatrix<double> G_sumT = G_sum.transpose();
+  Eigen::SparseMatrix<double> G_sumT_dim_dim;
   repdiag(G_sumT,data.dim*data.dim,G_sumT_dim_dim);
   LbsMatrixType MT = M.transpose();
   // If this is a bottle neck then consider reordering matrix multiplication
@@ -278,7 +277,7 @@ IGL_INLINE bool igl::arap_dof_precomputation(
 
   // Precompute system matrix
   //printf("A()\n");
-  SparseMatrix<double> A;
+  Eigen::SparseMatrix<double> A;
   repdiag(Lapl,data.dim,A);
   data.Q = MT * (A * M);
 //#ifdef EXTREME_VERBOSE
@@ -291,19 +290,19 @@ IGL_INLINE bool igl::arap_dof_precomputation(
   //if(data.with_dynamics)
   //{
     // Build cotangent laplacian
-    SparseMatrix<double> Mass;
+    Eigen::SparseMatrix<double> Mass;
     //printf("massmatrix()\n");
     massmatrix(V,F,(F.cols()>3?MASSMATRIX_TYPE_BARYCENTRIC:MASSMATRIX_TYPE_VORONOI),Mass);
     //cout<<"MIJV=["<<endl;print_ijv(Mass,1);cout<<endl<<"];"<<
     //  endl<<"M=sparse(MIJV(:,1),MIJV(:,2),MIJV(:,3),"<<
     //  Mass.rows()<<","<<Mass.cols()<<");"<<endl;
     //speye(data.n,Mass);
-    SparseMatrix<double> Mass_rep;
+    Eigen::SparseMatrix<double> Mass_rep;
     repdiag(Mass,data.dim,Mass_rep);
 
     // Multiply either side by weights matrix (should be dense)
     data.Mass_tilde = MT * Mass_rep * M;
-    MatrixXd ones(data.dim*data.n,data.dim);
+    Eigen::MatrixXd ones(data.dim*data.n,data.dim);
     for(int i = 0;i<data.n;i++)
     {
       for(int d = 0;d<data.dim;d++)
@@ -531,8 +530,7 @@ IGL_INLINE bool igl::arap_dof_recomputation(
   const Eigen::SparseMatrix<double> & A_eq,
   ArapDOFData<LbsMatrixType, SSCALAR> & data)
 {
-  using namespace Eigen;
-  typedef Matrix<SSCALAR, Dynamic, Dynamic> MatrixXS;
+  typedef Eigen::Matrix<SSCALAR, Eigen::Dynamic, Eigen::Dynamic> MatrixXS;
 
   LbsMatrixType * Q;
   LbsMatrixType Qdyn;
@@ -577,9 +575,9 @@ IGL_INLINE bool igl::arap_dof_recomputation(
 
   // Compute dense solve matrix (alternative of matrix factorization)
   //printf("kkt_inverse()\n");
-  MatrixXd Qfull(*Q);
-  MatrixXd A_eqfull(A_eq);
-  MatrixXd M_Solve;
+  Eigen::MatrixXd Qfull(*Q);
+  Eigen::MatrixXd A_eqfull(A_eq);
+  Eigen::MatrixXd M_Solve;
 
   double timer0_start = get_seconds();
   bool use_lu = data.effective_dim != 2;
@@ -646,8 +644,7 @@ IGL_INLINE bool igl::arap_dof_update(
   Eigen::MatrixXd & L
   )
 {
-  using namespace Eigen;
-  typedef Matrix<SSCALAR, Dynamic, Dynamic> MatrixXS;
+  typedef Eigen::Matrix<SSCALAR, Eigen::Dynamic, Eigen::Dynamic> MatrixXS;
 #ifdef ARAP_GLOBAL_TIMING
   double timer_start = get_seconds();
 #endif
@@ -700,9 +697,9 @@ IGL_INLINE bool igl::arap_dof_update(
   MatrixXS S(k*data.dim,data.dim);
   MatrixXS R(data.dim,data.dim*k);
   Eigen::Matrix<SSCALAR,Eigen::Dynamic,1> Rcol(data.dim * data.dim * k);
-  Matrix<SSCALAR,Dynamic,1> B_eq_SSCALAR = B_eq.cast<SSCALAR>();
-  Matrix<SSCALAR,Dynamic,1> L0SSCALAR = L0.cast<SSCALAR>();
-  Matrix<SSCALAR,Dynamic,1> B_eq_fix_SSCALAR = L0SSCALAR(data.fixed_dim);
+  Eigen::Matrix<SSCALAR ,Eigen::Dynamic,1> B_eq_SSCALAR = B_eq.cast<SSCALAR>();
+  Eigen::Matrix<SSCALAR ,Eigen::Dynamic,1> L0SSCALAR = L0.cast<SSCALAR>();
+  Eigen::Matrix<SSCALAR ,Eigen::Dynamic,1> B_eq_fix_SSCALAR = L0SSCALAR(data.fixed_dim);
   //MatrixXS rhsFull(Rcol.rows() + B_eq.rows() + B_eq_fix_SSCALAR.rows(), 1); 
 
   MatrixXS Lsep(data.m*(data.dim + 1), 3);  
@@ -831,13 +828,13 @@ IGL_INLINE bool igl::arap_dof_update(
           ( (-1.0/(data.h*data.h)) * data.L0.array() + 
             (1.0/(data.h)) * data.Lvel0.array()
             ).matrix();
-      MatrixXd temp_d = temp.template cast<double>();
+      Eigen::MatrixXd temp_d = temp.template cast<double>();
 
-      MatrixXd temp_g = data.fgrav*(data.grav_mag*data.grav_dir);
+      Eigen::MatrixXd temp_g = data.fgrav*(data.grav_mag*data.grav_dir);
 
       assert(data.fext.rows() == temp_g.rows());
       assert(data.fext.cols() == temp_g.cols());
-      MatrixXd temp2 = data.Mass_tilde * temp_d + temp_g + data.fext.template cast<double>();
+      Eigen::MatrixXd temp2 = data.Mass_tilde * temp_d + temp_g + data.fext.template cast<double>();
       MatrixXS temp2_f = temp2.template cast<SSCALAR>();
       L_part1_dyn = data.Pi_1 * temp2_f;
       L_part1.array() = L_part1.array() + L_part1_dyn.array();

+ 21 - 27
include/igl/arap_linear_block.cpp

@@ -45,16 +45,14 @@ IGL_INLINE void igl::arap_linear_block_spokes(
 {
   typedef typename MatK::Scalar Scalar;
 
-  using namespace std;
-  using namespace Eigen;
   // simplex size (3: triangles, 4: tetrahedra)
   int simplex_size = F.cols();
   // Number of elements
   int m = F.rows();
   // Temporary output
-  Matrix<int,Dynamic,2> edges;
+  Eigen::Matrix<int ,Eigen::Dynamic,2> edges;
   Kd.resize(V.rows(), V.rows());
-  vector<Triplet<Scalar> > Kd_IJV;
+  std::vector<Eigen::Triplet<Scalar> > Kd_IJV;
   if(simplex_size == 3)
   {
     // triangles
@@ -80,7 +78,7 @@ IGL_INLINE void igl::arap_linear_block_spokes(
       3,2;
   }
   // gather cotangent weights
-  Matrix<Scalar,Dynamic,Dynamic> C;
+  Eigen::Matrix<Scalar ,Eigen::Dynamic ,Eigen::Dynamic> C;
   cotmatrix_entries(V,F,C);
   // should have weights for each edge
   assert(C.cols() == edges.rows());
@@ -93,10 +91,10 @@ IGL_INLINE void igl::arap_linear_block_spokes(
       int source = F(i,edges(e,0));
       int dest = F(i,edges(e,1));
       double v = 0.5*C(i,e)*(V(source,d)-V(dest,d));
-      Kd_IJV.push_back(Triplet<Scalar>(source,dest,v));
-      Kd_IJV.push_back(Triplet<Scalar>(dest,source,-v));
-      Kd_IJV.push_back(Triplet<Scalar>(source,source,v));
-      Kd_IJV.push_back(Triplet<Scalar>(dest,dest,-v));
+      Kd_IJV.push_back(Eigen::Triplet<Scalar>(source,dest,v));
+      Kd_IJV.push_back(Eigen::Triplet<Scalar>(dest,source,-v));
+      Kd_IJV.push_back(Eigen::Triplet<Scalar>(source,source,v));
+      Kd_IJV.push_back(Eigen::Triplet<Scalar>(dest,dest,-v));
     }
   }
   Kd.setFromTriplets(Kd_IJV.begin(),Kd_IJV.end());
@@ -112,16 +110,14 @@ IGL_INLINE void igl::arap_linear_block_spokes_and_rims(
 {
   typedef typename MatK::Scalar Scalar;
 
-  using namespace std;
-  using namespace Eigen;
   // simplex size (3: triangles, 4: tetrahedra)
   int simplex_size = F.cols();
   // Number of elements
   int m = F.rows();
   // Temporary output
   Kd.resize(V.rows(), V.rows());
-  vector<Triplet<Scalar> > Kd_IJV;
-  Matrix<int,Dynamic,2> edges;
+  std::vector<Eigen::Triplet<Scalar> > Kd_IJV;
+  Eigen::Matrix<int ,Eigen::Dynamic,2> edges;
   if(simplex_size == 3)
   {
     // triangles
@@ -149,7 +145,7 @@ IGL_INLINE void igl::arap_linear_block_spokes_and_rims(
     assert(false);
   }
   // gather cotangent weights
-  Matrix<Scalar,Dynamic,Dynamic> C;
+  Eigen::Matrix<Scalar ,Eigen::Dynamic ,Eigen::Dynamic> C;
   cotmatrix_entries(V,F,C);
   // should have weights for each edge
   assert(C.cols() == edges.rows());
@@ -169,18 +165,18 @@ IGL_INLINE void igl::arap_linear_block_spokes_and_rims(
         int Rd = F(i,edges(f,1));
         if(Rs == source && Rd == dest)
         {
-          Kd_IJV.push_back(Triplet<Scalar>(Rs,Rd,v));
-          Kd_IJV.push_back(Triplet<Scalar>(Rd,Rs,-v));
+          Kd_IJV.push_back(Eigen::Triplet<Scalar>(Rs,Rd,v));
+          Kd_IJV.push_back(Eigen::Triplet<Scalar>(Rd,Rs,-v));
         }else if(Rd == source)
         {
-          Kd_IJV.push_back(Triplet<Scalar>(Rd,Rs,v));
+          Kd_IJV.push_back(Eigen::Triplet<Scalar>(Rd,Rs,v));
         }else if(Rs == dest)
         {
-          Kd_IJV.push_back(Triplet<Scalar>(Rs,Rd,-v));
+          Kd_IJV.push_back(Eigen::Triplet<Scalar>(Rs,Rd,-v));
         }
       }
-      Kd_IJV.push_back(Triplet<Scalar>(source,source,v));
-      Kd_IJV.push_back(Triplet<Scalar>(dest,dest,-v));
+      Kd_IJV.push_back(Eigen::Triplet<Scalar>(source,source,v));
+      Kd_IJV.push_back(Eigen::Triplet<Scalar>(dest,dest,-v));
     }
   }
   Kd.setFromTriplets(Kd_IJV.begin(),Kd_IJV.end());
@@ -195,16 +191,14 @@ IGL_INLINE void igl::arap_linear_block_elements(
   MatK & Kd)
 {
   typedef typename MatK::Scalar Scalar;
-  using namespace std;
-  using namespace Eigen;
   // simplex size (3: triangles, 4: tetrahedra)
   int simplex_size = F.cols();
   // Number of elements
   int m = F.rows();
   // Temporary output
   Kd.resize(V.rows(), F.rows());
-  vector<Triplet<Scalar> > Kd_IJV;
-  Matrix<int,Dynamic,2> edges;
+  std::vector<Eigen::Triplet<Scalar> > Kd_IJV;
+  Eigen::Matrix<int ,Eigen::Dynamic,2> edges;
   if(simplex_size == 3)
   {
     // triangles
@@ -230,7 +224,7 @@ IGL_INLINE void igl::arap_linear_block_elements(
       3,2;
   }
   // gather cotangent weights
-  Matrix<Scalar,Dynamic,Dynamic> C;
+  Eigen::Matrix<Scalar ,Eigen::Dynamic ,Eigen::Dynamic> C;
   cotmatrix_entries(V,F,C);
   // should have weights for each edge
   assert(C.cols() == edges.rows());
@@ -243,8 +237,8 @@ IGL_INLINE void igl::arap_linear_block_elements(
       int source = F(i,edges(e,0));
       int dest = F(i,edges(e,1));
       double v = C(i,e)*(V(source,d)-V(dest,d));
-      Kd_IJV.push_back(Triplet<Scalar>(source,i,v));
-      Kd_IJV.push_back(Triplet<Scalar>(dest,i,-v));
+      Kd_IJV.push_back(Eigen::Triplet<Scalar>(source,i,v));
+      Kd_IJV.push_back(Eigen::Triplet<Scalar>(dest,i,-v));
     }
   }
   Kd.setFromTriplets(Kd_IJV.begin(),Kd_IJV.end());

+ 0 - 2
include/igl/arap_rhs.cpp

@@ -20,8 +20,6 @@ IGL_INLINE void igl::arap_rhs(
     const igl::ARAPEnergyType energy,
     Eigen::SparseCompressedBase<DerivedK>& K)
 {
-  using namespace std;
-  using namespace Eigen;
   // Number of dimensions
   int Vdim = V.cols();
   //// Number of mesh vertices

+ 3 - 3
include/igl/avg_edge_length.h

@@ -17,9 +17,9 @@ namespace igl
 {
   /// Compute the average edge length for the given triangle mesh
   ///
-  /// @tparam DerivedV derived from vertex positions matrix type: i.e. MatrixXd
-  /// @tparam DerivedF derived from face indices matrix type: i.e. MatrixXi
-  /// @tparam DerivedL derived from edge lengths matrix type: i.e. MatrixXd
+  /// @tparam DerivedV derived from vertex positions matrix type: i.e. Eigen::MatrixXd
+  /// @tparam DerivedF derived from face indices matrix type: i.e. Eigen::MatrixXi
+  /// @tparam DerivedL derived from edge lengths matrix type: i.e. Eigen::MatrixXd
   /// @param[in] V  #V by dim list of mesh vertex positions
   /// @param[in] F  #F by simplex-size list of mesh faces (must be simplex)
   /// @return average edge length

+ 1 - 3
include/igl/barycentric_coordinates.cpp

@@ -23,7 +23,6 @@ IGL_INLINE void igl::barycentric_coordinates(
   const Eigen::MatrixBase<DerivedD> & D,
   Eigen::PlainObjectBase<DerivedL> & L)
 {
-  using namespace Eigen;
   assert(P.cols() == 3 && "query must be in 3d");
   assert(A.cols() == 3 && "corners must be in 3d");
   assert(B.cols() == 3 && "corners must be in 3d");
@@ -33,7 +32,7 @@ IGL_INLINE void igl::barycentric_coordinates(
   assert(A.rows() == B.rows() && "Corners must be same size");
   assert(A.rows() == C.rows() && "Corners must be same size");
   assert(A.rows() == D.rows() && "Corners must be same size");
-  typedef Matrix<typename DerivedL::Scalar,DerivedL::RowsAtCompileTime,1> 
+  typedef Eigen::Matrix<typename DerivedL::Scalar,DerivedL::RowsAtCompileTime,1>
     VectorXS;
   // Total volume
   VectorXS vol,LA,LB,LC,LD;
@@ -60,7 +59,6 @@ IGL_INLINE void igl::barycentric_coordinates(
   const Eigen::MatrixBase<DerivedC> & C,
   Eigen::PlainObjectBase<DerivedL> & L)
 {
-  using namespace Eigen;
 #ifndef NDEBUG
   const int DIM = P.cols();
   assert(A.cols() == DIM && "corners must be in same dimension as query");

+ 17 - 20
include/igl/bbw.cpp

@@ -26,9 +26,8 @@ igl::BBWData::BBWData():
 
 void igl::BBWData::print()
 {
-  using namespace std;
-  cout<<"partition_unity: "<<partition_unity<<endl;
-  cout<<"W0=["<<endl<<W0<<endl<<"];"<<endl;
+  std::cout<<"partition_unity: "<<partition_unity<<std::endl;
+  std::cout<<"W0=["<<std::endl<<W0<<std::endl<<"];"<<std::endl;
 }
 
 
@@ -47,8 +46,6 @@ IGL_INLINE bool igl::bbw(
   Eigen::PlainObjectBase<DerivedW> & W
   )
 {
-  using namespace std;
-  using namespace Eigen;
   assert(!data.partition_unity && "partition_unity not implemented yet");
   // number of domain vertices
   int n = V.rows();
@@ -59,23 +56,23 @@ IGL_INLINE bool igl::bbw(
   harmonic(V,Ele,2,Q);
   W.derived().resize(n,m);
   // No linear terms
-  VectorXd c = VectorXd::Zero(n);
+  Eigen::VectorXd c = Eigen::VectorXd::Zero(n);
   // No linear constraints
-  SparseMatrix<typename DerivedW::Scalar> A(0,n),Aeq(0,n),Aieq(0,n);
-  VectorXd Beq(0,1),Bieq(0,1);
+  Eigen::SparseMatrix<typename DerivedW::Scalar> A(0,n),Aeq(0,n),Aieq(0,n);
+  Eigen::VectorXd Beq(0,1),Bieq(0,1);
   // Upper and lower box constraints (Constant bounds)
-  VectorXd ux = VectorXd::Ones(n);
-  VectorXd lx = VectorXd::Zero(n);
+  Eigen::VectorXd ux = Eigen::VectorXd::Ones(n);
+  Eigen::VectorXd lx = Eigen::VectorXd::Zero(n);
   active_set_params eff_params = data.active_set_params;
   if(data.verbosity >= 1)
   {
-    cout<<"BBW: max_iter: "<<data.active_set_params.max_iter<<endl;
-    cout<<"BBW: eff_max_iter: "<<eff_params.max_iter<<endl;
+    std::cout<<"BBW: max_iter: "<<data.active_set_params.max_iter<<std::endl;
+    std::cout<<"BBW: eff_max_iter: "<<eff_params.max_iter<<std::endl;
   }
   if(data.verbosity >= 1)
   {
-    cout<<"BBW: Computing initial weights for "<<m<<" handle"<<
-      (m!=1?"s":"")<<"."<<endl;
+    std::cout<<"BBW: Computing initial weights for "<<m<<" handle"<<
+      (m!=1?"s":"")<<"."<<std::endl;
   }
   min_quad_with_fixed_data<typename DerivedW::Scalar > mqwf;
   min_quad_with_fixed_precompute(Q,b,Aeq,true,mqwf);
@@ -95,11 +92,11 @@ IGL_INLINE bool igl::bbw(
     if(data.verbosity >= 1)
     {
       std::lock_guard<std::mutex> lock(critical);
-      cout<<"BBW: Computing weight for handle "<<i+1<<" out of "<<m<<
-        "."<<endl;
+      std::cout<<"BBW: Computing weight for handle "<<i+1<<" out of "<<m<<
+        "."<<std::endl;
     }
-    VectorXd bci = bc.col(i);
-    VectorXd Wi;
+    Eigen::VectorXd bci = bc.col(i);
+    Eigen::VectorXd Wi;
     // use initial guess
     Wi = W.col(i);
     SolverStatus ret = active_set(
@@ -133,8 +130,8 @@ IGL_INLINE bool igl::bbw(
   const double min_rowsum = W.rowwise().sum().array().abs().minCoeff();
   if(min_rowsum < 0.1)
   {
-    cerr<<"bbw.cpp: Warning, minimum row sum is very low. Consider more "
-      "active set iterations or enforcing partition of unity."<<endl;
+    std::cerr<<"bbw.cpp: Warning, minimum row sum is very low. Consider more "
+      "active set iterations or enforcing partition of unity."<<std::endl;
   }
 #endif
 

+ 5 - 5
include/igl/bbw.h

@@ -40,11 +40,11 @@ namespace igl
   /// Compute Bounded Biharmonic Weights on a given domain (V,Ele) with a given
   /// set of boundary conditions
   ///
-  /// @tparam DerivedV  derived type of eigen matrix for V (e.g. MatrixXd)
-  /// @tparam DerivedF  derived type of eigen matrix for F (e.g. MatrixXi)
-  /// @tparam Derivedb  derived type of eigen matrix for b (e.g. VectorXi)
-  /// @tparam Derivedbc  derived type of eigen matrix for bc (e.g. MatrixXd)
-  /// @tparam DerivedW  derived type of eigen matrix for W (e.g. MatrixXd)
+  /// @tparam DerivedV  derived type of eigen matrix for V (e.g. Eigen::MatrixXd)
+  /// @tparam DerivedF  derived type of eigen matrix for F (e.g. Eigen::MatrixXi)
+  /// @tparam Derivedb  derived type of eigen matrix for b (e.g. Eigen::VectorXi)
+  /// @tparam Derivedbc  derived type of eigen matrix for bc (e.g. Eigen::MatrixXd)
+  /// @tparam DerivedW  derived type of eigen matrix for W (e.g. Eigen::MatrixXd)
   /// @param[in] V  #V by dim vertex positions
   /// @param[in] Ele  #Elements by simplex-size list of element indices
   /// @param[in] b  #b boundary indices into V

+ 6 - 8
include/igl/bfs_orient.cpp

@@ -17,16 +17,14 @@ IGL_INLINE void igl::bfs_orient(
   Eigen::PlainObjectBase<DerivedFF> & FF,
   Eigen::PlainObjectBase<DerivedC> & C)
 {
-  using namespace Eigen;
-  using namespace std;
-  SparseMatrix<typename DerivedF::Scalar> A;
+  Eigen::SparseMatrix<typename DerivedF::Scalar> A;
   orientable_patches(F,C,A);
 
   // number of faces
   const int m = F.rows();
   // number of patches
   const int num_cc = C.maxCoeff()+1;
-  VectorXi seen = VectorXi::Zero(m);
+  Eigen::VectorXi seen = Eigen::VectorXi::Zero(m);
 
   // Edge sets
   const int ES[3][2] = {{1,2},{2,0},{0,1}};
@@ -38,7 +36,7 @@ IGL_INLINE void igl::bfs_orient(
   // loop over patches
   parallel_for(num_cc,[&](const int c)
   {
-    queue<typename DerivedF::Scalar> Q;
+    std::queue<typename DerivedF::Scalar> Q;
     // find first member of patch c
     for(int f = 0;f<FF.rows();f++)
     {
@@ -59,7 +57,7 @@ IGL_INLINE void igl::bfs_orient(
       }
       seen(f)++;
       // loop over neighbors of f
-      for(typename SparseMatrix<typename DerivedF::Scalar>::InnerIterator it (A,f); it; ++it)
+      for(typename Eigen::SparseMatrix<typename DerivedF::Scalar>::InnerIterator it (A,f); it; ++it)
       {
         // might be some lingering zeros, and skip self-adjacency
         if(it.value() != 0 && it.row() != f)
@@ -70,12 +68,12 @@ IGL_INLINE void igl::bfs_orient(
           for(int efi = 0;efi<3;efi++)
           {
             // efi'th edge of face f
-            Vector2i ef(FF(f,ES[efi][0]),FF(f,ES[efi][1]));
+            Eigen::Vector2i ef(FF(f,ES[efi][0]),FF(f,ES[efi][1]));
             // loop over edges of n
             for(int eni = 0;eni<3;eni++)
             {
               // eni'th edge of face n
-              Vector2i en(FF(n,ES[eni][0]),FF(n,ES[eni][1]));
+              Eigen::Vector2i en(FF(n,ES[eni][0]),FF(n,ES[eni][1]));
               // Match (half-edges go same direction)
               if(ef(0) == en(0) && ef(1) == en(1))
               {

+ 19 - 22
include/igl/biharmonic_coordinates.cpp

@@ -42,30 +42,27 @@ IGL_INLINE bool igl::biharmonic_coordinates(
   const int k,
   Eigen::PlainObjectBase<DerivedW> & W)
 {
-  using namespace Eigen;
-  using namespace std;
-
   typedef typename DerivedV::Scalar Scalar;
   typedef typename DerivedT::Scalar Integer;
 
   // This is not the most efficient way to build A, but follows "Linear
   // Subspace Design for Real-Time Shape Deformation" [Wang et al. 2015].
-  SparseMatrix<Scalar> A;
+  Eigen::SparseMatrix<Scalar> A;
   {
-    DiagonalMatrix<Scalar, Dynamic> Minv;
-    SparseMatrix<Scalar> L, K;
-    Array<bool,Dynamic,Dynamic> C;
+    Eigen::DiagonalMatrix<Scalar, Eigen::Dynamic> Minv;
+    Eigen::SparseMatrix<Scalar> L, K;
+    Eigen::Array<bool ,Eigen::Dynamic ,Eigen::Dynamic> C;
     {
-      Array<bool,Dynamic,1> I;
+      Eigen::Array<bool ,Eigen::Dynamic,1> I;
       on_boundary(T,I,C);
     }
 #ifdef false
     // Version described in paper is "wrong"
     // http://www.cs.toronto.edu/~jacobson/images/error-in-linear-subspace-design-for-real-time-shape-deformation-2017-wang-et-al.pdf
-    SparseMatrix<Scalar> N, Z, M;
+    Eigen::SparseMatrix<Scalar> N, Z, M;
     normal_derivative(V,T,N);
     {
-      std::vector<Triplet<Scalar>> ZIJV;
+      std::vector<Eigen::Triplet<Scalar>> ZIJV;
       for(int t =0;t<T.rows();t++)
       {
         for(int f =0;f<T.cols();f++)
@@ -88,13 +85,13 @@ IGL_INLINE bool igl::biharmonic_coordinates(
     K = N+L;
     massmatrix(V,T,MASSMATRIX_TYPE_DEFAULT,M);
     // normalize
-    M /= ((Matrix<Scalar, Dynamic, 1>)M.diagonal()).array().abs().maxCoeff();
+    M /= ((Matrix<Scalar, Eigen::Dynamic, 1>)M.diagonal()).array().abs().maxCoeff();
     Minv =
-      ((Matrix<Scalar, Dynamic, 1>)M.diagonal().array().inverse()).asDiagonal();
+      ((Matrix<Scalar, Eigen::Dynamic, 1>)M.diagonal().array().inverse()).asDiagonal();
 #else
     Eigen::SparseMatrix<Scalar> M;
-    Eigen::Matrix<Integer, Dynamic, Dynamic> E;
-    Eigen::Matrix<Integer, Dynamic, 1> EMAP;
+    Eigen::Matrix<Integer, Eigen::Dynamic, Eigen::Dynamic> E;
+    Eigen::Matrix<Integer, Eigen::Dynamic, 1> EMAP;
     crouzeix_raviart_massmatrix(V,T,M,E,EMAP);
     crouzeix_raviart_cotmatrix(V,T,E,EMAP,L);
     // Ad  #E by #V facet-vertex incidence matrix
@@ -111,14 +108,14 @@ IGL_INLINE bool igl::biharmonic_coordinates(
       Ad.setFromTriplets(AIJV.begin(),AIJV.end());
     }
     // Degrees
-    Eigen::Matrix<Scalar, Dynamic, 1> De;
+    Eigen::Matrix<Scalar, Eigen::Dynamic, 1> De;
     sum(Ad,2,De);
     Eigen::DiagonalMatrix<Scalar,Eigen::Dynamic> De_diag =
       De.array().inverse().matrix().asDiagonal();
     K = L*(De_diag*Ad);
     // normalize
-    M /= ((Matrix<Scalar, Dynamic, 1>)M.diagonal()).array().abs().maxCoeff();
-    Minv = ((Matrix<Scalar, Dynamic, 1>)M.diagonal().array().inverse()).asDiagonal();
+    M /= ((Eigen::Matrix<Scalar, Eigen::Dynamic, 1>)M.diagonal()).array().abs().maxCoeff();
+    Minv = ((Eigen::Matrix<Scalar, Eigen::Dynamic, 1>)M.diagonal().array().inverse()).asDiagonal();
     // kill boundary edges
     for(int f = 0;f<T.rows();f++)
     {
@@ -149,7 +146,7 @@ IGL_INLINE bool igl::biharmonic_coordinates(
   }
   // Vertices in point handles
   const size_t mp =
-    count_if(S.begin(),S.end(),[](const vector<SType> & h){return h.size()==1;});
+    count_if(S.begin(),S.end(),[](const std::vector<SType> & h){return h.size()==1;});
   // number of region handles
   const size_t r = S.size()-mp;
   // Vertices in region handles
@@ -163,9 +160,9 @@ IGL_INLINE bool igl::biharmonic_coordinates(
   }
   const size_t dim = T.cols()-1;
   // Might as well be dense... I think...
-  Matrix<Scalar, Dynamic, Dynamic> J = Matrix<Scalar, Dynamic, Dynamic>::Zero(mp+mr,mp+r*(dim+1));
-  Matrix<Integer, Dynamic, 1> b(mp+mr);
-  Matrix<Scalar, Dynamic, Dynamic> H(mp+r*(dim+1),dim);
+  Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> J = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>::Zero(mp+mr,mp+r*(dim+1));
+  Eigen::Matrix<Integer, Eigen::Dynamic, 1> b(mp+mr);
+  Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> H(mp+r*(dim+1),dim);
   {
     int v = 0;
     int c = 0;
@@ -198,7 +195,7 @@ IGL_INLINE bool igl::biharmonic_coordinates(
   // minimize    ½ W' A W'
   // subject to  W(b,:) = J
   return min_quad_with_fixed(
-    A,Matrix<Scalar, Dynamic, 1>::Zero(A.rows()).eval(),b,J,SparseMatrix<Scalar>(),Matrix<Scalar, Dynamic, 1>(),true,W);
+    A,Eigen::Matrix<Scalar, Eigen::Dynamic, 1>::Zero(A.rows()).eval(),b,J,Eigen::SparseMatrix<Scalar>(),Eigen::Matrix<Scalar, Eigen::Dynamic, 1>(),true,W);
 }
 
 #ifdef IGL_STATIC_LIBRARY

+ 2 - 2
include/igl/biharmonic_coordinates.h

@@ -39,10 +39,10 @@ namespace igl
   /// #### Example:
   ///
   /// \code{cpp}
-  ///     MatrixXd W;
+  ///     Eigen::MatrixXd W;
   ///     igl::biharmonic_coordinates(V,F,S,W);
   ///     const size_t dim = T.cols()-1;
-  ///     MatrixXd H(W.cols(),dim);
+  ///     Eigen::MatrixXd H(W.cols(),dim);
   ///     {
   ///       int c = 0;
   ///       for(int h = 0;h<S.size();h++)

+ 21 - 24
include/igl/boundary_conditions.cpp

@@ -36,23 +36,20 @@ IGL_INLINE bool igl::boundary_conditions(
   Eigen::PlainObjectBase<Derivedb> & b,
   Eigen::PlainObjectBase<Derivedbc> & bc)
 {
-  using namespace Eigen;
-  using namespace std;
-
   if(P.size()+BE.rows() == 0)
   {
     verbose("^%s: Error: no handles found\n",__FUNCTION__);
     return false;
   }
 
-  vector<int> bci;
-  vector<int> bcj;
-  vector<double> bcv;
+  std::vector<int> bci;
+  std::vector<int> bcj;
+  std::vector<double> bcv;
 
   // loop over points
   for(int p = 0;p<P.size();p++)
   {
-    VectorXd pos = C.row(P(p));
+    Eigen::VectorXd pos = C.row(P(p));
     // loop over domain vertices
     for(int i = 0;i<V.rows();i++)
     {
@@ -61,7 +58,7 @@ IGL_INLINE bool igl::boundary_conditions(
       // EIGEN GOTCHA:
       // double sqrd = (V.row(i)-pos).array().pow(2).sum();
       // Must first store in temporary
-      VectorXd vi = V.row(i);
+      Eigen::VectorXd vi = V.row(i);
       double sqrd = (vi-pos).squaredNorm();
       if(sqrd <= FLOAT_EPS)
       {
@@ -86,8 +83,8 @@ IGL_INLINE bool igl::boundary_conditions(
     for(int i = 0;i<V.rows();i++)
     {
       // Find samples from tip up to tail
-      VectorXd tip = C.row(BE(e,0));
-      VectorXd tail = C.row(BE(e,1));
+      Eigen::VectorXd tip = C.row(BE(e,0));
+      Eigen::VectorXd tail = C.row(BE(e,1));
       // Compute parameter along bone and squared distance
       double t,sqrd;
       project_to_line(
@@ -111,8 +108,8 @@ IGL_INLINE bool igl::boundary_conditions(
     for(int i = 0;i<V.rows();i++)
     {
       // Find samples from tip up to tail
-      VectorXd tip = C.row(P(CE(e,0)));
-      VectorXd tail = C.row(P(CE(e,1)));
+      Eigen::VectorXd tip = C.row(P(CE(e,0)));
+      Eigen::VectorXd tail = C.row(P(CE(e,1)));
       // Compute parameter along bone and squared distance
       double t,sqrd;
       project_to_line(
@@ -136,10 +133,10 @@ IGL_INLINE bool igl::boundary_conditions(
   // loop over cage faces
   for(int f = 0;f<CF.rows();f++)
   {
-    Vector3d v_0 = C.row(P(CF(f, 0)));
-    Vector3d v_1 = C.row(P(CF(f, 1)));
-    Vector3d v_2 = C.row(P(CF(f, 2)));
-    Vector3d n = (v_1 - v_0).cross(v_2 - v_1);
+    Eigen::Vector3d v_0 = C.row(P(CF(f, 0)));
+    Eigen::Vector3d v_1 = C.row(P(CF(f, 1)));
+    Eigen::Vector3d v_2 = C.row(P(CF(f, 2)));
+    Eigen::Vector3d n = (v_1 - v_0).cross(v_2 - v_1);
     n.normalize();
     // loop over domain vertices
     for (int i = 0;i<V.rows();i++)
@@ -149,13 +146,13 @@ IGL_INLINE bool igl::boundary_conditions(
       {
           continue;
       }
-      Vector3d point = V.row(i);
-      Vector3d v = point - v_0;
+      Eigen::Vector3d point = V.row(i);
+      Eigen::Vector3d v = point - v_0;
       double dist = abs(v.dot(n));
       if (dist <= 1.e-1f)
       {
         //barycentric coordinates
-        Vector3d vec_0 = v_1 - v_0, vec_1 = v_2 - v_0, vec_2 = point - v_0;
+        Eigen::Vector3d vec_0 = v_1 - v_0, vec_1 = v_2 - v_0, vec_2 = point - v_0;
         double d00 = vec_0.dot(vec_0);
         double d01 = vec_0.dot(vec_1);
         double d11 = vec_1.dot(vec_1);
@@ -184,17 +181,17 @@ IGL_INLINE bool igl::boundary_conditions(
   }
 
   // find unique boundary indices
-  vector<int> vb = bci;
-  sort(vb.begin(),vb.end());
+  std::vector<int> vb = bci;
+  std::sort(vb.begin(),vb.end());
   vb.erase(unique(vb.begin(), vb.end()), vb.end());
 
   b.resize(vb.size());
-  bc = MatrixXd::Zero(vb.size(),P.size()+BE.rows());
+  bc = Eigen::MatrixXd::Zero(vb.size(),P.size()+BE.rows());
   // Map from boundary index to index in boundary
-  map<int,int> bim;
+  std::map<int,int> bim;
   int i = 0;
   // Also fill in b
-  for(vector<int>::iterator bit = vb.begin();bit != vb.end();bit++)
+  for(std::vector<int>::iterator bit = vb.begin();bit != vb.end();bit++)
   {
     b(i) = *bit;
     bim[*bit] = i;

+ 7 - 16
include/igl/boundary_loop.cpp

@@ -16,20 +16,17 @@ IGL_INLINE void igl::boundary_loop(
     const Eigen::MatrixBase<DerivedF> & F,
     std::vector<std::vector<Index> >& L)
 {
-  using namespace std;
-  using namespace Eigen;
-
   if(F.rows() == 0)
     return;
 
-  VectorXd Vdummy(F.maxCoeff()+1,1);
+  Eigen::VectorXd Vdummy(F.maxCoeff()+1,1);
   Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, Eigen::Dynamic> TT,TTi;
-  vector<std::vector<int> > VF, VFi;
+  std::vector<std::vector<int> > VF, VFi;
   triangle_triangle_adjacency(F,TT,TTi);
   vertex_triangle_adjacency(Vdummy,F,VF,VFi);
 
-  vector<bool> unvisited = is_border_vertex(F);
-  set<int> unseen;
+  std::vector<bool> unvisited = is_border_vertex(F);
+  std::set<int> unseen;
   for (size_t i = 0; i < unvisited.size(); ++i)
   {
     if (unvisited[i])
@@ -38,7 +35,7 @@ IGL_INLINE void igl::boundary_loop(
 
   while (!unseen.empty())
   {
-    vector<Index> l;
+    std::vector<Index> l;
 
     // Get first vertex of loop
     int start = *unseen.begin();
@@ -93,13 +90,10 @@ IGL_INLINE void igl::boundary_loop(
   const Eigen::MatrixBase<DerivedF>& F,
   std::vector<Index>& L)
 {
-  using namespace Eigen;
-  using namespace std;
-
   if(F.rows() == 0)
     return;
 
-  vector<vector<int> > Lall;
+  std::vector<std::vector<int> > Lall;
   boundary_loop(F,Lall);
 
   int idxMax = -1;
@@ -132,13 +126,10 @@ IGL_INLINE void igl::boundary_loop(
   const Eigen::MatrixBase<DerivedF>& F,
   Eigen::PlainObjectBase<DerivedL>& L)
 {
-  using namespace Eigen;
-  using namespace std;
-
   if(F.rows() == 0)
     return;
 
-  vector<int> Lvec;
+  std::vector<int> Lvec;
   boundary_loop(F,Lvec);
 
   L.resize(Lvec.size(), 1);

+ 0 - 1
include/igl/bounding_box.cpp

@@ -24,7 +24,6 @@ IGL_INLINE void igl::bounding_box(
   Eigen::PlainObjectBase<DerivedBV>& BV,
   Eigen::PlainObjectBase<DerivedBF>& BF)
 {
-  using namespace std;
 
   const int dim = V.cols();
   const auto & minV = V.colwise().minCoeff().array()-pad;

+ 2 - 3
include/igl/bounding_box_diagonal.cpp

@@ -13,9 +13,8 @@
 IGL_INLINE double igl::bounding_box_diagonal(
   const Eigen::MatrixXd & V)
 {
-  using namespace Eigen;
-  VectorXd maxV,minV;
-  VectorXi maxVI,minVI;
+  Eigen::VectorXd maxV,minV;
+  Eigen::VectorXi maxVI,minVI;
   igl::max(V,1,maxV,maxVI);
   igl::min(V,1,minV,minVI);
   return sqrt((maxV-minV).array().square().sum());

+ 9 - 13
include/igl/cat.cpp

@@ -26,7 +26,6 @@ IGL_INLINE void igl::cat(
 {
 
   assert(dim == 1 || dim == 2);
-  using namespace Eigen;
   // Special case if B or A is empty
   if(A.size() == 0)
   {
@@ -40,7 +39,7 @@ IGL_INLINE void igl::cat(
   }
 
   // This is faster than using DynamicSparseMatrix or setFromTriplets
-  C = SparseMatrix<Scalar>(
+  C = Eigen::SparseMatrix<Scalar>(
       dim == 1 ? A.rows()+B.rows() : A.rows(),
       dim == 1 ? A.cols()          : A.cols()+B.cols());
   Eigen::VectorXi per_col = Eigen::VectorXi::Zero(C.cols());
@@ -49,11 +48,11 @@ IGL_INLINE void igl::cat(
     assert(A.outerSize() == B.outerSize());
     for(int k = 0;k<A.outerSize();++k)
     {
-      for(typename SparseMatrix<Scalar>::InnerIterator it (A,k); it; ++it)
+      for(typename Eigen::SparseMatrix<Scalar>::InnerIterator it (A,k); it; ++it)
       {
         per_col(k)++;
       }
-      for(typename SparseMatrix<Scalar>::InnerIterator it (B,k); it; ++it)
+      for(typename Eigen::SparseMatrix<Scalar>::InnerIterator it (B,k); it; ++it)
       {
         per_col(k)++;
       }
@@ -62,14 +61,14 @@ IGL_INLINE void igl::cat(
   {
     for(int k = 0;k<A.outerSize();++k)
     {
-      for(typename SparseMatrix<Scalar>::InnerIterator it (A,k); it; ++it)
+      for(typename Eigen::SparseMatrix<Scalar>::InnerIterator it (A,k); it; ++it)
       {
         per_col(k)++;
       }
     }
     for(int k = 0;k<B.outerSize();++k)
     {
-      for(typename SparseMatrix<Scalar>::InnerIterator it (B,k); it; ++it)
+      for(typename Eigen::SparseMatrix<Scalar>::InnerIterator it (B,k); it; ++it)
       {
         per_col(A.cols() + k)++;
       }
@@ -80,11 +79,11 @@ IGL_INLINE void igl::cat(
   {
     for(int k = 0;k<A.outerSize();++k)
     {
-      for(typename SparseMatrix<Scalar>::InnerIterator it (A,k); it; ++it)
+      for(typename Eigen::SparseMatrix<Scalar>::InnerIterator it (A,k); it; ++it)
       {
         C.insert(it.row(),k) = it.value();
       }
-      for(typename SparseMatrix<Scalar>::InnerIterator it (B,k); it; ++it)
+      for(typename Eigen::SparseMatrix<Scalar>::InnerIterator it (B,k); it; ++it)
       {
         C.insert(A.rows()+it.row(),k) = it.value();
       }
@@ -93,14 +92,14 @@ IGL_INLINE void igl::cat(
   {
     for(int k = 0;k<A.outerSize();++k)
     {
-      for(typename SparseMatrix<Scalar>::InnerIterator it (A,k); it; ++it)
+      for(typename Eigen::SparseMatrix<Scalar>::InnerIterator it (A,k); it; ++it)
       {
         C.insert(it.row(),k) = it.value();
       }
     }
     for(int k = 0;k<B.outerSize();++k)
     {
-      for(typename SparseMatrix<Scalar>::InnerIterator it (B,k); it; ++it)
+      for(typename Eigen::SparseMatrix<Scalar>::InnerIterator it (B,k); it; ++it)
       {
         C.insert(it.row(),A.cols()+k) = it.value();
       }
@@ -157,7 +156,6 @@ IGL_INLINE Mat igl::cat(const int dim, const Mat & A, const Mat & B)
 template <class Mat>
 IGL_INLINE void igl::cat(const std::vector<std::vector< Mat > > & A, Mat & C)
 {
-  using namespace std;
   // Start with empty matrix
   C.resize(0,0);
   for(const auto & row_vec : A)
@@ -178,8 +176,6 @@ template <typename T, typename DerivedC>
 IGL_INLINE void igl::cat(const int dim, const std::vector<T> & A, Eigen::PlainObjectBase<DerivedC> & C)
 {
   assert(dim == 1 || dim == 2);
-  using namespace Eigen;
-
   const int num_mat = A.size();
   if(num_mat == 0)
   {

+ 2 - 2
include/igl/cat.h

@@ -21,8 +21,8 @@ namespace igl
   /// This is an attempt to act like matlab's cat function.
   /// 
   /// @tparam  Scalar  scalar data type for sparse matrices like double or int
-  /// @tparam  Mat  matrix type for all matrices (e.g. MatrixXd, SparseMatrix)
-  /// @tparam  MatC  matrix type for output matrix (e.g. MatrixXd) needs to support
+  /// @tparam  Mat  matrix type for all matrices (e.g. Eigen::MatrixXd, SparseMatrix)
+  /// @tparam  MatC  matrix type for output matrix (e.g. Eigen::MatrixXd) needs to support
   ///     resize
   /// @param[in]  dim  dimension along which to concatenate, 1 or 2
   /// @param[in]  A  first input matrix

+ 0 - 1
include/igl/ceil.cpp

@@ -13,7 +13,6 @@ IGL_INLINE void igl::ceil(
   const Eigen::MatrixBase<DerivedX>& X,
   Eigen::PlainObjectBase<DerivedY>& Y)
 {
-  using namespace std;
   typedef typename DerivedX::Scalar Scalar;
   Y = X.unaryExpr([](const Scalar &x)->Scalar{return std::ceil(x);}).template cast<typename DerivedY::Scalar >();
 }

+ 0 - 1
include/igl/centroid.cpp

@@ -19,7 +19,6 @@ IGL_INLINE void igl::centroid(
   Eigen::PlainObjectBase<Derivedc>& cen,
   Derivedvol & vol)
 {
-  using namespace Eigen;
   assert(F.cols() == 3 && "F should contain triangles.");
   assert(V.cols() == 3 && "V should contain 3d points.");
   const int m = F.rows();

+ 0 - 2
include/igl/collapse_edge.cpp

@@ -70,8 +70,6 @@ IGL_INLINE bool igl::collapse_edge(
   // Assign this to 0 rather than, say, -1 so that deleted elements will get
   // draw as degenerate elements at vertex 0 (which should always exist and
   // never get collapsed to anything else since it is the smallest index)
-  using namespace Eigen;
-  using namespace std;
   const int eflip = E(e,0)>E(e,1);
   // source and destination
   const int s = eflip?E(e,1):E(e,0);

+ 1 - 2
include/igl/collapse_least_cost_edge.cpp

@@ -28,7 +28,6 @@ IGL_INLINE bool igl::collapse_least_cost_edge(
   int & f1,
   int & f2)
 {
-  using namespace Eigen;
   using namespace igl;
   std::tuple<double,int,int> p;
   while(true)
@@ -127,7 +126,7 @@ IGL_INLINE bool igl::collapse_least_cost_edge(
     {
        // compute cost and potential placement
        double cost;
-       RowVectorXd place;
+       Eigen::RowVectorXd place;
        cost_and_placement(ei,V,F,E,EMAP,EF,EI,cost,place);
        // Increment timestamp
        EQ(ei)++;

+ 4 - 7
include/igl/collapse_small_triangles.cpp

@@ -27,14 +27,11 @@ void igl::collapse_small_triangles(
   const double eps,
   Eigen::PlainObjectBase<DerivedFF> & FF)
 {
-  using namespace Eigen;
-  using namespace std;
-
   // Compute bounding box diagonal length
   double bbd = bounding_box_diagonal(V);
-  MatrixXd l;
+  Eigen::MatrixXd l;
   edge_lengths(V,F,l);
-  VectorXd dblA;
+  Eigen::VectorXd dblA;
   doublearea(l,0.,dblA);
 
   // Minimum area tolerance
@@ -85,7 +82,7 @@ void igl::collapse_small_triangles(
   }
 
   // Reindex faces
-  MatrixXi rF = F;
+  Eigen::MatrixXi rF = F;
   // Loop over triangles
   for(int f = 0;f<rF.rows();f++)
   {
@@ -142,7 +139,7 @@ void igl::collapse_small_triangles(
   //// force base case
   //return;
 
-  MatrixXi recFF = FF;
+  Eigen::MatrixXi recFF = FF;
   return collapse_small_triangles(V,recFF,eps,FF);
 }
 

+ 1 - 2
include/igl/column_to_quats.cpp

@@ -11,7 +11,6 @@ IGL_INLINE bool igl::column_to_quats(
   std::vector<
     Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & vQ)
 {
-  using namespace Eigen;
   if(Q.size() % 4 != 0)
   {
     return false;
@@ -21,7 +20,7 @@ IGL_INLINE bool igl::column_to_quats(
   for(int q=0;q<nQ;q++)
   {
     // Constructor uses wxyz
-    vQ[q] = Quaterniond( Q(q*4+3), Q(q*4+0), Q(q*4+1), Q(q*4+2));
+    vQ[q] = Eigen::Quaterniond( Q(q*4+3), Q(q*4+0), Q(q*4+1), Q(q*4+2));
   }
   return true;
 }

+ 0 - 7
include/igl/copyleft/cgal/SelfIntersectMesh.h

@@ -331,9 +331,6 @@ inline igl::copyleft::cgal::SelfIntersectMesh<
   offending(),
   params(params)
 {
-  using namespace std;
-  using namespace Eigen;
-
 #ifdef IGL_SELFINTERSECTMESH_TIMING
   const auto & tictoc = []() -> double
   {
@@ -453,7 +450,6 @@ inline void igl::copyleft::cgal::SelfIntersectMesh<
   DerivedJ,
   DerivedIM>::mark_offensive(const Index f)
 {
-  using namespace std;
   lIF.push_back(f);
   if(offending.count(f) == 0)
   {
@@ -594,7 +590,6 @@ inline bool igl::copyleft::cgal::SelfIntersectMesh<
   const Index va)
 {
   // This was not a good idea. It will not handle coplanar triangles well.
-  using namespace std;
   Segment_3 sa(
     A.vertex((va+1)%3),
     A.vertex((va+2)%3));
@@ -662,8 +657,6 @@ inline bool igl::copyleft::cgal::SelfIntersectMesh<
   const Index fb,
   const std::vector<std::pair<Index,Index> > shared)
 {
-  using namespace std;
-
   auto opposite_vertex = [](const Index a0, const Index a1) {
     // get opposite index of A
     int a2=-1;

+ 2 - 3
include/igl/copyleft/cgal/complex_to_mesh.cpp

@@ -21,7 +21,6 @@ IGL_INLINE bool igl::copyleft::cgal::complex_to_mesh(
   Eigen::PlainObjectBase<DerivedV> & V, 
   Eigen::PlainObjectBase<DerivedF> & F)
 {
-  using namespace Eigen;
   // CGAL/IO/Complex_2_in_triangulation_3_file_writer.h
   using CGAL::Surface_mesher::number_of_facets_on_surface;
 
@@ -140,8 +139,8 @@ IGL_INLINE bool igl::copyleft::cgal::complex_to_mesh(
 
   // CGAL code somehow can end up with unreferenced vertices
   {
-    VectorXi _1;
-    remove_unreferenced( MatrixXd(V), MatrixXi(F), V,F,_1);
+    Eigen::VectorXi _1;
+    remove_unreferenced( Eigen::MatrixXd(V), Eigen::MatrixXi(F), V,F,_1);
   }
 
   return success;

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

@@ -53,12 +53,12 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells(
   using VectorXI = Eigen::Matrix<Index, Eigen::Dynamic, 1>;
   const size_t num_faces = F.rows();
   // Construct edge adjacency
-  MatrixXI E, uE;
-  VectorXI EMAP;
-  VectorXI uEC,uEE;
+  Eigen::MatrixXi E, uE;
+  Eigen::VectorXi EMAP;
+  Eigen::VectorXi uEC,uEE;
   igl::unique_edge_map(F, E, uE, EMAP, uEC, uEE);
   // Cluster into manifold patches
-  VectorXI P;
+  Eigen::VectorXi P;
   igl::extract_manifold_patches(F, EMAP, uEC, uEE, P);
   // Extract cells
   DerivedC per_patch_cells;
@@ -170,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
-  VectorXI outer_facets(num_components);
-  VectorXI outer_facet_orientation(num_components);
-  VectorXI outer_cells(num_components);
+  Eigen::VectorXi outer_facets(num_components);
+  Eigen::VectorXi outer_facet_orientation(num_components);
+  Eigen::VectorXi outer_cells(num_components);
   igl::parallel_for(num_components,[&](size_t i)
   {
     Is[i].resize(components[i].size());
@@ -269,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];
 
-      VectorXI closest_facets, closest_facet_orientations;
+      Eigen::VectorXi closest_facets, closest_facet_orientations;
       closest_facet(
         V,
         F,

+ 1 - 5
include/igl/copyleft/cgal/intersect_other.cpp

@@ -67,9 +67,6 @@ namespace igl
         Eigen::PlainObjectBase<DerivedIMAB> & IMAB)
       {
 
-        using namespace std;
-        using namespace Eigen;
-
         typedef typename DerivedFA::Index Index;
         typedef CGAL::Triangle_3<Kernel> Triangle_3; 
         //// Axis-align boxes for all-pairs self-intersection detection
@@ -108,7 +105,6 @@ namespace igl
         std::list<int> lIF;
         const auto cb = [&](const Box &a, const Box &b) -> void
         {
-          using namespace std;
           // index in F and T
           int fa = a.handle()-TA.begin();
           int fb = b.handle()-TB.begin();
@@ -154,7 +150,7 @@ namespace igl
         {
           int i=0;
           for(
-            list<int>::const_iterator ifit = lIF.begin();
+            std::list<int>::const_iterator ifit = lIF.begin();
             ifit!=lIF.end();
             )
           {

+ 17 - 21
include/igl/copyleft/cgal/minkowski_sum.cpp

@@ -38,8 +38,6 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   Eigen::PlainObjectBase<DerivedG> & G,
   Eigen::PlainObjectBase<DerivedJ> & J)
 {
-  using namespace std;
-  using namespace Eigen;
   assert(FA.cols() == 3 && "FA must contain a closed triangle mesh");
   assert(FB.cols() <= FA.cols() && 
     "FB must contain lower diemnsional simplices than FA");
@@ -52,9 +50,9 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
     return interval;
   };
   tictoc();
-  Matrix<typename DerivedFB::Scalar,Dynamic,2> EB;
+  Eigen::Matrix<typename DerivedFB::Scalar ,Eigen::Dynamic,2> EB;
   edges(FB,EB);
-  Matrix<typename DerivedFA::Scalar,Dynamic,2> EA(0,2);
+  Eigen::Matrix<typename DerivedFA::Scalar ,Eigen::Dynamic,2> EA(0,2);
   if(FB.cols() == 3)
   {
     edges(FA,EA);
@@ -64,15 +62,15 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   // number of copies of B along edges of A
   const int n_ba = EA.rows();
 
-  vector<DerivedW> vW(n_ab + n_ba);
-  vector<DerivedG> vG(n_ab + n_ba);
-  vector<DerivedJ> vJ(n_ab + n_ba);
-  vector<int> offsets(n_ab + n_ba + 1);
+  std::vector<DerivedW> vW(n_ab + n_ba);
+  std::vector<DerivedG> vG(n_ab + n_ba);
+  std::vector<DerivedJ> vJ(n_ab + n_ba);
+  std::vector<int> offsets(n_ab + n_ba + 1);
   offsets[0] = 0;
   // sweep A along edges of B
   for(int e = 0;e<n_ab;e++)
   {
-    Matrix<typename DerivedJ::Scalar,Dynamic,1> eJ;
+    Eigen::Matrix<typename DerivedJ::Scalar ,Eigen::Dynamic,1> eJ;
     minkowski_sum(
       VA,
       FA,
@@ -92,7 +90,7 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   // sweep B along edges of A
   for(int e = 0;e<n_ba;e++)
   {
-    Matrix<typename DerivedJ::Scalar,Dynamic,1> eJ;
+    Eigen::Matrix<typename DerivedJ::Scalar ,Eigen::Dynamic,1> eJ;
     const int ee = n_ab+e;
     minkowski_sum(
       VB,
@@ -110,8 +108,8 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   }
   // Combine meshes
   int n=0,m=0;
-  for_each(vW.begin(),vW.end(),[&n](const DerivedW & w){n+=w.rows();});
-  for_each(vG.begin(),vG.end(),[&m](const DerivedG & g){m+=g.rows();});
+  std::for_each(vW.begin(),vW.end(),[&n](const DerivedW & w){n+=w.rows();});
+  std::for_each(vG.begin(),vG.end(),[&m](const DerivedG & g){m+=g.rows();});
   assert(n == offsets.back());
 
   W.resize(n,3);
@@ -136,8 +134,8 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
     mesh_boolean(
       DerivedW(W),
       DerivedG(G),
-      Matrix<typename DerivedW::Scalar,Dynamic,Dynamic>(),
-      Matrix<typename DerivedG::Scalar,Dynamic,Dynamic>(),
+      Eigen::Matrix<typename DerivedW::Scalar ,Eigen::Dynamic ,Eigen::Dynamic>(),
+      Eigen::Matrix<typename DerivedG::Scalar ,Eigen::Dynamic ,Eigen::Dynamic>(),
       MESH_BOOLEAN_TYPE_UNION,
       W,
       G,
@@ -164,8 +162,6 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   Eigen::PlainObjectBase<DerivedG> & G,
   Eigen::PlainObjectBase<DerivedJ> & J)
 {
-  using namespace Eigen;
-  using namespace std;
   assert(s.cols() == 3 && "s should be a 3d point");
   assert(d.cols() == 3 && "d should be a 3d point");
   // silly base case
@@ -198,7 +194,7 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   //// Mask whether positive dot product, or negative: because of exactly zero,
   //// these are not necessarily complementary
   // Nevermind, actually P = !N
-  Array<bool,Dynamic,1> P(m,1),N(m,1);
+  Eigen::Array<bool ,Eigen::Dynamic,1> P(m,1),N(m,1);
   // loop over faces
   int mp = 0,mn = 0;
   for(int f = 0;f<m;f++)
@@ -227,8 +223,8 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
     }
   }
 
-  typedef Matrix<typename DerivedG::Scalar,Dynamic,Dynamic> MatrixXI;
-  typedef Matrix<typename DerivedG::Scalar,Dynamic,1> VectorXI;
+  typedef Eigen::Matrix<typename DerivedG::Scalar ,Eigen::Dynamic ,Eigen::Dynamic> MatrixXI;
+  typedef Eigen::Matrix<typename DerivedG::Scalar ,Eigen::Dynamic,1> VectorXI;
   MatrixXI GT(mp+mn,3);
   GT<< 
     FA(igl::find(N),igl::placeholders::all), 
@@ -296,7 +292,7 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
         sF.block(f,1,1,d-1) = sF.block(f,1,1,d-1).reverse().eval();
       }
     }
-    Array<bool,Dynamic,1> M = Array<bool,Dynamic,1>::Zero(m,1);
+    Eigen::Array<bool ,Eigen::Dynamic,1> M = Eigen::Array<bool ,Eigen::Dynamic,1>::Zero(m,1);
     {
       VectorXI P = igl::LinSpaced<VectorXI >(d,0,d-1);
       for(int p = 0;p<d;p++)
@@ -359,7 +355,7 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
     Eigen::Matrix<typename DerivedJ::Scalar, Eigen::Dynamic,1> SJ;
     mesh_boolean(
       DerivedW(W),DerivedG(G),
-      Matrix<typename DerivedVA::Scalar,Dynamic,Dynamic>(),MatrixXI(),
+      Eigen::Matrix<typename DerivedVA::Scalar ,Eigen::Dynamic ,Eigen::Dynamic>(),MatrixXI(),
       MESH_BOOLEAN_TYPE_UNION,
       W,G,SJ);
     J = J(SJ).eval();

+ 32 - 34
include/igl/copyleft/cgal/outer_hull_legacy.cpp

@@ -54,14 +54,12 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
 #ifdef IGL_OUTER_HULL_DEBUG
   std::cerr << "Extracting outer hull" << std::endl;
 #endif
-  using namespace Eigen;
-  using namespace std;
   typedef typename DerivedF::Index Index;
-  Matrix<Index,DerivedF::RowsAtCompileTime,1> C;
-  typedef Matrix<typename DerivedV::Scalar,Dynamic,DerivedV::ColsAtCompileTime> MatrixXV;
-  //typedef Matrix<typename DerivedF::Scalar,Dynamic,DerivedF::ColsAtCompileTime> MatrixXF;
-  typedef Matrix<typename DerivedG::Scalar,Dynamic,DerivedG::ColsAtCompileTime> MatrixXG;
-  typedef Matrix<typename DerivedJ::Scalar,Dynamic,DerivedJ::ColsAtCompileTime> MatrixXJ;
+  Eigen::Matrix<Index,DerivedF::RowsAtCompileTime,1> C;
+  typedef Eigen::Matrix<typename DerivedV::Scalar ,Eigen::Dynamic,DerivedV::ColsAtCompileTime> MatrixXV;
+  //typedef Eigen::Matrix<typename DerivedF::Scalar ,Eigen::Dynamic,DerivedF::ColsAtCompileTime> MatrixXF;
+  typedef Eigen::Matrix<typename DerivedG::Scalar ,Eigen::Dynamic,DerivedG::ColsAtCompileTime> MatrixXG;
+  typedef Eigen::Matrix<typename DerivedJ::Scalar ,Eigen::Dynamic,DerivedJ::ColsAtCompileTime> MatrixXJ;
   const Index m = F.rows();
 
   // UNUSED:
@@ -77,18 +75,18 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
   //};
 
 #ifdef IGL_OUTER_HULL_DEBUG
-  cout<<"outer hull..."<<endl;
+  std::cout<<"outer hull..."<<std::endl;
 #endif
 
 #ifdef IGL_OUTER_HULL_DEBUG
-  cout<<"edge map..."<<endl;
+  std::cout<<"edge map..."<<std::endl;
 #endif
-  typedef Matrix<typename DerivedF::Scalar,Dynamic,2> MatrixX2I;
-  typedef Matrix<typename DerivedF::Index,Dynamic,1> VectorXI;
-  //typedef Matrix<typename DerivedV::Scalar, 3, 1> Vector3F;
+  typedef Eigen::Matrix<typename DerivedF::Scalar ,Eigen::Dynamic,2> MatrixX2I;
+  typedef Eigen::Matrix<typename DerivedF::Index ,Eigen::Dynamic,1> VectorXI;
+  //typedef Eigen::Matrix<typename DerivedV::Scalar, 3, 1> Vector3F;
   MatrixX2I E,uE;
   VectorXI EMAP;
-  vector<vector<typename DerivedF::Index> > uE2E;
+  std::vector<std::vector<typename DerivedF::Index> > uE2E;
   unique_edge_map(F,E,uE,EMAP,uE2E);
 #ifdef IGL_OUTER_HULL_DEBUG
   for (size_t ui=0; ui<uE.rows(); ui++) {
@@ -112,11 +110,11 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
       }
   }
 
-  vector<vector<vector<Index > > > TT,_1;
+  std::vector<std::vector<std::vector<Index > > > TT,_1;
   triangle_triangle_adjacency(E,EMAP,uE2E,false,TT,_1);
   VectorXI counts;
 #ifdef IGL_OUTER_HULL_DEBUG
-  cout<<"facet components..."<<endl;
+  std::cout<<"facet components..."<<std::endl;
 #endif
   facet_components(TT,C,counts);
   assert(C.maxCoeff()+1 == counts.rows());
@@ -126,21 +124,21 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
   flip.setConstant(m,1,false);
 
 #ifdef IGL_OUTER_HULL_DEBUG
-  cout<<"reindex..."<<endl;
+  std::cout<<"reindex..."<<std::endl;
 #endif
   // H contains list of faces on outer hull;
-  vector<bool> FH(m,false);
-  vector<bool> EH(3*m,false);
-  vector<MatrixXG> vG(ncc);
-  vector<MatrixXJ> vJ(ncc);
-  vector<MatrixXJ> vIM(ncc);
+  std::vector<bool> FH(m,false);
+  std::vector<bool> EH(3*m,false);
+  std::vector<MatrixXG> vG(ncc);
+  std::vector<MatrixXJ> vJ(ncc);
+  std::vector<MatrixXJ> vIM(ncc);
   //size_t face_count = 0;
   for(size_t id = 0;id<ncc;id++)
   {
     vIM[id].resize(counts[id],1);
   }
   // current index into each IM
-  vector<size_t> g(ncc,0);
+  std::vector<size_t> g(ncc,0);
   // place order of each face in its respective component
   for(Index f = 0;f<m;f++)
   {
@@ -148,7 +146,7 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
   }
 
 #ifdef IGL_OUTER_HULL_DEBUG
-  cout<<"barycenters..."<<endl;
+  std::cout<<"barycenters..."<<std::endl;
 #endif
   // assumes that "resolve" has handled any coplanar cases correctly and nearly
   // coplanar cases can be sorted based on barycenter.
@@ -156,7 +154,7 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
   barycenter(V,F,BC);
 
 #ifdef IGL_OUTER_HULL_DEBUG
-  cout<<"loop over CCs (="<<ncc<<")..."<<endl;
+  std::cout<<"loop over CCs (="<<ncc<<")..."<<std::endl;
 #endif
   for(Index id = 0;id<(Index)ncc;id++)
   {
@@ -166,11 +164,11 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
     int f;
     bool f_flip;
 #ifdef IGL_OUTER_HULL_DEBUG
-  cout<<"outer facet..."<<endl;
+  std::cout<<"outer facet..."<<std::endl;
 #endif
   igl::copyleft::cgal::outer_facet(V,F,IM,f,f_flip);
 #ifdef IGL_OUTER_HULL_DEBUG
-  cout<<"outer facet: "<<f<<endl;
+  std::cout<<"outer facet: "<<f<<std::endl;
   //cout << V.row(F(f, 0)) << std::endl;
   //cout << V.row(F(f, 1)) << std::endl;
   //cout << V.row(F(f, 2)) << std::endl;
@@ -178,16 +176,16 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
     int FHcount = 1;
     FH[f] = true;
     // Q contains list of face edges to continue traversing upong
-    queue<int> Q;
+    std::queue<int> Q;
     Q.push(f+0*m);
     Q.push(f+1*m);
     Q.push(f+2*m);
     flip(f) = f_flip;
     //std::cout << "face " << face_count++ << ": " << f << std::endl;
     //std::cout << "f " << F.row(f).array()+1 << std::endl;
-    //cout<<"flip("<<f<<") = "<<(flip(f)?"true":"false")<<endl;
+    //cout<<"flip("<<f<<") = "<<(flip(f)?"true":"false")<<std::endl;
 #ifdef IGL_OUTER_HULL_DEBUG
-  cout<<"BFS..."<<endl;
+  std::cout<<"BFS..."<<std::endl;
 #endif
     while(!Q.empty())
     {
@@ -245,7 +243,7 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
         //cout<<"Next facet: "<<(f+1)<<" --> "<<(nf+1)<<", |"<<
         //  di[EMAP(e)][diIM(e)]<<" - "<<di[EMAP(e)][nfei_new]<<"| = "<<
         //    abs(di[EMAP(e)][diIM(e)] - di[EMAP(e)][nfei_new])
-        //    <<endl;
+        //    <<std::endl;
 #endif
 
 
@@ -266,7 +264,7 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
         //        << std::endl;
         }
 //#ifdef IGL_OUTER_HULL_DEBUG
-//        cout<<"Skipping co-planar facet: "<<(f+1)<<" --> "<<(nf+1)<<endl;
+//        std::cout<<"Skipping co-planar facet: "<<(f+1)<<" --> "<<(nf+1)<<std::endl;
 //#endif
       }
 
@@ -284,7 +282,7 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
         if(!FH[nf])
         {
           // first time seeing face
-          cout<<(f+1)<<" --> "<<(nf+1)<<endl;
+          std::cout<<(f+1)<<" --> "<<(nf+1)<<std::endl;
         }
 #endif
         FH[nf] = true;
@@ -296,7 +294,7 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
         const int nd = F(nf,(nc+2)%3);
         const bool cons = (flip(f)?fd:fs) == nd;
         flip(nf) = (cons ? flip(f) : !flip(f));
-        //cout<<"flip("<<nf<<") = "<<(flip(nf)?"true":"false")<<endl;
+        //cout<<"flip("<<nf<<") = "<<(flip(nf)?"true":"false")<<std::endl;
         const int ne1 = nf+((nc+1)%3)*m;
         const int ne2 = nf+((nc+2)%3)*m;
         if(!EH[ne1])
@@ -381,7 +379,7 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
   };
 
   // Reject components which are completely inside other components
-  vector<bool> keep(ncc,true);
+  std::vector<bool> keep(ncc,true);
   size_t nG = 0;
   // This is O( ncc * ncc * m)
   for(size_t id = 0;id<ncc;id++)

+ 9 - 11
include/igl/copyleft/cgal/peel_outer_hull_layers.cpp

@@ -28,22 +28,20 @@ IGL_INLINE int igl::copyleft::cgal::peel_outer_hull_layers(
   Eigen::PlainObjectBase<DerivedI> & I,
   Eigen::PlainObjectBase<Derivedflip > & flip)
 {
-  using namespace Eigen;
-  using namespace std;
-  typedef Matrix<typename DerivedF::Scalar,Dynamic,DerivedF::ColsAtCompileTime> MatrixXF;
-  typedef Matrix<int,Dynamic,1> MatrixXI;
-  typedef Matrix<typename Derivedflip::Scalar,Dynamic,Derivedflip::ColsAtCompileTime> MatrixXflip;
+  typedef Eigen::Matrix<typename DerivedF::Scalar ,Eigen::Dynamic,DerivedF::ColsAtCompileTime> MatrixXF;
+  typedef Eigen::Matrix<int ,Eigen::Dynamic,1> MatrixXI;
+  typedef Eigen::Matrix<typename Derivedflip::Scalar ,Eigen::Dynamic,Derivedflip::ColsAtCompileTime> MatrixXflip;
   const int m = F.rows();
 #ifdef IGL_PEEL_OUTER_HULL_LAYERS_DEBUG
-  cout<<"peel outer hull layers..."<<endl;
+  std::cout<<"peel outer hull layers..."<<std::endl;
 #endif
 #ifdef IGL_PEEL_OUTER_HULL_LAYERS_DEBUG
-  cout<<"calling outer hull..."<<endl;
+  std::cout<<"calling outer hull..."<<std::endl;
   writePLY(STR("peel-outer-hull-input.ply"),V,F);
 #endif
 
 #ifdef IGL_PEEL_OUTER_HULL_LAYERS_DEBUG
-  cout<<"resize output ..."<<endl;
+  std::cout<<"resize output ..."<<std::endl;
 #endif
   // keep track of iteration parity and whether flipped in hull
   MatrixXF Fr = F;
@@ -63,7 +61,7 @@ IGL_INLINE int igl::copyleft::cgal::peel_outer_hull_layers(
     MatrixXflip flipr;
 #ifdef IGL_PEEL_OUTER_HULL_LAYERS_DEBUG
   {
-      cout<<"calling outer hull..." << iter <<endl;
+      std::cout<<"calling outer hull..." << iter <<std::endl;
       std::stringstream ss;
       ss << "outer_hull_" << iter << ".ply";
       Eigen::MatrixXd vertices(V.rows(), V.cols());
@@ -77,12 +75,12 @@ IGL_INLINE int igl::copyleft::cgal::peel_outer_hull_layers(
     outer_hull_legacy(V,Fr,Fo,Jo,flipr);
 #ifdef IGL_PEEL_OUTER_HULL_LAYERS_DEBUG
   writePLY(STR("outer-hull-output-"<<iter<<".ply"),V,Fo);
-  cout<<"reindex, flip..."<<endl;
+  std::cout<<"reindex, flip..."<<std::endl;
 #endif
     assert(Fo.rows() != 0);
     assert(Fo.rows() == Jo.rows());
     // all faces in Fo of Fr
-    vector<bool> in_outer(Fr.rows(),false);
+    std::vector<bool> in_outer(Fr.rows(),false);
     for(int g = 0;g<Jo.rows();g++)
     {
       I(IM(Jo(g))) = iter;

+ 3 - 6
include/igl/copyleft/cgal/point_mesh_squared_distance.cpp

@@ -26,14 +26,13 @@ IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance(
         Eigen::PlainObjectBase<DerivedI> & I,
         Eigen::PlainObjectBase<DerivedC> & C)
 {
-  using namespace std;
-  typedef CGAL::Triangle_3<Kernel> Triangle_3; 
+  typedef CGAL::Triangle_3<Kernel> Triangle_3;
   typedef typename std::vector<Triangle_3>::iterator Iterator;
   typedef CGAL::AABB_triangle_primitive<Kernel, Iterator> Primitive;
   typedef CGAL::AABB_traits<Kernel, Primitive> AABB_triangle_traits;
   typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
   Tree tree;
-  vector<Triangle_3> T;
+  std::vector<Triangle_3> T;
   point_mesh_squared_distance_precompute(V,F,tree,T);
   return point_mesh_squared_distance(P,tree,T,sqrD,I,C);
 }
@@ -51,9 +50,7 @@ IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance_precompute(
   > & tree,
   std::vector<CGAL::Triangle_3<Kernel> > & T)
 {
-  using namespace std;
-
-  typedef CGAL::Point_3<Kernel> Point_3; 
+  typedef CGAL::Point_3<Kernel> Point_3;
 
   // Must be 3D
   assert(V.cols() == 3);

+ 0 - 1
include/igl/copyleft/cgal/polyhedron_to_mesh.cpp

@@ -18,7 +18,6 @@ IGL_INLINE void igl::copyleft::cgal::polyhedron_to_mesh(
   Eigen::PlainObjectBase<DerivedV> & V,
   Eigen::PlainObjectBase<DerivedF> & F)
 {
-  using namespace std;
   V.resize(poly.size_of_vertices(),3);
   F.resize(poly.size_of_facets(),3);
   typedef typename Polyhedron::Vertex_const_iterator Vertex_iterator;

+ 0 - 1
include/igl/copyleft/cgal/projected_delaunay.cpp

@@ -25,7 +25,6 @@ IGL_INLINE void igl::copyleft::cgal::projected_delaunay(
         CGAL::Constrained_triangulation_face_base_2<Kernel> >,
       CGAL::Exact_intersections_tag> > & cdt)
 {
-  using namespace std;
   // 3D Primitives
   typedef CGAL::Point_3<Kernel>    Point_3;
   typedef CGAL::Segment_3<Kernel>  Segment_3; 

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

@@ -31,7 +31,6 @@ IGL_INLINE void igl::copyleft::cgal::remesh_self_intersections(
   Eigen::PlainObjectBase<DerivedJ> & J,
   Eigen::PlainObjectBase<DerivedIM> & IM)
 {
-  using namespace std;
   typedef typename DerivedV::Scalar VScalar;
   if(params.detect_only && ! std::is_same<VScalar,CGAL::Epeck::FT>::value)
   {

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

@@ -31,15 +31,13 @@ IGL_INLINE void igl::copyleft::cgal::resolve_intersections(
   Eigen::PlainObjectBase<DerivedJ> & J,
   Eigen::PlainObjectBase<DerivedIM> & IM)
 {
-  using namespace Eigen;
   using namespace igl;
-  using namespace std;
   // Exact scalar type
   typedef CGAL::Epeck K;
   typedef K::FT EScalar;
   typedef CGAL::Segment_2<K> Segment_2;
   typedef CGAL::Point_2<K> Point_2;
-  typedef Matrix<EScalar,Dynamic,Dynamic>  MatrixXE;
+  typedef Eigen::Matrix<EScalar ,Eigen::Dynamic ,Eigen::Dynamic>  MatrixXE;
 
   // Convert vertex positions to exact kernel
   MatrixXE VE(V.rows(),V.cols());

+ 4 - 7
include/igl/copyleft/cgal/signed_distance_isosurface.cpp

@@ -38,9 +38,6 @@ IGL_INLINE bool igl::copyleft::cgal::signed_distance_isosurface(
   Eigen::MatrixXd & V,
   Eigen::MatrixXi & F)
 {
-  using namespace std;
-  using namespace Eigen;
-
   // default triangulation for Surface_mesher
   typedef CGAL::Surface_mesh_default_triangulation_3 Tr;
   // c2t3
@@ -102,9 +99,9 @@ IGL_INLINE bool igl::copyleft::cgal::signed_distance_isosurface(
         [&tree,&IV,&IF,&level](const Point_3 & q) -> FT
         {
           int i;
-          RowVector3d c;
+          Eigen::RowVector3d c;
           const double sd = tree.squared_distance(
-            IV,IF,RowVector3d(q.x(),q.y(),q.z()),i,c);
+            IV,IF,Eigen::RowVector3d(q.x(),q.y(),q.z()),i,c);
           return sd-level;
         };
     case SIGNED_DISTANCE_TYPE_DEFAULT:
@@ -113,7 +110,7 @@ IGL_INLINE bool igl::copyleft::cgal::signed_distance_isosurface(
         [&tree,&IV,&IF,&hier,&level](const Point_3 & q) -> FT
         {
           const double sd = signed_distance_winding_number(
-            tree,IV,IF,hier,Vector3d(q.x(),q.y(),q.z()));
+            tree,IV,IF,hier,Eigen::Vector3d(q.x(),q.y(),q.z()));
           return sd-level;
         };
       break;
@@ -122,7 +119,7 @@ IGL_INLINE bool igl::copyleft::cgal::signed_distance_isosurface(
         {
           const double sd = 
             igl::signed_distance_pseudonormal(
-              tree,IV,IF,FN,VN,EN,EMAP,RowVector3d(q.x(),q.y(),q.z()));
+              tree,IV,IF,FN,VN,EN,EMAP,Eigen::RowVector3d(q.x(),q.y(),q.z()));
           return sd- level;
         };
       break;

+ 13 - 15
include/igl/copyleft/cgal/snap_rounding.cpp

@@ -29,28 +29,26 @@ IGL_INLINE void igl::copyleft::cgal::snap_rounding(
   Eigen::PlainObjectBase<DerivedEI> & EI,
   Eigen::PlainObjectBase<DerivedJ> & J)
 {
-  using namespace Eigen;
   using namespace igl;
   using namespace igl::copyleft::cgal;
-  using namespace std;
   // Exact scalar type
   typedef CGAL::Epeck Kernel;
   typedef Kernel::FT EScalar;
   typedef CGAL::Segment_2<Kernel> Segment_2;
   typedef CGAL::Point_2<Kernel> Point_2;
   typedef CGAL::Vector_2<Kernel> Vector_2;
-  typedef Matrix<EScalar,Dynamic,Dynamic>  MatrixXE;
+  typedef Eigen::Matrix<EScalar ,Eigen::Dynamic ,Eigen::Dynamic>  MatrixXE;
   // Convert vertex positions to exact kernel
 
   MatrixXE VE;
   {
-    VectorXi IM;
+    Eigen::VectorXi IM;
     resolve_intersections(V,E,VE,EI,J,IM);
-    for_each(
+    std::for_each(
       EI.data(),
       EI.data()+EI.size(),
       [&IM](typename DerivedEI::Scalar& i){i=IM(i);});
-    VectorXi _;
+    Eigen::VectorXi _;
     remove_unreferenced( MatrixXE(VE), DerivedEI(EI), VE,EI,_);
   }
 
@@ -98,19 +96,19 @@ IGL_INLINE void igl::copyleft::cgal::snap_rounding(
     search(-1);
     return i;
   };
-  vector<Point_2> hot;
+  std::vector<Point_2> hot;
   for(int i = 0;i<VE.rows();i++)
   {
     hot.emplace_back(round(VE(i,0)),round(VE(i,1)));
   }
   {
     std::vector<size_t> _1,_2;
-    igl::unique(vector<Point_2>(hot),hot,_1,_2);
+    igl::unique(std::vector<Point_2>(hot),hot,_1,_2);
   }
 
   // find all segments intersecting hot pixels
   //   split edge at closest point to hot pixel center
-  vector<vector<Point_2>>  steiner(EI.rows());
+  std::vector<std::vector<Point_2>>  steiner(EI.rows());
   // initialize each segment with endpoints
   for(int i = 0;i<EI.rows();i++)
   {
@@ -143,7 +141,7 @@ IGL_INLINE void igl::copyleft::cgal::snap_rounding(
       }
       // otherwise check for intersections with walls consider all walls
       const Segment_2 si(s,d);
-      vector<Point_2> hits;
+      std::vector<Point_2> hits;
       for(int j = 0;j<4;j++)
       {
         const Segment_2 & sj = wall[j];
@@ -183,14 +181,14 @@ IGL_INLINE void igl::copyleft::cgal::snap_rounding(
   }
   {
     DerivedJ prevJ = J;
-    VectorXi IM;
-    subdivide_segments(MatrixXE(VE),MatrixXi(EI),steiner,VE,EI,J,IM);
-    for_each(J.data(),J.data()+J.size(),[&prevJ](typename DerivedJ::Scalar & j){j=prevJ(j);});
-    for_each(
+    Eigen::VectorXi IM;
+    subdivide_segments(MatrixXE(VE),Eigen::MatrixXi(EI),steiner,VE,EI,J,IM);
+    std::for_each(J.data(),J.data()+J.size(),[&prevJ](typename DerivedJ::Scalar & j){j=prevJ(j);});
+    std::for_each(
       EI.data(),
       EI.data()+EI.size(),
       [&IM](typename DerivedEI::Scalar& i){i=IM(i);});
-    VectorXi _;
+    Eigen::VectorXi _;
     remove_unreferenced( MatrixXE(VE), DerivedEI(EI), VE,EI,_);
   }
 

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

@@ -7,11 +7,10 @@ IGL_INLINE bool igl::copyleft::cgal::string_to_mesh_boolean_type(
   const std::string & s,
   MeshBooleanType & type)
 {
-  using namespace std;
-  string eff_s = s;
-  transform(eff_s.begin(), eff_s.end(), eff_s.begin(), ::tolower);
+  std::string eff_s = s;
+  std::transform(eff_s.begin(), eff_s.end(), eff_s.begin(), ::tolower);
   const auto & find_any = 
-    [](const vector<string> & haystack, const string & needle)->bool
+    [](const std::vector<std::string> & haystack, const std::string & needle)->bool
   {
     return find(haystack.begin(), haystack.end(), needle) != haystack.end();
   };

+ 2 - 5
include/igl/copyleft/cgal/subdivide_segments.cpp

@@ -33,15 +33,12 @@ IGL_INLINE void igl::copyleft::cgal::subdivide_segments(
   Eigen::PlainObjectBase<DerivedJ> & J,
   Eigen::PlainObjectBase<DerivedIM> & IM)
 {
-  using namespace Eigen;
   using namespace igl;
-  using namespace std;
-
   // Exact scalar type
   typedef Kernel K;
   typedef typename Kernel::FT EScalar;
   typedef CGAL::Point_2<Kernel> Point_2;
-  typedef Matrix<EScalar,Dynamic,Dynamic>  MatrixXE;
+  typedef Eigen::Matrix<EScalar ,Eigen::Dynamic ,Eigen::Dynamic>  MatrixXE;
 
   // non-const copy
   std::vector<std::vector<CGAL::Point_2<Kernel> > > steiner = _steiner;
@@ -125,7 +122,7 @@ IGL_INLINE void igl::copyleft::cgal::subdivide_segments(
     std::vector<size_t> vA,vIM;
     igl::unique(vVES,_1,vA,vIM);
     // Push indices back into vVES
-    for_each(vIM.data(),vIM.data()+vIM.size(),[&vA](size_t & i){i=vA[i];});
+    std::for_each(vIM.data(),vIM.data()+vIM.size(),[&vA](size_t & i){i=vA[i];});
     list_to_matrix(vIM,IM);
   }
 }

+ 0 - 2
include/igl/copyleft/opengl2/texture_from_tga.cpp

@@ -11,8 +11,6 @@
 
 IGL_INLINE bool igl::opengl::texture_from_tga(const std::string tga_file, GLuint & id)
 {
-  using namespace std;
-
   // read pixels to tga file
   FILE * imgFile;
   // "-" as input file name is code for read from stdin

+ 21 - 23
include/igl/copyleft/progressive_hulls_cost_and_placement.cpp

@@ -24,43 +24,41 @@ IGL_INLINE void igl::copyleft::progressive_hulls_cost_and_placement(
   double & cost,
   Eigen::RowVectorXd & p)
 {
-  using namespace Eigen;
-  using namespace std;
   // Controls the amount of quadratic energy to add (too small will introduce
   // instabilities and flaps)
   const double w = 0.1;
 
   assert(V.cols() == 3 && "V.cols() should be 3");
   // Gather list of unique face neighbors
-  vector<int> Nall =  circulation(e, true,EMAP,EF,EI);
-  vector<int> Nother= circulation(e,false,EMAP,EF,EI);
+  std::vector<int> Nall =  circulation(e, true,EMAP,EF,EI);
+  std::vector<int> Nother= circulation(e,false,EMAP,EF,EI);
   Nall.insert(Nall.end(),Nother.begin(),Nother.end());
-  vector<int> N;
+  std::vector<int> N;
   igl::unique(Nall,N);
   // Gather:
   //   A  #N by 3 normals scaled by area,
   //   D  #N determinants of matrix formed by points as columns
   //   B  #N point on plane dot normal
-  MatrixXd A(N.size(),3);
-  VectorXd D(N.size());
-  VectorXd B(N.size());
+  Eigen::MatrixXd A(N.size(),3);
+  Eigen::VectorXd D(N.size());
+  Eigen::VectorXd B(N.size());
   //cout<<"N=[";
   for(int i = 0;i<N.size();i++)
   {
     const int f = N[i];
     //cout<<(f+1)<<" ";
-    const RowVector3d & v01 = V.row(F(f,1))-V.row(F(f,0));
-    const RowVector3d & v20 = V.row(F(f,2))-V.row(F(f,0));
+    const Eigen::RowVector3d & v01 = V.row(F(f,1))-V.row(F(f,0));
+    const Eigen::RowVector3d & v20 = V.row(F(f,2))-V.row(F(f,0));
     A.row(i) = v01.cross(v20);
     B(i) = V.row(F(f,0)).dot(A.row(i));
     D(i) = 
-      (Matrix3d()<< V.row(F(f,0)), V.row(F(f,1)), V.row(F(f,2)))
+      (Eigen::Matrix3d()<< V.row(F(f,0)), V.row(F(f,1)), V.row(F(f,2)))
       .finished().determinant();
   }
-  //cout<<"];"<<endl;
+  //cout<<"];"<<std::endl;
   // linear objective
-  Vector3d f = A.colwise().sum().transpose();
-  VectorXd x;
+  Eigen::Vector3d f = A.colwise().sum().transpose();
+  Eigen::VectorXd x;
   //bool success = linprog(f,-A,-B,MatrixXd(0,A.cols()),VectorXd(0,1),x);
   //VectorXd _;
   //bool success = mosek_linprog(f,A.sparseView(),B,_,_,_,env,x);
@@ -70,13 +68,13 @@ IGL_INLINE void igl::copyleft::progressive_hulls_cost_and_placement(
   //}
   bool success = false;
   {
-    RowVectorXd mid = 0.5*(V.row(E(e,0))+V.row(E(e,1)));
-    MatrixXd G =  w*Matrix3d::Identity(3,3);
-    VectorXd g0 = (1.-w)*f - w*mid.transpose();
+    Eigen::RowVectorXd mid = 0.5*(V.row(E(e,0))+V.row(E(e,1)));
+    Eigen::MatrixXd G =  w*Eigen::Matrix3d::Identity(3,3);
+    Eigen::VectorXd g0 = (1.-w)*f - w*mid.transpose();
     const int n = A.cols();
     success = quadprog(
         G,g0,
-        MatrixXd(n,0),VectorXd(0,1),
+        Eigen::MatrixXd(n,0),Eigen::VectorXd(0,1),
         A.transpose(),-B,x);
     cost  = (1.-w)*(1./6.)*(x.dot(f) - D.sum()) + 
       w*(x.transpose()-mid).squaredNorm() +
@@ -97,11 +95,11 @@ IGL_INLINE void igl::copyleft::progressive_hulls_cost_and_placement(
     cost = std::numeric_limits<double>::infinity();
     //VectorXi NM;
     //igl::list_to_matrix(N,NM);
-    //cout<<matlab_format((NM.array()+1).eval(),"N")<<endl;
-    //cout<<matlab_format(f,"f")<<endl;
-    //cout<<matlab_format(A,"A")<<endl;
-    //cout<<matlab_format(B,"B")<<endl;
+    //std::cout<<matlab_format((NM.array()+1).eval(),"N")<<std::endl;
+    //std::cout<<matlab_format(f,"f")<<std::endl;
+    //std::cout<<matlab_format(A,"A")<<std::endl;
+    //std::cout<<matlab_format(B,"B")<<std::endl;
     //exit(-1);
-    p = RowVectorXd::Constant(1,3,std::nan("inf-cost"));
+    p = Eigen::RowVectorXd::Constant(1,3,std::nan("inf-cost"));
   }
 }

+ 16 - 17
include/igl/copyleft/quadprog.cpp

@@ -93,7 +93,6 @@ IGL_INLINE bool igl::copyleft::quadprog(
   const Eigen::VectorXd & ci0, 
   Eigen::VectorXd& x)
 {
-  using namespace Eigen;
   typedef double Scalar;
 
 
@@ -131,28 +130,28 @@ IGL_INLINE bool igl::copyleft::quadprog(
   		}
   	return a1 * std::sqrt(2.0);
   };
-  const auto compute_d = [](VectorXd &d, const MatrixXd& J, const VectorXd& np)
+  const auto compute_d = [](Eigen::VectorXd &d, const Eigen::MatrixXd& J, const Eigen::VectorXd& np)
   {
     d = J.adjoint() * np;
   };
 
   const auto update_z = 
-    [](VectorXd& z, const MatrixXd& J, const VectorXd& d,  int iq)
+    [](Eigen::VectorXd& z, const Eigen::MatrixXd& J, const Eigen::VectorXd& d,  int iq)
   {
     z = J.rightCols(z.size()-iq) * d.tail(d.size()-iq);
   };
 
   const auto update_r = 
-    [](const MatrixXd& R, VectorXd& r, const VectorXd& d, int iq) 
+    [](const Eigen::MatrixXd& R, Eigen::VectorXd& r, const Eigen::VectorXd& d, int iq)
   {
     r.head(iq) = 
-      R.topLeftCorner(iq,iq).triangularView<Upper>().solve(d.head(iq));
+      R.topLeftCorner(iq,iq).triangularView<Eigen::Upper>().solve(d.head(iq));
   };
 
   const auto add_constraint = [&distance](
-    MatrixXd& R, 
-    MatrixXd& J, 
-    VectorXd& d, 
+    Eigen::MatrixXd& R,
+    Eigen::MatrixXd& J,
+    Eigen::VectorXd& d,
     int& iq, 
     double& R_norm)->bool
   {
@@ -222,10 +221,10 @@ IGL_INLINE bool igl::copyleft::quadprog(
   };
 
   const auto delete_constraint = [&distance](
-      MatrixXd& R, 
-      MatrixXd& J, 
-      VectorXi& A, 
-      VectorXd& u, 
+      Eigen::MatrixXd& R,
+      Eigen::MatrixXd& J,
+      Eigen::VectorXi& A,
+      Eigen::VectorXd& u,
       int p, 
       int& iq, 
       int l)
@@ -308,12 +307,12 @@ IGL_INLINE bool igl::copyleft::quadprog(
   int i, k, l; /* indices */
   int ip, me, mi;
   int n=g0.size();  int p=ce0.size();  int m=ci0.size();  
-  MatrixXd R(G.rows(),G.cols()), J(G.rows(),G.cols());
+  Eigen::MatrixXd R(G.rows(),G.cols()), J(G.rows(),G.cols());
   
-  LLT<MatrixXd,Lower> chol(G.cols());
+  Eigen::LLT<Eigen::MatrixXd,Eigen::Lower> chol(G.cols());
  
-  VectorXd s(m+p), z(n), r(m + p), d(n),  np(n), u(m + p);
-  VectorXd x_old(n), u_old(m + p);
+  Eigen::VectorXd s(m+p), z(n), r(m + p), d(n),  np(n), u(m + p);
+  Eigen::VectorXd x_old(n), u_old(m + p);
 #ifdef TRACE_SOLVER
   double f_value;
 #endif
@@ -321,7 +320,7 @@ IGL_INLINE bool igl::copyleft::quadprog(
   const double inf = std::numeric_limits<double>::infinity();
   double t, t1, t2; /* t is the step length, which is the minimum of the partial step length t1 
     * and the full step length t2 */
-  VectorXi A(m + p), A_old(m + p), iai(m + p);
+  Eigen::VectorXi A(m + p), A_old(m + p), iai(m + p);
   int iq; 
   std::vector<bool> iaexcl(m + p);
  	

+ 2 - 4
include/igl/copyleft/tetgen/cdt.cpp

@@ -24,8 +24,6 @@ IGL_INLINE bool igl::copyleft::tetgen::cdt(
   Eigen::PlainObjectBase<DerivedTT>& TT,
   Eigen::PlainObjectBase<DerivedTF>& TF)
 {
-  using namespace Eigen;
-  using namespace std;
   // Effective input mesh
   PlainMatrix<DerivedV,Eigen::Dynamic> U;
   PlainMatrix<DerivedF,Eigen::Dynamic> G;
@@ -36,7 +34,7 @@ IGL_INLINE bool igl::copyleft::tetgen::cdt(
     PlainMatrix<DerivedF,Eigen::Dynamic> BF;
     bounding_box(V,BV,BF);
     // scale bounding box
-    const RowVector3d mid = 
+    const Eigen::RowVector3d mid =
      (BV.colwise().minCoeff() + BV.colwise().maxCoeff()).eval()*0.5;
     BV.rowwise() -= mid;
     assert(param.bounding_box_scale >= 1.);
@@ -55,7 +53,7 @@ IGL_INLINE bool igl::copyleft::tetgen::cdt(
     G = F;
   }
   // effective flags;
-  string flags = param.flags + (param.use_bounding_box ? "" : "c");
+  std::string flags = param.flags + (param.use_bounding_box ? "" : "c");
   return tetrahedralize(U,G,flags,TV,TT,TF);
 }
 

+ 0 - 1
include/igl/copyleft/tetgen/mesh_to_tetgenio.cpp

@@ -29,7 +29,6 @@ IGL_INLINE void igl::copyleft::tetgen::mesh_to_tetgenio(
   const Eigen::MatrixBase<DerivedR>& R,
   tetgenio & in)
 {
-  using namespace std;
   assert(V.cols() == 3 && "V should have 3 columns");
   assert((VM.size() == 0 || VM.size() == V.rows()) && "VM should be empty or #V by 1");
   assert((FM.size() == 0 || FM.size() == F.rows()) && "FM should be empty or #F by 1");

+ 16 - 18
include/igl/copyleft/tetgen/mesh_with_skeleton.cpp

@@ -29,18 +29,16 @@ IGL_INLINE bool igl::copyleft::tetgen::mesh_with_skeleton(
   Eigen::MatrixXi & TT,
   Eigen::MatrixXi & FF)
 {
-  using namespace Eigen;
-  using namespace std;
-  const string eff_tetgen_flags = 
+  const std::string eff_tetgen_flags =
     (tetgen_flags.length() == 0?DEFAULT_TETGEN_FLAGS:tetgen_flags);
   // Collect all edges that need samples:
-  MatrixXi BECE = cat(1,BE,CE);
-  MatrixXd S;
+  Eigen::MatrixXi BECE = cat(1,BE,CE);
+  Eigen::MatrixXd S;
   // Sample each edge with 10 samples. (Choice of 10 doesn't seem to matter so
   // much, but could under some circumstances)
   sample_edges(C,BECE,samples_per_bone,S);
   // Vertices we'll constrain tet mesh to meet
-  MatrixXd VS = cat(1,V,S);
+  Eigen::MatrixXd VS = cat(1,V,S);
   // Use tetgen to mesh the interior of surface, this assumes surface:
   //   * has no holes
   //   * has no non-manifold edges or vertices
@@ -51,27 +49,27 @@ IGL_INLINE bool igl::copyleft::tetgen::mesh_with_skeleton(
   if(FF.rows() != F.rows())
   {
     // Issue a warning if the surface has changed
-    cerr<<"mesh_with_skeleton: Warning: boundary faces != input faces"<<endl;
+    std::cerr<<"mesh_with_skeleton: Warning: boundary faces != input faces"<<std::endl;
   }
   if(status != 0)
   {
-    cerr<<
-      "***************************************************************"<<endl<<
-      "***************************************************************"<<endl<<
-      "***************************************************************"<<endl<<
-      "***************************************************************"<<endl<<
-      "* mesh_with_skeleton: tetgen failed. Just meshing convex hull *"<<endl<<
-      "***************************************************************"<<endl<<
-      "***************************************************************"<<endl<<
-      "***************************************************************"<<endl<<
-      "***************************************************************"<<endl;
+    std::cerr<<
+      "***************************************************************"<<std::endl<<
+      "***************************************************************"<<std::endl<<
+      "***************************************************************"<<std::endl<<
+      "***************************************************************"<<std::endl<<
+      "* mesh_with_skeleton: tetgen failed. Just meshing convex hull *"<<std::endl<<
+      "***************************************************************"<<std::endl<<
+      "***************************************************************"<<std::endl<<
+      "***************************************************************"<<std::endl<<
+      "***************************************************************"<<std::endl;
     // If meshing convex hull then use more regular mesh
     status = tetrahedralize(VS,F,"q1.414",VV,TT,FF);
     // I suppose this will fail if the skeleton is outside the mesh
     assert(FF.maxCoeff() < VV.rows());
     if(status != 0)
     {
-      cerr<<"mesh_with_skeleton: tetgen failed again."<<endl;
+      std::cerr<<"mesh_with_skeleton: tetgen failed again."<<std::endl;
       return false;
     }
   }

+ 7 - 10
include/igl/cotmatrix.cpp

@@ -21,11 +21,8 @@ IGL_INLINE void igl::cotmatrix(
   const Eigen::MatrixBase<DerivedF> & F, 
   Eigen::SparseMatrix<Scalar>& L)
 {
-  using namespace Eigen;
-  using namespace std;
-
   L.resize(V.rows(),V.rows());
-  Matrix<int,Dynamic,2> edges;
+  Eigen::Matrix<int ,Eigen::Dynamic,2> edges;
   int simplex_size = F.cols();
   // 3 for triangles, 4 for tets
   assert(simplex_size == 3 || simplex_size == 4);
@@ -56,10 +53,10 @@ IGL_INLINE void igl::cotmatrix(
     return;
   }
   // Gather cotangents
-  Matrix<Scalar,Dynamic,Dynamic> C;
+  Eigen::Matrix<Scalar ,Eigen::Dynamic ,Eigen::Dynamic> C;
   cotmatrix_entries(V,F,C);
   
-  vector<Triplet<Scalar> > IJV;
+  std::vector<Eigen::Triplet<Scalar> > IJV;
   IJV.reserve(F.rows()*edges.rows()*4);
   // Loop over triangles
   for(int i = 0; i < F.rows(); i++)
@@ -69,10 +66,10 @@ IGL_INLINE void igl::cotmatrix(
     {
       int source = F(i,edges(e,0));
       int dest = F(i,edges(e,1));
-      IJV.push_back(Triplet<Scalar>(source,dest,C(i,e)));
-      IJV.push_back(Triplet<Scalar>(dest,source,C(i,e)));
-      IJV.push_back(Triplet<Scalar>(source,source,-C(i,e)));
-      IJV.push_back(Triplet<Scalar>(dest,dest,-C(i,e)));
+      IJV.push_back(Eigen::Triplet<Scalar>(source,dest,C(i,e)));
+      IJV.push_back(Eigen::Triplet<Scalar>(dest,source,C(i,e)));
+      IJV.push_back(Eigen::Triplet<Scalar>(source,source,-C(i,e)));
+      IJV.push_back(Eigen::Triplet<Scalar>(dest,dest,-C(i,e)));
     }
   }
   L.setFromTriplets(IJV.begin(),IJV.end());

+ 2 - 2
include/igl/cotmatrix.h

@@ -25,9 +25,9 @@ namespace igl
   /// mesh (V,F).
   ///
   ///   @tparam DerivedV  derived type of eigen matrix for V (e.g. derived from
-  ///     MatrixXd)
+  ///     Eigen::MatrixXd)
   ///   @tparam DerivedF  derived type of eigen matrix for F (e.g. derived from
-  ///     MatrixXi)
+  ///     Eigen::MatrixXi)
   ///   @tparam Scalar  scalar type for eigen sparse matrix (e.g. double)
   ///   @param[in] V  #V by dim list of mesh vertex positions
   ///   @param[in] F  #F by simplex_size list of mesh elements (triangles or tetrahedra)

+ 10 - 13
include/igl/cotmatrix_entries.cpp

@@ -24,8 +24,6 @@ IGL_INLINE void igl::cotmatrix_entries(
   const Eigen::MatrixBase<DerivedF>& F,
   Eigen::PlainObjectBase<DerivedC>& C)
 {
-  using namespace std;
-  using namespace Eigen;
   // simplex size (3: triangles, 4: tetrahedra)
   int simplex_size = F.cols();
   // Number of elements
@@ -38,14 +36,14 @@ IGL_INLINE void igl::cotmatrix_entries(
     {
       // Triangles
       //Compute Squared Edge lengths 
-      Matrix<typename DerivedC::Scalar,Dynamic,3> l2;
+      Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,3> l2;
       igl::squared_edge_lengths(V,F,l2);
       //Compute Edge lengths 
-      Matrix<typename DerivedC::Scalar,Dynamic,3> l;
+      Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,3> l;
       l = l2.array().sqrt();
       
       // double area
-      Matrix<typename DerivedC::Scalar,Dynamic,1> dblA;
+      Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,1> dblA;
       doublearea(l,0.,dblA);
       // cotangents and diagonal entries for element matrices
       // correctly divided by 4 (alec 2010)
@@ -63,21 +61,21 @@ IGL_INLINE void igl::cotmatrix_entries(
     {
 
       // edge lengths numbered same as opposite vertices
-      Matrix<typename DerivedC::Scalar,Dynamic,6> l;
+      Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,6> l;
       edge_lengths(V,F,l);
-      Matrix<typename DerivedC::Scalar,Dynamic,4> s;
+      Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,4> s;
       face_areas(l,s);
-      Matrix<typename DerivedC::Scalar,Dynamic,6> cos_theta,theta;
+      Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,6> cos_theta,theta;
       dihedral_angles_intrinsic(l,s,theta,cos_theta);
 
       // volume
-      Matrix<typename DerivedC::Scalar,Dynamic,1> vol;
+      Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,1> vol;
       volume(l,vol);
 
 
       // Law of sines
       // http://mathworld.wolfram.com/Tetrahedron.html
-      Matrix<typename DerivedC::Scalar,Dynamic,6> sin_theta(m,6);
+      Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,6> sin_theta(m,6);
       sin_theta.col(0) = vol.array() / ((2./(3.*l.col(0).array())).array() * s.col(1).array() * s.col(2).array());
       sin_theta.col(1) = vol.array() / ((2./(3.*l.col(1).array())).array() * s.col(2).array() * s.col(0).array());
       sin_theta.col(2) = vol.array() / ((2./(3.*l.col(2).array())).array() * s.col(0).array() * s.col(1).array());
@@ -105,11 +103,10 @@ IGL_INLINE void igl::cotmatrix_entries(
   const Eigen::MatrixBase<Derivedl>& l,
   Eigen::PlainObjectBase<DerivedC>& C)
 {
-  using namespace Eigen;
   const int m = l.rows();
   assert(l.cols() == 3 && "Only triangles accepted");
   //Compute squared Edge lengths 
-  Matrix<typename DerivedC::Scalar,Dynamic,3> l2;
+  Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,3> l2;
   l2 = l.array().square();
   // Alec: It's a little annoying that there's duplicate code here. The
   // "extrinic" version above is first computing squared edge lengths, taking
@@ -120,7 +117,7 @@ IGL_INLINE void igl::cotmatrix_entries(
   // edge_lengths and this cotmatrix_entries(l,C);
   //
   // double area
-  Matrix<typename DerivedC::Scalar,Dynamic,1> dblA;
+  Eigen::Matrix<typename DerivedC::Scalar ,Eigen::Dynamic,1> dblA;
   doublearea(l,0.,dblA);
   // cotangents and diagonal entries for element matrices
   // correctly divided by 4 (alec 2010)

+ 7 - 9
include/igl/cotmatrix_intrinsic.cpp

@@ -16,13 +16,11 @@ IGL_INLINE void igl::cotmatrix_intrinsic(
   const Eigen::MatrixBase<DerivedF> & F, 
   Eigen::SparseMatrix<Scalar>& L)
 {
-  using namespace Eigen;
-  using namespace std;
   // Cribbed from cotmatrix
 
   const int nverts = F.maxCoeff()+1;
   L.resize(nverts,nverts);
-  Matrix<int,Dynamic,2> edges;
+  Eigen::Matrix<int ,Eigen::Dynamic,2> edges;
   int simplex_size = F.cols();
   // 3 for triangles, 4 for tets
   IGL_ASSERT(simplex_size == 3);
@@ -36,10 +34,10 @@ IGL_INLINE void igl::cotmatrix_intrinsic(
     2,0,
     0,1;
   // Gather cotangents
-  Matrix<Scalar,Dynamic,Dynamic> C;
+  Eigen::Matrix<Scalar ,Eigen::Dynamic ,Eigen::Dynamic> C;
   cotmatrix_entries(l,C);
   
-  vector<Triplet<Scalar> > IJV;
+  std::vector<Eigen::Triplet<Scalar> > IJV;
   IJV.reserve(F.rows()*edges.rows()*4);
   // Loop over triangles
   for(int i = 0; i < F.rows(); i++)
@@ -49,10 +47,10 @@ IGL_INLINE void igl::cotmatrix_intrinsic(
     {
       int source = F(i,edges(e,0));
       int dest = F(i,edges(e,1));
-      IJV.push_back(Triplet<Scalar>(source,dest,C(i,e)));
-      IJV.push_back(Triplet<Scalar>(dest,source,C(i,e)));
-      IJV.push_back(Triplet<Scalar>(source,source,-C(i,e)));
-      IJV.push_back(Triplet<Scalar>(dest,dest,-C(i,e)));
+      IJV.push_back(Eigen::Triplet<Scalar>(source,dest,C(i,e)));
+      IJV.push_back(Eigen::Triplet<Scalar>(dest,source,C(i,e)));
+      IJV.push_back(Eigen::Triplet<Scalar>(source,source,-C(i,e)));
+      IJV.push_back(Eigen::Triplet<Scalar>(dest,dest,-C(i,e)));
     }
   }
   L.setFromTriplets(IJV.begin(),IJV.end());

+ 3 - 4
include/igl/covariance_scatter_matrix.cpp

@@ -24,7 +24,6 @@ IGL_INLINE void igl::covariance_scatter_matrix(
   const ARAPEnergyType energy,
   Eigen::SparseMatrix<CSM_type>& CSM)
 {
-  using namespace Eigen;
   // number of mesh vertices
   int n = V.rows();
   assert(n > F.maxCoeff());
@@ -54,17 +53,17 @@ IGL_INLINE void igl::covariance_scatter_matrix(
       return;
   }
 
-  SparseMatrix<double> KX,KY,KZ;
+  Eigen::SparseMatrix<double> KX,KY,KZ;
   arap_linear_block(V,F,0,energy,KX);
   arap_linear_block(V,F,1,energy,KY);
-  SparseMatrix<double> Z(n,nr);
+  Eigen::SparseMatrix<double> Z(n,nr);
   if(dim == 2)
   {
     CSM = cat(1,cat(2,KX,Z),cat(2,Z,KY)).transpose();
   }else if(dim == 3)
   {
     arap_linear_block(V,F,2,energy,KZ);
-    SparseMatrix<double>ZZ(n,nr*2);
+    Eigen::SparseMatrix<double>ZZ(n,nr*2);
     CSM = 
       cat(1,cat(1,cat(2,KX,ZZ),cat(2,cat(2,Z,KY),Z)),cat(2,ZZ,KZ)).transpose();
   }else

+ 3 - 5
include/igl/crouzeix_raviart_massmatrix.cpp

@@ -40,15 +40,13 @@ void igl::crouzeix_raviart_massmatrix(
     const Eigen::MatrixBase<DerivedEMAP> & EMAP,
     Eigen::SparseMatrix<MT> & M)
 {
-  using namespace Eigen;
-  using namespace std;
   // Mesh should be edge-manifold (TODO: replace `is_edge_manifold` with
   // `is_facet_manifold`)
   assert(F.cols() != 3 || is_edge_manifold(F));
   // number of elements (triangles)
   const int m = F.rows();
   // Get triangle areas/volumes
-  VectorXd TA;
+  Eigen::VectorXd TA;
   // Element simplex size
   const int ss = F.cols();
   switch(ss)
@@ -63,13 +61,13 @@ void igl::crouzeix_raviart_massmatrix(
       volume(V,F,TA);
       break;
   }
-  vector<Triplet<MT> > MIJV(ss*m);
+  std::vector<Eigen::Triplet<MT> > MIJV(ss*m);
   assert(EMAP.size() == m*ss);
   for(int f = 0;f<m;f++)
   {
     for(int c = 0;c<ss;c++)
     {
-      MIJV[f+m*c] = Triplet<MT>(EMAP(f+m*c, 0),EMAP(f+m*c, 0),TA(f)/(double)(ss));
+      MIJV[f+m*c] = Eigen::Triplet<MT>(EMAP(f+m*c, 0),EMAP(f+m*c, 0),TA(f)/(double)(ss));
     }
   }
   M.resize(E.rows(),E.rows());

+ 0 - 2
include/igl/cumprod.cpp

@@ -16,8 +16,6 @@ IGL_INLINE void igl::cumprod(
   const int dim,
   Eigen::PlainObjectBase<DerivedY > & Y)
 {
-  using namespace Eigen;
-  using namespace std;
   Y.resizeLike(X);
   // get number of columns (or rows)
   int num_outer = (dim == 1 ? X.cols() : X.rows() );

+ 0 - 2
include/igl/cumsum.cpp

@@ -26,8 +26,6 @@ IGL_INLINE void igl::cumsum(
   const bool zero_prefix,
   Eigen::PlainObjectBase<DerivedY > & Y)
 {
-  using namespace Eigen;
-  using namespace std;
   Y.resize(
     X.rows()+(zero_prefix&&dim==1?1:0),
     X.cols()+(zero_prefix&&dim==2?1:0));

+ 15 - 16
include/igl/dated_copy.cpp

@@ -20,7 +20,6 @@
 
 IGL_INLINE bool igl::dated_copy(const std::string & src_path, const std::string & dir)
 {
-  using namespace std;
   // Get time and date as string
   char buffer[80];
   time_t rawtime;
@@ -29,33 +28,33 @@ IGL_INLINE bool igl::dated_copy(const std::string & src_path, const std::string
   timeinfo = localtime (&rawtime);
   // ISO 8601 format with hyphens instead of colons and no timezone offset
   strftime (buffer,80,"%Y-%m-%dT%H-%M-%S",timeinfo);
-  string src_basename = basename(src_path);
-  string dst_basename = src_basename+"-"+buffer;
-  string dst_path = dir+"/"+dst_basename;
-  cerr<<"Saving binary to "<<dst_path;
+  std::string src_basename = basename(src_path);
+  std::string dst_basename = src_basename+"-"+buffer;
+  std::string dst_path = dir+"/"+dst_basename;
+  std::cerr<<"Saving binary to "<<dst_path;
   {
     // http://stackoverflow.com/a/10195497/148668
-    ifstream src(src_path,ios::binary);
+    std::ifstream src(src_path,std::ios::binary);
     if (!src.is_open()) 
     {
-      cerr<<" failed."<<endl;
+      std::cerr<<" failed."<<std::endl;
       return false;
     }
-    ofstream dst(dst_path,ios::binary);
+    std::ofstream dst(dst_path,std::ios::binary);
     if(!dst.is_open())
     {
-      cerr<<" failed."<<endl;
+      std::cerr<<" failed."<<std::endl;
       return false;
     }
     dst << src.rdbuf();
   }
-  cerr<<" succeeded."<<endl;
-  cerr<<"Setting permissions of "<<dst_path;
+  std::cerr<<" succeeded."<<std::endl;
+  std::cerr<<"Setting permissions of "<<dst_path;
   {
     int src_posix = fileno(fopen(src_path.c_str(),"r"));
     if(src_posix == -1)
     {
-      cerr<<" failed."<<endl;
+      std::cerr<<" failed."<<std::endl;
       return false;
     }
     struct stat fst;
@@ -63,22 +62,22 @@ IGL_INLINE bool igl::dated_copy(const std::string & src_path, const std::string
     int dst_posix = fileno(fopen(dst_path.c_str(),"r"));
     if(dst_posix == -1)
     {
-      cerr<<" failed."<<endl;
+      std::cerr<<" failed."<<std::endl;
       return false;
     }
     //update to the same uid/gid
     if(fchown(dst_posix,fst.st_uid,fst.st_gid))
     {
-      cerr<<" failed."<<endl;
+      std::cerr<<" failed."<<std::endl;
       return false;
     }
     //update the permissions 
     if(fchmod(dst_posix,fst.st_mode) == -1)
     {
-      cerr<<" failed."<<endl;
+      std::cerr<<" failed."<<std::endl;
       return false;
     }
-    cerr<<" succeeded."<<endl;
+    std::cerr<<" succeeded."<<std::endl;
   }
   return true;
 }

+ 6 - 8
include/igl/decimate.cpp

@@ -107,14 +107,12 @@ IGL_INLINE bool igl::decimate(
   )
 {
   // Decimate 1
-  using namespace Eigen;
-  using namespace std;
   // Working copies
   Eigen::MatrixXd V = OV;
   Eigen::MatrixXi F = OF;
   // Why recompute this rather than copy input?
-  VectorXi EMAP;
-  MatrixXi E,EF,EI;
+  Eigen::VectorXi EMAP;
+  Eigen::MatrixXi E,EF,EI;
   edge_flaps(F,E,EMAP,EF,EI);
   {
     Eigen::Array<bool,Eigen::Dynamic,Eigen::Dynamic> BF;
@@ -129,7 +127,7 @@ IGL_INLINE bool igl::decimate(
   // Could reserve with https://stackoverflow.com/a/29236236/148668
   Eigen::VectorXi EQ = Eigen::VectorXi::Zero(E.rows());
   // If an edge were collapsed, we'd collapse it to these points:
-  MatrixXd C(E.rows(),V.cols());
+  Eigen::MatrixXd C(E.rows(),V.cols());
   // Pushing into a vector then using constructor was slower. Maybe using
   // std::move + make_heap would squeeze out something?
   
@@ -147,7 +145,7 @@ IGL_INLINE bool igl::decimate(
       // If we were using more modern C++ then cost_and_placement could return a
       // tuple and could be unpacked into auto [cost,p] =
       // cost_and_placement(...) without much issue.
-      RowVectorXd p(1,3);
+      Eigen::RowVectorXd p(1,3);
       cost_and_placement(e,V,F,E,EMAP,EF,EI,cost,p);
       C.row(e) = p;
       costs(e) = cost;
@@ -194,7 +192,7 @@ IGL_INLINE bool igl::decimate(
     prev_e = e;
   }
   // remove all IGL_COLLAPSE_EDGE_NULL faces
-  MatrixXi F2(F.rows(),3);
+  Eigen::MatrixXi F2(F.rows(),3);
   J.resize(F.rows());
   int m = 0;
   for(int f = 0;f<F.rows();f++)
@@ -211,7 +209,7 @@ IGL_INLINE bool igl::decimate(
   }
   F2.conservativeResize(m,F2.cols());
   J.conservativeResize(m);
-  VectorXi _1;
+  Eigen::VectorXi _1;
   igl::remove_unreferenced(V,F2,U,G,_1,I);
   return clean_finish;
 }

+ 7 - 9
include/igl/deform_skeleton.cpp

@@ -14,7 +14,6 @@ void igl::deform_skeleton(
   Eigen::MatrixXd & CT,
   Eigen::MatrixXi & BET)
 {
-  using namespace Eigen;
   assert(BE.rows() == (int)vA.size());
   CT.resize(2*BE.rows(),C.cols());
   BET.resize(BE.rows(),2);
@@ -22,9 +21,9 @@ void igl::deform_skeleton(
   {
     BET(e,0) = 2*e;
     BET(e,1) = 2*e+1;
-    Affine3d a = vA[e];
-    Vector3d c0 = C.row(BE(e,0));
-    Vector3d c1 = C.row(BE(e,1));
+    Eigen::Affine3d a = vA[e];
+    Eigen::Vector3d c0 = C.row(BE(e,0));
+    Eigen::Vector3d c1 = C.row(BE(e,1));
     CT.row(2*e) =   a * c0;
     CT.row(2*e+1) = a * c1;
   }
@@ -38,7 +37,6 @@ IGL_INLINE void igl::deform_skeleton(
   Eigen::MatrixXd & CT,
   Eigen::MatrixXi & BET)
 {
-  using namespace Eigen;
   //assert(BE.rows() == (int)vA.size());
   CT.resize(2*BE.rows(),C.cols());
   BET.resize(BE.rows(),2);
@@ -46,12 +44,12 @@ IGL_INLINE void igl::deform_skeleton(
   {
     BET(e,0) = 2*e;
     BET(e,1) = 2*e+1;
-    Matrix4d t;
+    Eigen::Matrix4d t;
     t << T.block(e*4,0,4,3).transpose(), 0,0,0,0;
-    Affine3d a;
+    Eigen::Affine3d a;
     a.matrix() = t;
-    Vector3d c0 = C.row(BE(e,0));
-    Vector3d c1 = C.row(BE(e,1));
+    Eigen::Vector3d c0 = C.row(BE(e,0));
+    Eigen::Vector3d c1 = C.row(BE(e,1));
     CT.row(2*e) =   a * c0;
     CT.row(2*e+1) = a * c1;
   }

+ 2 - 3
include/igl/dihedral_angles.cpp

@@ -23,11 +23,10 @@ IGL_INLINE void igl::dihedral_angles(
   Eigen::PlainObjectBase<Derivedtheta>& theta,
   Eigen::PlainObjectBase<Derivedcos_theta>& cos_theta)
 {
-  using namespace Eigen;
   assert(T.cols() == 4);
-  Matrix<typename Derivedtheta::Scalar,Dynamic,6> l;
+  Eigen::Matrix<typename Derivedtheta::Scalar ,Eigen::Dynamic,6> l;
   edge_lengths(V,T,l);
-  Matrix<typename Derivedtheta::Scalar,Dynamic,4> s;
+  Eigen::Matrix<typename Derivedtheta::Scalar ,Eigen::Dynamic,4> s;
   face_areas(l,s);
   return dihedral_angles_intrinsic(l,s,theta,cos_theta);
 }

+ 1 - 2
include/igl/dihedral_angles_intrinsic.cpp

@@ -22,12 +22,11 @@ IGL_INLINE void igl::dihedral_angles_intrinsic(
   Eigen::PlainObjectBase<Derivedtheta>& theta,
   Eigen::PlainObjectBase<Derivedcos_theta>& cos_theta)
 {
-  using namespace Eigen;
   const int m = L.rows();
   assert(m == A.rows());
   // Law of cosines
   // http://math.stackexchange.com/a/49340/35376
-  Matrix<typename Derivedtheta::Scalar,Dynamic,6> H_sqr(m,6);
+  Eigen::Matrix<typename Derivedtheta::Scalar ,Eigen::Dynamic,6> H_sqr(m,6);
   H_sqr.col(0) = (1./16.) * (4. * L.col(3).array().square() * L.col(0).array().square() - 
                                 ((L.col(1).array().square() + L.col(4).array().square()) -
                                  (L.col(2).array().square() + L.col(5).array().square())).square());

+ 46 - 50
include/igl/direct_delta_mush.cpp

@@ -19,8 +19,6 @@ IGL_INLINE void igl::direct_delta_mush(
   const Eigen::MatrixBase<DerivedOmega> & Omega,
   Eigen::PlainObjectBase<DerivedU> & U)
 {
-  using namespace Eigen;
-
   // Shape checks
   assert(V.cols() == 3 && "V should contain 3D positions.");
   assert(Omega.rows() == V.rows() && "Omega contain the same number of rows as V.");
@@ -35,48 +33,48 @@ IGL_INLINE void igl::direct_delta_mush(
   // Note:
   // In the paper, the rest pose vertices are represented in U \in R^{4 x #V}
   // Thus the formulae involving U would differ from the paper by a transpose.
-  Matrix<Scalar, Dynamic, 4> V_homogeneous(n, 4);
-  V_homogeneous << V, Matrix<Scalar, Dynamic, 1>::Ones(n, 1);
+  Eigen::Matrix<Scalar, Eigen::Dynamic, 4> V_homogeneous(n, 4);
+  V_homogeneous << V, Eigen::Matrix<Scalar, Eigen::Dynamic, 1>::Ones(n, 1);
   U.resize(n, 3);
 
   for (int i = 0; i < n; ++i)
   {
     // Construct Q matrix using Omega and Transformations
-    Matrix<Scalar, 4, 4> Q_mat(4, 4);
-    Q_mat = Matrix<Scalar, 4, 4>::Zero(4, 4);
+    Eigen::Matrix<Scalar, 4, 4> Q_mat(4, 4);
+    Q_mat = Eigen::Matrix<Scalar, 4, 4>::Zero(4, 4);
     for (int j = 0; j < m; ++j)
     {
-      Matrix<typename DerivedOmega::Scalar, 4, 4> Omega_curr(4, 4);
-      Matrix<typename DerivedOmega::Scalar, 10, 1> curr = Omega.block(i, j * 10, 1, 10).transpose();
+      Eigen::Matrix<typename DerivedOmega::Scalar, 4, 4> Omega_curr(4, 4);
+      Eigen::Matrix<typename DerivedOmega::Scalar, 10, 1> curr = Omega.block(i, j * 10, 1, 10).transpose();
       Omega_curr << curr(0), curr(1), curr(2), curr(3),
         curr(1), curr(4), curr(5), curr(6),
         curr(2), curr(5), curr(7), curr(8),
         curr(3), curr(6), curr(8), curr(9);
 
-      Affine3d M_curr = T[j];
+      Eigen::Affine3d M_curr = T[j];
       Q_mat += M_curr.matrix() * Omega_curr;
     }
     // Normalize so that the last element is 1
     Q_mat /= Q_mat(Q_mat.rows() - 1, Q_mat.cols() - 1);
 
-    Matrix<Scalar, 3, 3> Q_i = Q_mat.block(0, 0, 3, 3);
-    Matrix<Scalar, 3, 1> q_i = Q_mat.block(0, 3, 3, 1);
-    Matrix<Scalar, 3, 1> p_i = Q_mat.block(3, 0, 1, 3).transpose();
+    Eigen::Matrix<Scalar, 3, 3> Q_i = Q_mat.block(0, 0, 3, 3);
+    Eigen::Matrix<Scalar, 3, 1> q_i = Q_mat.block(0, 3, 3, 1);
+    Eigen::Matrix<Scalar, 3, 1> p_i = Q_mat.block(3, 0, 1, 3).transpose();
 
     // Get rotation and translation matrices using SVD
-    Matrix<Scalar, 3, 3> SVD_i = Q_i - q_i * p_i.transpose();
-    JacobiSVD<Matrix<Scalar, 3, 3>> svd;
-    svd.compute(SVD_i, ComputeFullU | ComputeFullV);
-    Matrix<Scalar, 3, 3> R_i = svd.matrixU() * svd.matrixV().transpose();
-    Matrix<Scalar, 3, 1> t_i = q_i - R_i * p_i;
+    Eigen::Matrix<Scalar, 3, 3> SVD_i = Q_i - q_i * p_i.transpose();
+    Eigen::JacobiSVD<Eigen::Matrix<Scalar, 3, 3>> svd;
+    svd.compute(SVD_i, Eigen::ComputeFullU | Eigen::ComputeFullV);
+    Eigen::Matrix<Scalar, 3, 3> R_i = svd.matrixU() * svd.matrixV().transpose();
+    Eigen::Matrix<Scalar, 3, 1> t_i = q_i - R_i * p_i;
 
     // Gamma final transformation matrix
-    Matrix<Scalar, 3, 4> Gamma_i(3, 4);
+    Eigen::Matrix<Scalar, 3, 4> Gamma_i(3, 4);
     Gamma_i.block(0, 0, 3, 3) = R_i;
     Gamma_i.block(0, 3, 3, 1) = t_i;
 
     // Final deformed position
-    Matrix<Scalar, 4, 1> v_i = V_homogeneous.row(i);
+    Eigen::Matrix<Scalar, 4, 1> v_i = V_homogeneous.row(i);
     U.row(i) = Gamma_i * v_i;
   }
 }
@@ -96,8 +94,6 @@ IGL_INLINE void igl::direct_delta_mush_precomputation(
   const typename DerivedV::Scalar alpha,
   Eigen::PlainObjectBase<DerivedOmega> & Omega)
 {
-  using namespace Eigen;
-
   // Shape checks
   assert(V.cols() == 3 && "V should contain 3D positions.");
   assert(F.cols() == 3 && "F should contain triangles.");
@@ -118,10 +114,10 @@ IGL_INLINE void igl::direct_delta_mush_precomputation(
   //      9  10 11 12      0  1  2  3  4  5  6   7   8   9
   //      13 14 15 16
   auto extract_upper_triangle = [](
-    const Matrix<Scalar, Dynamic, Dynamic> & full) -> Matrix<Scalar, Dynamic, 1>
+    const Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> & full) -> Eigen::Matrix<Scalar, Eigen::Dynamic, 1>
   {
     int dims = full.rows();
-    Matrix<Scalar, Dynamic, 1> upper_triangle((dims * (dims + 1)) / 2);
+    Eigen::Matrix<Scalar, Eigen::Dynamic, 1> upper_triangle((dims * (dims + 1)) / 2);
     int vector_idx = 0;
     for (int i = 0; i < dims; ++i)
     {
@@ -141,20 +137,20 @@ IGL_INLINE void igl::direct_delta_mush_precomputation(
   // Note:
   // in the paper, the rest pose vertices are represented in U \in R^{4 \times #V}
   // Thus the formulae involving U would differ from the paper by a transpose.
-  Matrix<Scalar, Dynamic, 4> V_homogeneous(n, 4);
-  V_homogeneous << V, Matrix<Scalar, Dynamic, 1>::Ones(n);
+  Eigen::Matrix<Scalar, Eigen::Dynamic, 4> V_homogeneous(n, 4);
+  V_homogeneous << V, Eigen::Matrix<Scalar, Eigen::Dynamic, 1>::Ones(n);
 
   // Identity matrix of #V by #V
-  SparseMatrix<Scalar> I(n, n);
+  Eigen::SparseMatrix<Scalar> I(n, n);
   I.setIdentity();
 
   // Laplacian matrix of #V by #V
   // L_bar = L \times D_L^{-1}
-  SparseMatrix<Scalar> L;
+  Eigen::SparseMatrix<Scalar> L;
   igl::cotmatrix(V, F, L);
   L = -L;
   // Inverse of diagonal matrix = reciprocal elements in diagonal
-  Matrix<Scalar, Dynamic, 1> D_L = L.diagonal();
+  Eigen::Matrix<Scalar, Eigen::Dynamic, 1> D_L = L.diagonal();
   // D_L = D_L.array().pow(-1);  // Not using this since not sure if diagonal contains 0
   for (int i = 0; i < D_L.size(); ++i)
   {
@@ -163,17 +159,17 @@ IGL_INLINE void igl::direct_delta_mush_precomputation(
       D_L(i) = 1 / D_L(i);
     }
   }
-  SparseMatrix<Scalar> D_L_inv = D_L.asDiagonal().toDenseMatrix().sparseView();
-  SparseMatrix<Scalar> L_bar = L * D_L_inv;
+  Eigen::SparseMatrix<Scalar> D_L_inv = D_L.asDiagonal().toDenseMatrix().sparseView();
+  Eigen::SparseMatrix<Scalar> L_bar = L * D_L_inv;
 
   // Implicitly and iteratively solve for W'
   // w'_{ij} = \sum_{k=1}^{n}{C_{ki} w_{kj}}      where C = (I + kappa L_bar)^{-p}:
   // W' = C^T \times W  =>  c^T W_k = W_{k-1}     where c = (I + kappa L_bar)
   // C positive semi-definite => ldlt solver
-  SimplicialLDLT<SparseMatrix<Scalar>> ldlt_W_prime;
-  SparseMatrix<Scalar> c(I + kappa * L_bar);
+  Eigen::SimplicialLDLT<Eigen::SparseMatrix<Scalar>> ldlt_W_prime;
+  Eigen::SparseMatrix<Scalar> c(I + kappa * L_bar);
   // working copy
-  PlainMatrix<DerivedW,Dynamic,Dynamic> W_prime(W);
+  PlainMatrix<DerivedW ,Eigen::Dynamic ,Eigen::Dynamic> W_prime(W);
   ldlt_W_prime.compute(c.transpose());
   for (int iter = 0; iter < p; ++iter)
   {
@@ -182,23 +178,23 @@ IGL_INLINE void igl::direct_delta_mush_precomputation(
 
   // U_precomputed: #V by 10
   // Cache u_i^T \dot u_i \in R^{4 x 4} to reduce computation time.
-  Matrix<Scalar, Dynamic, 10> U_precomputed(n, 10);
+  Eigen::Matrix<Scalar, Eigen::Dynamic, 10> U_precomputed(n, 10);
   for (int k = 0; k < n; ++k)
   {
-    Matrix<Scalar, 4, 4> u_full = V_homogeneous.row(k).transpose() * V_homogeneous.row(k);
+    Eigen::Matrix<Scalar, 4, 4> u_full = V_homogeneous.row(k).transpose() * V_homogeneous.row(k);
     U_precomputed.row(k) = extract_upper_triangle(u_full);
   }
 
   // U_prime: #V by #T*10 of u_{jx}
   // Each column of U_prime (u_{jx}) is the element-wise product of
   // W_j and U_precomputed_x where j \in {1...m}, x \in {1...10}
-  Matrix<Scalar, Dynamic, Dynamic> U_prime(n, m * 10);
+  Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> U_prime(n, m * 10);
   for (int j = 0; j < m; ++j)
   {
-    Matrix<Scalar, Dynamic, 1> w_j = W.col(j);
+    Eigen::Matrix<Scalar, Eigen::Dynamic, 1> w_j = W.col(j);
     for (int x = 0; x < 10; ++x)
     {
-      Matrix<Scalar, Dynamic, 1> u_x = U_precomputed.col(x);
+      Eigen::Matrix<Scalar, Eigen::Dynamic, 1> u_x = U_precomputed.col(x);
       U_prime.col(10 * j + x) = w_j.array() * u_x.array();
     }
   }
@@ -206,16 +202,16 @@ IGL_INLINE void igl::direct_delta_mush_precomputation(
   // Implicitly and iteratively solve for Psi: #V by #T*10 of \Psi_{ij}s.
   // Note: Using dense matrices to solve for Psi will cause the program to hang.
   // The following won't work
-  // Matrix<Scalar, Dynamic, Dynamic> Psi(U_prime);
-  // Matrix<Scalar, Dynamic, Dynamic> b((I + lambda * L_bar).transpose());
+  // Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> Psi(U_prime);
+  // Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> b((I + lambda * L_bar).transpose());
   // for (int iter = 0; iter < p; ++iter)
   // {
   //   Psi = b.ldlt().solve(Psi);  // hangs here
   // }
   // Convert to sparse matrices and compute
-  Matrix<Scalar, Dynamic, Dynamic> Psi = U_prime.sparseView();
-  SparseMatrix<Scalar> b = (I + lambda * L_bar).transpose();
-  SimplicialLDLT<SparseMatrix<Scalar>> ldlt_Psi;
+  Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> Psi = U_prime.sparseView();
+  Eigen::SparseMatrix<Scalar> b = (I + lambda * L_bar).transpose();
+  Eigen::SimplicialLDLT<Eigen::SparseMatrix<Scalar>> ldlt_Psi;
   ldlt_Psi.compute(b);
   for (int iter = 0; iter < p; ++iter)
   {
@@ -226,20 +222,20 @@ IGL_INLINE void igl::direct_delta_mush_precomputation(
   //    p_i p_i^T , p_i
   //    p_i^T     , 1
   // where p_i = (\sum_{j=1}^{n} Psi_{ij})'s top right 3 by 1 column
-  Matrix<Scalar, Dynamic, 10> P(n, 10);
+  Eigen::Matrix<Scalar, Eigen::Dynamic, 10> P(n, 10);
   for (int i = 0; i < n; ++i)
   {
-    Matrix<Scalar, 3, 1> p_i = Matrix<Scalar, 3, 1>::Zero(3);
+    Eigen::Matrix<Scalar, 3, 1> p_i = Eigen::Matrix<Scalar, 3, 1>::Zero(3);
     Scalar last = 0;
     for (int j = 0; j < m; ++j)
     {
-      Matrix<Scalar, 3, 1> p_i_curr(3);
+      Eigen::Matrix<Scalar, 3, 1> p_i_curr(3);
       p_i_curr << Psi(i, j * 10 + 3), Psi(i, j * 10 + 6), Psi(i, j * 10 + 8);
       p_i += p_i_curr;
       last += Psi(i, j * 10 + 9);
     }
     p_i /= last;  // normalize
-    Matrix<Scalar, 4, 4> p_matrix(4, 4);
+    Eigen::Matrix<Scalar, 4, 4> p_matrix(4, 4);
     p_matrix.block(0, 0, 3, 3) = p_i * p_i.transpose();
     p_matrix.block(0, 3, 3, 1) = p_i;
     p_matrix.block(3, 0, 1, 3) = p_i.transpose();
@@ -251,11 +247,11 @@ IGL_INLINE void igl::direct_delta_mush_precomputation(
   Omega.resize(n, m * 10);
   for (int i = 0; i < n; ++i)
   {
-    Matrix<Scalar, 10, 1> p_vector = P.row(i);
+    Eigen::Matrix<Scalar, 10, 1> p_vector = P.row(i);
     for (int j = 0; j < m; ++j)
     {
-      Matrix<Scalar, 10, 1> Omega_curr(10);
-      Matrix<Scalar, 10, 1> Psi_curr = Psi.block(i, j * 10, 1, 10).transpose();
+      Eigen::Matrix<Scalar, 10, 1> Omega_curr(10);
+      Eigen::Matrix<Scalar, 10, 1> Psi_curr = Psi.block(i, j * 10, 1, 10).transpose();
       Omega_curr = (1. - alpha) * Psi_curr + alpha * W_prime(i, j) * p_vector;
       Omega.block(i, j * 10, 1, 10) = Omega_curr.transpose();
     }

+ 1 - 2
include/igl/directed_edge_orientations.cpp

@@ -14,12 +14,11 @@ IGL_INLINE void igl::directed_edge_orientations(
   std::vector<
       Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & Q)
 {
-  using namespace Eigen;
   Q.resize(E.rows());
   for(int e = 0;e<E.rows();e++)
   {
     const auto & b = C.row(E(e,1)) - C.row(E(e,0));
-    Q[e].setFromTwoVectors( RowVector3d(1,0,0),b);
+    Q[e].setFromTwoVectors( Eigen::RowVector3d(1,0,0),b);
   }
 }
 

+ 0 - 2
include/igl/directed_edge_parents.cpp

@@ -15,8 +15,6 @@ IGL_INLINE void igl::directed_edge_parents(
   const Eigen::MatrixBase<DerivedE> & E,
   Eigen::PlainObjectBase<DerivedP> & P)
 {
-  using namespace Eigen;
-  using namespace std;
   typedef Eigen::Matrix<typename DerivedE::Scalar, Eigen::Dynamic, 1> VectorT;
 
   VectorT I = VectorT::Constant(E.maxCoeff()+1,1,-1);

+ 2 - 4
include/igl/doublearea.cpp

@@ -147,21 +147,19 @@ IGL_INLINE void igl::doublearea(
   const typename Derivedl::Scalar nan_replacement,
   Eigen::PlainObjectBase<DeriveddblA> & dblA)
 {
-  using namespace Eigen;
-  using namespace std;
   typedef typename Derivedl::Index Index;
   // Only support triangles
   assert(ul.cols() == 3);
   // Number of triangles
   const Index m = ul.rows();
   Eigen::Matrix<typename Derivedl::Scalar, Eigen::Dynamic, 3> l;
-  MatrixXi _;
+  Eigen::MatrixXi _;
   //
   // "Miscalculating Area and Angles of a Needle-like Triangle"
   // https://people.eecs.berkeley.edu/~wkahan/Triangle.pdf
   igl::sort(ul,2,false,l,_);
   // semiperimeters
-  //Matrix<typename Derivedl::Scalar,Dynamic,1> s = l.rowwise().sum()*0.5;
+  //Matrix<typename Derivedl::Scalar ,Eigen::Dynamic,1> s = l.rowwise().sum()*0.5;
   //assert((Index)s.rows() == m);
   // resize output
   dblA.resize(l.rows(),1);

+ 3 - 3
include/igl/doublearea.h

@@ -14,11 +14,11 @@ namespace igl
   /// Computes twice the area for each input triangle or quad.
   ///
   /// @tparam  DerivedV  derived type of eigen matrix for V (e.g. derived from
-  ///     MatrixXd)
+  ///     Eigen::MatrixXd)
   /// @tparam  DerivedF  derived type of eigen matrix for F (e.g. derived from
-  ///     MatrixXi)
+  ///     Eigen::MatrixXi)
   /// @tparam  DeriveddblA  derived type of eigen matrix for dblA (e.g. derived from
-  ///     MatrixXd)
+  ///     Eigen::MatrixXd)
   /// @param[in] V  #V by dim list of mesh vertex positions
   /// @param[in] F  #F by (3|4) list of mesh faces (must be triangles or quads)
   /// @param[out] dblA  #F list of triangle[quad] double areas (SIGNED only for 2D input)

+ 1 - 2
include/igl/dqs.cpp

@@ -22,7 +22,6 @@ IGL_INLINE void igl::dqs(
   const std::vector<T> & vT,
   Eigen::PlainObjectBase<DerivedU> & U)
 {
-  using namespace std;
   assert(V.rows() <= W.rows());
   assert(W.cols() == (int)vQ.size());
   assert(W.cols() == (int)vT.size());
@@ -30,7 +29,7 @@ IGL_INLINE void igl::dqs(
   U.resizeLike(V);
 
   // Convert quats + trans into dual parts
-  vector<Q> vD(vQ.size());
+  std::vector<Q> vD(vQ.size());
   for(int c = 0;c<W.cols();c++)
   {
     const Q & q = vQ[c];

+ 9 - 11
include/igl/edge_collapse_is_valid.cpp

@@ -27,8 +27,6 @@ IGL_INLINE bool igl::edge_collapse_is_valid(
   const Eigen::MatrixBase<DerivedEF> & EF,
   const Eigen::MatrixBase<DerivedEI> & EI)
 {
-  using namespace Eigen;
-  using namespace std;
   // For consistency with collapse_edge.cpp, let's determine edge flipness
   // (though not needed to check validity)
   const int eflip = E(e,0)>E(e,1);
@@ -49,32 +47,32 @@ IGL_INLINE bool igl::edge_collapse_is_valid(
       const int e,
       const bool ccw)
     {
-      vector<int> N,uN;
-      vector<int> V2Fe = circulation(e, ccw,EMAP,EF,EI);
+      std::vector<int> N,uN;
+      std::vector<int> V2Fe = circulation(e, ccw,EMAP,EF,EI);
       for(auto f : V2Fe)
       {
         N.push_back(F(f,0));
         N.push_back(F(f,1));
         N.push_back(F(f,2));
       }
-      vector<size_t> _1,_2;
+      std::vector<size_t> _1,_2;
       igl::unique(N,uN,_1,_2);
-      VectorXi uNm;
+      Eigen::VectorXi uNm;
       list_to_matrix(uN,uNm);
       return uNm;
     };
-    VectorXi Ns = neighbors(e, eflip);
-    VectorXi Nd = neighbors(e,!eflip);
-    VectorXi Nint = igl::intersect(Ns,Nd);
+    Eigen::VectorXi Ns = neighbors(e, eflip);
+    Eigen::VectorXi Nd = neighbors(e,!eflip);
+    Eigen::VectorXi Nint = igl::intersect(Ns,Nd);
     if(Nint.size() != 4)
     {
       return false;
     }
     if(Ns.size() == 4 && Nd.size() == 4)
     {
-      VectorXi NsNd(8);
+      Eigen::VectorXi NsNd(8);
       NsNd<<Ns,Nd;
-      VectorXi Nun,_1,_2;
+      Eigen::VectorXi Nun,_1,_2;
       igl::unique(NsNd,Nun,_1,_2);
       // single tet, don't collapse
       if(Nun.size() == 4)

+ 3 - 3
include/igl/edge_lengths.h

@@ -16,9 +16,9 @@ namespace igl
   /// Constructs a list of lengths of edges opposite each index in a face
   /// (triangle/tet) list
   ///
-  /// @tparam DerivedV derived from vertex positions matrix type: i.e. MatrixXd
-  /// @tparam DerivedF derived from face indices matrix type: i.e. MatrixXi
-  /// @tparam DerivedL derived from edge lengths matrix type: i.e. MatrixXd
+  /// @tparam DerivedV derived from vertex positions matrix type: i.e. Eigen::MatrixXd
+  /// @tparam DerivedF derived from face indices matrix type: i.e. Eigen::MatrixXi
+  /// @tparam DerivedL derived from edge lengths matrix type: i.e. Eigen::MatrixXd
   /// @param[in] V  eigen matrix #V by 3
   /// @param[in] F  #F by (2|3|4) list of mesh simplex indices into rows of V
   /// @param[out] L  #F by {1|3|6} list of edge lengths 

+ 5 - 7
include/igl/eigs.cpp

@@ -26,8 +26,6 @@ IGL_INLINE bool igl::eigs(
   Eigen::PlainObjectBase<DerivedU> & sU,
   Eigen::PlainObjectBase<DerivedS> & sS)
 {
-  using namespace Eigen;
-  using namespace std;
   const size_t n = A.rows();
   assert(A.cols() == n && "A should be square.");
   assert(iB.rows() == n && "B should be match A's dims.");
@@ -99,8 +97,8 @@ IGL_INLINE bool igl::eigs(
           break;
         case EIGS_TYPE_SM:
         {
-          SimplicialLDLT<SparseMatrix<Scalar> > solver;
-          const SparseMatrix<Scalar> C = A-eff_sigma*B+tikhonov*B;
+          Eigen::SimplicialLDLT<Eigen::SparseMatrix<Scalar> > solver;
+          const Eigen::SparseMatrix<Scalar> C = A-eff_sigma*B+tikhonov*B;
           //mw.save(C,"C");
           //mw.save(eff_sigma,"eff_sigma");
           //mw.save(tikhonov,"tikhonov");
@@ -134,7 +132,7 @@ IGL_INLINE bool igl::eigs(
     }
     if(iter == max_iter)
     {
-      cerr<<"Failed to converge."<<endl;
+      std::cerr<<"Failed to converge."<<std::endl;
       return false;
     }
     if(
@@ -158,11 +156,11 @@ IGL_INLINE bool igl::eigs(
       //std::cout<<"  "<<(S.head(i).array()-sigma).abs().maxCoeff()<<std::endl;
       //std::cout<<"  "<<(U.leftCols(i).transpose()*B*x).array().abs().transpose()<<std::endl;
       // restart with new random guess.
-      cout<<"igl::eigs RESTART"<<endl;
+      std::cout<<"igl::eigs RESTART"<<std::endl;
     }
   }
   // finally sort
-  VectorXi I;
+  Eigen::VectorXi I;
   igl::sort(S,1,false,sS,I);
   sU = U(igl::placeholders::all,I);
   sS /= rescale;

+ 9 - 11
include/igl/embree/EmbreeIntersector.cpp

@@ -59,7 +59,6 @@ IGL_INLINE void igl::embree::EmbreeIntersector::init(
   if(initialized)
     deinit();
 
-  using namespace std;
 
   if(V.size() == 0 || F.size() == 0)
   {
@@ -110,10 +109,10 @@ IGL_INLINE void igl::embree::EmbreeIntersector::init(
   rtcCommitScene(scene);
 
   if(rtcGetDeviceError (device) != RTC_ERROR_NONE)
-      std::cerr << "Embree: An error occurred while initializing the provided geometry!" << endl;
+      std::cerr << "Embree: An error occurred while initializing the provided geometry!" << std::endl;
 #ifdef IGL_VERBOSE
   else
-    std::cerr << "Embree: geometry added." << endl;
+    std::cerr << "Embree: geometry added." << std::endl;
 #endif
 
   initialized = true;
@@ -245,7 +244,6 @@ igl::embree::EmbreeIntersector
   float tfar,
   int mask) const
 {
-  using namespace std;
   num_rays = 0;
   hits.clear();
   int last_id0 = -1;
@@ -283,7 +281,7 @@ igl::embree::EmbreeIntersector
         //double t_push = pow(2.0,self_hits-4)*(hit.t<eps?eps:hit.t);
         double t_push = pow(2.0,self_hits)*eps;
         #ifdef IGL_VERBOSE
-        std::cerr<<"  t_push: "<<t_push<<endl;
+        std::cerr<<"  t_push: "<<t_push<<std::endl;
         #endif
         //o = o+t_push*d;
         min_t += t_push;
@@ -299,7 +297,7 @@ igl::embree::EmbreeIntersector
         hit.t = ray.ray.tfar;
         hits.push_back(hit);
 #ifdef IGL_VERBOSE
-        std::cerr<<"  t: "<<hit.t<<endl;
+        std::cerr<<"  t: "<<hit.t<<std::endl;
 #endif
         // Instead of moving origin, just change min_t. That way calculations
         // all use exactly same origin values
@@ -315,9 +313,9 @@ igl::embree::EmbreeIntersector
 
     if(hits.size()>1000 && !large_hits_warned)
     {
-      std::cout<<"Warning: Large number of hits..."<<endl;
+      std::cout<<"Warning: Large number of hits..."<<std::endl;
       std::cout<<"[ ";
-      for(vector<Hit<float>>::iterator hit = hits.begin(); hit != hits.end();hit++)
+      for(std::vector<Hit<float>>::iterator hit = hits.begin(); hit != hits.end();hit++)
       {
         std::cout<<(hit->id+1)<<" ";
       }
@@ -325,12 +323,12 @@ igl::embree::EmbreeIntersector
       std::cout.precision(std::numeric_limits< double >::digits10);
       std::cout<<"[ ";
 
-      for(vector<Hit<float>>::iterator hit = hits.begin(); hit != hits.end(); hit++)
+      for(std::vector<Hit<float>>::iterator hit = hits.begin(); hit != hits.end(); hit++)
       {
-        std::cout<<(hit->t)<<endl;;
+        std::cout<<(hit->t)<<std::endl;
       }
 
-      std::cout<<"]"<<endl;
+      std::cout<<"]"<<std::endl;
       large_hits_warned = true;
 
       return hits.empty();

+ 2 - 3
include/igl/embree/EmbreeRenderer.cpp

@@ -91,7 +91,6 @@ IGL_INLINE void igl::embree::EmbreeRenderer::init(
   if(initialized)
     deinit();
 
-  using namespace std;
 
   if(V.size() == 0 || F.size() == 0)
   {
@@ -136,10 +135,10 @@ IGL_INLINE void igl::embree::EmbreeRenderer::init(
   rtcCommitScene(scene);
 
   if(rtcGetDeviceError (device) != RTC_ERROR_NONE)
-      std::cerr << "Embree: An error occurred while initializing the provided geometry!" << endl;
+      std::cerr << "Embree: An error occurred while initializing the provided geometry!" << std::endl;
 #ifdef IGL_VERBOSE
   else
-    std::cerr << "Embree: geometry added." << endl;
+    std::cerr << "Embree: geometry added." << std::endl;
 #endif
 
   initialized = true;

+ 0 - 1
include/igl/embree/ambient_occlusion.cpp

@@ -50,7 +50,6 @@ IGL_INLINE void igl::embree::ambient_occlusion(
   const int num_samples,
   Eigen::PlainObjectBase<DerivedS> & S)
 {
-  using namespace Eigen;
   EmbreeIntersector ei;
   ei.init(V.template cast<float>(),F.template cast<int>());
   ambient_occlusion(ei,P,N,num_samples,S);

+ 16 - 18
include/igl/embree/bone_heat.cpp

@@ -23,8 +23,6 @@ bool igl::embree::bone_heat(
   const Eigen::MatrixXi & CE,
   Eigen::MatrixXd & W)
 {
-  using namespace std;
-  using namespace Eigen;
   assert(CE.rows() == 0 && "Cage edges not supported.");
   assert(C.cols() == V.cols() && "V and C should have same #cols");
   assert(BE.cols() == 2 && "BE should have #cols=2");
@@ -37,22 +35,22 @@ bool igl::embree::bone_heat(
   const int m = np + nb;
 
   // "double sided lighting"
-  MatrixXi FF;
+  Eigen::MatrixXi FF;
   FF.resize(F.rows()*2,F.cols());
   FF << F, F.rowwise().reverse();
   // Initialize intersector
   EmbreeIntersector ei;
   ei.init(V.cast<float>(),F.cast<int>());
 
-  typedef Matrix<bool,Dynamic,1> VectorXb;
-  typedef Matrix<bool,Dynamic,Dynamic> MatrixXb;
+  typedef Eigen::Matrix<bool ,Eigen::Dynamic,1> VectorXb;
+  typedef Eigen::Matrix<bool ,Eigen::Dynamic ,Eigen::Dynamic> MatrixXb;
   MatrixXb vis_mask(n,m);
   // Distances
-  MatrixXd D(n,m);
+  Eigen::MatrixXd D(n,m);
   // loop over points
   for(int j = 0;j<np;j++)
   {
-    const Vector3d p = C.row(P(j));
+    const Eigen::Vector3d p = C.row(P(j));
     D.col(j) = (V.rowwise()-p.transpose()).rowwise().norm();
     VectorXb vj;
     bone_visible(V,F,ei,p,p,vj);
@@ -62,9 +60,9 @@ bool igl::embree::bone_heat(
   // loop over bones
   for(int j = 0;j<nb;j++)
   {
-    const Vector3d s = C.row(BE(j,0));
-    const Vector3d d = C.row(BE(j,1));
-    VectorXd t,sqrD;
+    const Eigen::Vector3d s = C.row(BE(j,0));
+    const Eigen::Vector3d d = C.row(BE(j,1));
+    Eigen::VectorXd t,sqrD;
     project_to_line_segment(V,s,d,t,sqrD);
     D.col(np+j) = sqrD.array().sqrt();
     VectorXb vj;
@@ -74,10 +72,10 @@ bool igl::embree::bone_heat(
 
   assert(CE.rows() == 0 && "Cage edges not supported.");
 
-  MatrixXd PP = MatrixXd::Zero(n,m);
-  VectorXd min_D;
-  VectorXd Hdiag = VectorXd::Zero(n);
-  VectorXi J;
+  Eigen::MatrixXd PP = Eigen::MatrixXd::Zero(n,m);
+  Eigen::VectorXd min_D;
+  Eigen::VectorXd Hdiag = Eigen::VectorXd::Zero(n);
+  Eigen::VectorXi J;
   igl::min(D,2,min_D,J);
   for(int i = 0;i<n;i++)
   {
@@ -88,12 +86,12 @@ bool igl::embree::bone_heat(
       Hdiag(i) = (hii>1e10?1e10:hii);
     }
   }
-  SparseMatrix<double> Q,L,M;
+  Eigen::SparseMatrix<double> Q,L,M;
   cotmatrix(V,F,L);
   massmatrix(V,F,MASSMATRIX_TYPE_DEFAULT,M);
   const auto & H = Hdiag.asDiagonal();
   Q = (-L+M*H);
-  SimplicialLLT <SparseMatrix<double > > llt;
+  Eigen::SimplicialLLT <Eigen::SparseMatrix<double > > llt;
   llt.compute(Q);
   switch(llt.info())
   {
@@ -101,12 +99,12 @@ bool igl::embree::bone_heat(
       break;
     case Eigen::NumericalIssue:
 #ifdef IGL_BONE_HEAT_DEBUG
-      cerr<<"Error: Numerical issue."<<endl;
+      std::cerr<<"Error: Numerical issue."<<std::endl;
 #endif
       return false;
     default:
 #ifdef IGL_BONE_HEAT_DEBUG
-      cerr<<"Error: Other."<<endl;
+      std::cerr<<"Error: Other."<<std::endl;
 #endif
       return false;
   }

+ 9 - 11
include/igl/embree/bone_visible.cpp

@@ -48,19 +48,17 @@ IGL_INLINE void igl::embree::bone_visible(
   const Eigen::MatrixBase<DerivedSD> & d,
   Eigen::PlainObjectBase<Derivedflag>  & flag)
 {
-  using namespace std;
-  using namespace Eigen;
   flag.resize(V.rows());
   const double sd_norm = (s-d).norm();
   // Embree seems to be parallel when constructing but not when tracing rays
   // loop over mesh vertices
   parallel_for(V.rows(),[&](const int v)
   {
-    const Vector3d Vv = V.row(v);
+    const Eigen::Vector3d Vv = V.row(v);
     // Project vertex v onto line segment sd
     //embree.intersectSegment
     double t,sqrd;
-    Vector3d projv;
+    Eigen::Vector3d projv;
     // degenerate bone, just snap to s
     if(sd_norm < DOUBLE_EPS)
     {
@@ -91,7 +89,7 @@ IGL_INLINE void igl::embree::bone_visible(
     igl::Hit<float> hit;
     // perhaps 1.0 should be 1.0-epsilon, or actually since we checking the
     // incident face, perhaps 1.0 should be 1.0+eps
-    const Vector3d dir = (Vv-projv)*1.0;
+    const Eigen::Vector3d dir = (Vv-projv)*1.0;
     if(ei.intersectSegment(
        projv.template cast<float>(),
        dir.template cast<float>(), 
@@ -107,12 +105,12 @@ IGL_INLINE void igl::embree::bone_visible(
       //  P = V.row(F(fi,0))*bc(0) + 
       //      V.row(F(fi,1))*bc(1) + 
       //      V.row(F(fi,2))*bc(2);
-      //  cout<<(fi+1)<<endl;
-      //  cout<<bc.transpose()<<endl;
-      //  cout<<P.transpose()<<endl;
-      //  cout<<hit.t<<endl;
-      //  cout<<(projv + dir*hit.t).transpose()<<endl;
-      //  cout<<Vv.transpose()<<endl;
+      //  std::cout<<(fi+1)<<std::endl;
+      //  std::cout<<bc.transpose()<<std::endl;
+      //  std::cout<<P.transpose()<<std::endl;
+      //  std::cout<<hit.t<<std::endl;
+      //  std::cout<<(projv + dir*hit.t).transpose()<<std::endl;
+      //  std::cout<<Vv.transpose()<<std::endl;
       //}
 
       // Assume hit is valid, so not visible

+ 30 - 32
include/igl/embree/reorient_facets_raycast.cpp

@@ -33,8 +33,6 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
   Eigen::PlainObjectBase<DerivedI> & I,
   Eigen::PlainObjectBase<DerivedC> & C)
 {
-  using namespace Eigen;
-  using namespace std;
   assert(F.cols() == 3);
   assert(V.cols() == 3);
 
@@ -49,10 +47,10 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
     for (int i = 0; i < m; ++i) C(i) = i;
 
   } else {
-    if (is_verbose) cout << "extracting patches... ";
+    if (is_verbose) std::cout << "extracting patches... ";
     bfs_orient(Fi,FF,C);
   }
-  if (is_verbose) cout << (C.maxCoeff() + 1)  << " components. ";
+  if (is_verbose) std::cout << (C.maxCoeff() + 1)  << " components. ";
 
   // number of patches
   const int num_cc = C.maxCoeff()+1;
@@ -62,36 +60,36 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
   ei.init(V.template cast<float>(),FF);
 
   // face normal
-  MatrixXd N;
+  Eigen::MatrixXd N;
   per_face_normals(V,FF,N);
 
   // face area
-  Matrix<typename DerivedV::Scalar,Dynamic,1> A;
+  Eigen::Matrix<typename DerivedV::Scalar ,Eigen::Dynamic,1> A;
   doublearea(V,FF,A);
   double area_total = A.sum();
 
   // determine number of rays per component according to its area
-  VectorXd area_per_component;
+  Eigen::VectorXd area_per_component;
   area_per_component.setZero(num_cc);
   for (int f = 0; f < m; ++f)
   {
     area_per_component(C(f)) += A(f);
   }
-  VectorXi num_rays_per_component(num_cc);
+  Eigen::VectorXi num_rays_per_component(num_cc);
   for (int c = 0; c < num_cc; ++c)
   {
-    num_rays_per_component(c) = max<int>(static_cast<int>(rays_total * area_per_component(c) / area_total), rays_minimum);
+    num_rays_per_component(c) = std::max<int>(static_cast<int>(rays_total * area_per_component(c) / area_total), rays_minimum);
   }
   rays_total = num_rays_per_component.sum();
 
   // generate all the rays
-  if (is_verbose) cout << "generating rays... ";
-  uniform_real_distribution<float> rdist;
-  mt19937 prng;
+  if (is_verbose) std::cout << "generating rays... ";
+  std::uniform_real_distribution<float> rdist;
+  std::mt19937 prng;
   prng.seed(time(nullptr));
-  vector<int     > ray_face;
-  vector<Vector3f> ray_ori;
-  vector<Vector3f> ray_dir;
+  std::vector<int     > ray_face;
+  std::vector<Eigen::Vector3f> ray_ori;
+  std::vector<Eigen::Vector3f> ray_dir;
   ray_face.reserve(rays_total);
   ray_ori .reserve(rays_total);
   ray_dir .reserve(rays_total);
@@ -101,8 +99,8 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
     {
       continue;
     }
-    vector<int> CF;     // set of faces per component
-    vector<double> CF_area;
+    std::vector<int> CF;     // set of faces per component
+    std::vector<double> CF_area;
     for (int f = 0; f < m; ++f)
     {
       if (C(f)==c)
@@ -112,7 +110,7 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
       }
     }
     // discrete distribution for random selection of faces with probability proportional to their areas
-    discrete_distribution<int> ddist(CF.size(), 0, CF.size(), [&](double i){ return CF_area[static_cast<int>(i)]; });       // simple ctor of (Iter, Iter) not provided by the stupid VC11/12
+    std::discrete_distribution<int> ddist(CF.size(), 0, CF.size(), [&](double i){ return CF_area[static_cast<int>(i)]; });       // simple ctor of (Iter, Iter) not provided by the stupid VC11/12
     for (int i = 0; i < num_rays_per_component[c]; ++i)
     {
       int f = CF[ddist(prng)];          // select face with probability proportional to face area
@@ -122,13 +120,13 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
       float a = 1 - sqrt_t;
       float b = (1 - s) * sqrt_t;
       float c = s * sqrt_t;
-      Vector3f p = a * V.row(FF(f,0)).template cast<float>().eval()       // be careful with the index!!!
+      Eigen::Vector3f p = a * V.row(FF(f,0)).template cast<float>().eval()       // be careful with the index!!!
                  + b * V.row(FF(f,1)).template cast<float>().eval()
                  + c * V.row(FF(f,2)).template cast<float>().eval();
-      Vector3f n = N.row(f).cast<float>();
+      Eigen::Vector3f n = N.row(f).cast<float>();
       if (n.isZero()) continue;
       // random direction in hemisphere around n (avoid too grazing angle)
-      Vector3f d;
+      Eigen::Vector3f d;
       while (true) {
         d = random_dir().cast<float>();
         float ndotd = n.dot(d);
@@ -146,28 +144,28 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
       ray_ori .push_back(p);
       ray_dir .push_back(d);
 
-      if (is_verbose && ray_face.size() % (rays_total / 10) == 0) cout << ".";
+      if (is_verbose && ray_face.size() % (rays_total / 10) == 0) std::cout << ".";
     }
   }
-  if (is_verbose) cout << ray_face.size()  << " rays. ";
+  if (is_verbose) std::cout << ray_face.size()  << " rays. ";
 
   // per component voting: first=front, second=back
-  vector<pair<float, float>> C_vote_distance(num_cc, make_pair(0, 0));      // sum of distance between ray origin and intersection
-  vector<pair<int  , int  >> C_vote_infinity(num_cc, make_pair(0, 0));      // number of rays reaching infinity
-  vector<pair<int  , int  >> C_vote_parity(num_cc, make_pair(0, 0));        // sum of parity count for each ray
+  std::vector<std::pair<float, float>> C_vote_distance(num_cc, std::make_pair(0, 0));      // sum of distance between ray origin and intersection
+  std::vector<std::pair<int  , int  >> C_vote_infinity(num_cc, std::make_pair(0, 0));      // number of rays reaching infinity
+  std::vector<std::pair<int  , int  >> C_vote_parity(num_cc, std::make_pair(0, 0));        // sum of parity count for each ray
 
-  if (is_verbose) cout << "shooting rays... ";
+  if (is_verbose) std::cout << "shooting rays... ";
 // #pragma omp parallel for
   for (int i = 0; i < (int)ray_face.size(); ++i)
   {
     int      f = ray_face[i];
-    Vector3f o = ray_ori [i];
-    Vector3f d = ray_dir [i];
+    Eigen::Vector3f o = ray_ori [i];
+    Eigen::Vector3f d = ray_dir [i];
     int c = C(f);
 
     // shoot ray toward front & back
-    vector<Hit<float>> hits_front;
-    vector<Hit<float>> hits_back;
+    std::vector<Hit<float>> hits_front;
+    std::vector<Hit<float>> hits_back;
     int num_rays_front;
     int num_rays_back;
     ei.intersectRay(o,  d, hits_front, num_rays_front);
@@ -218,7 +216,7 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
     if (Fi.row(f) != FF.row(f))
       I(f) = 1 - I(f);
   }
-  if (is_verbose) cout << "done!" << endl;
+  if (is_verbose) std::cout << "done!" << std::endl;
 }
 
 template <

+ 0 - 1
include/igl/embree/shape_diameter_function.cpp

@@ -56,7 +56,6 @@ IGL_INLINE void igl::embree::shape_diameter_function(
   const int num_samples,
   Eigen::PlainObjectBase<DerivedS> & S)
 {
-  using namespace Eigen;
   EmbreeIntersector ei;
   ei.init(V.template cast<float>(),F.template cast<int>());
   shape_diameter_function(ei,P,N,num_samples,S);

+ 0 - 2
include/igl/embree/unproject_in_mesh.cpp

@@ -21,8 +21,6 @@ IGL_INLINE int igl::embree::unproject_in_mesh(
   Eigen::PlainObjectBase<Derivedobj> & obj,
   std::vector<igl::Hit<float> > & hits)
 {
-  using namespace std;
-  using namespace Eigen;
   const auto & shoot_ray = [&ei](
     const Eigen::Vector3f& s,
     const Eigen::Vector3f& dir,

+ 0 - 2
include/igl/embree/unproject_onto_mesh.cpp

@@ -19,8 +19,6 @@ IGL_INLINE bool igl::embree::unproject_onto_mesh(
   int& fid,
   Eigen::Vector3f& bc)
 {
-  using namespace std;
-  using namespace Eigen;
   const auto & shoot_ray = [&ei](
     const Eigen::Vector3f& s,
     const Eigen::Vector3f& dir,

+ 1 - 2
include/igl/example_fun.cpp

@@ -11,8 +11,7 @@
 template <typename Printable>
 IGL_INLINE bool igl::example_fun(const Printable & input)
 {
-  using namespace std;
-  cout<<"example_fun: "<<input<<endl;
+  std::cout<<"example_fun: "<<input<<std::endl;
   return true;
 }
 

+ 3 - 5
include/igl/exterior_edges.cpp

@@ -47,22 +47,20 @@ IGL_INLINE void igl::exterior_edges(
   const Eigen::MatrixBase<DerivedF> & F,
   Eigen::PlainObjectBase<DerivedE> & E)
 {
-  using namespace Eigen;
-  using namespace std;
   using Index = typename DerivedF::Scalar;
   using VectorXI = Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,1>;
   using MatrixXI = Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,Eigen::Dynamic>;
   assert(F.cols() == 3);
   const Index m = F.rows();
-  MatrixXI all_E,sall_E,sort_order;
+  Eigen::MatrixXi all_E,sall_E,sort_order;
   // Sort each edge by index
   oriented_facets(F,all_E);
   sort(all_E,2,true,sall_E,sort_order);
   // Find unique edges
   PlainMatrix<DerivedF,Eigen::Dynamic> uE;
-  VectorXI IA,EMAP;
+  Eigen::VectorXi IA,EMAP;
   unique_rows(sall_E,uE,IA,EMAP);
-  VectorXI counts = VectorXI::Zero(uE.rows());
+  Eigen::VectorXi counts = Eigen::VectorXi::Zero(uE.rows());
   for(Index a = 0;a<3*m;a++)
   {
     counts(EMAP(a)) += (sort_order(a)==0?1:-1);

+ 2 - 3
include/igl/face_areas.cpp

@@ -36,13 +36,12 @@ IGL_INLINE void igl::face_areas(
   const typename DerivedL::Scalar doublearea_nan_replacement,
   Eigen::PlainObjectBase<DerivedA>& A)
 {
-  using namespace Eigen;
   assert(L.cols() == 6);
   const int m = L.rows();
   // (unsigned) face Areas (opposite vertices: 1 2 3 4)
-  Matrix<typename DerivedA::Scalar,Dynamic,1> 
+  Eigen::Matrix<typename DerivedA::Scalar ,Eigen::Dynamic,1>
     A0(m,1), A1(m,1), A2(m,1), A3(m,1);
-  Matrix<typename DerivedA::Scalar,Dynamic,3> 
+  Eigen::Matrix<typename DerivedA::Scalar ,Eigen::Dynamic,3>
     L0(m,3), L1(m,3), L2(m,3), L3(m,3);
   L0<<L.col(1),L.col(2),L.col(3);
   L1<<L.col(0),L.col(2),L.col(4);

+ 2 - 4
include/igl/face_occurrences.cpp

@@ -18,16 +18,14 @@ IGL_INLINE void igl::face_occurrences(
   const std::vector<std::vector<IntegerF> > & F,
   std::vector<IntegerC> & C)
 {
-  using namespace std;
-
   // Get a list of sorted faces
-  vector<vector<IntegerF> > sortedF = F;
+  std::vector<std::vector<IntegerF> > sortedF = F;
   for(int i = 0; i < (int)F.size();i++)
   {
     sort(sortedF[i].begin(),sortedF[i].end());
   }
   // Count how many times each sorted face occurs
-  map<vector<IntegerF>,int> counts;
+  std::map<std::vector<IntegerF>,int> counts;
   for(int i = 0; i < (int)sortedF.size();i++)
   {
     if(counts.find(sortedF[i]) == counts.end())

+ 3 - 5
include/igl/faces_first.cpp

@@ -20,9 +20,7 @@ IGL_INLINE void igl::faces_first(
 {
   assert(&V != &RV);
   assert(&F != &RF);
-  using namespace std;
-  using namespace Eigen;
-  vector<bool> in_face(V.rows());
+  std::vector<bool> in_face(V.rows());
   for(int i = 0; i<F.rows(); i++)
   {
     for(int j = 0; j<F.cols(); j++)
@@ -37,9 +35,9 @@ IGL_INLINE void igl::faces_first(
     num_in_F += (in_face[i]?1:0);
   }
   // list of unique vertices that occur in F
-  VectorXi U(num_in_F);
+  Eigen::VectorXi U(num_in_F);
   // list of unique vertices that do not occur in F
-  VectorXi NU(V.rows()-num_in_F);
+  Eigen::VectorXi NU(V.rows()-num_in_F);
   int Ui = 0;
   int NUi = 0;
   // loop over vertices

+ 3 - 3
include/igl/faces_first.h

@@ -16,9 +16,9 @@ namespace igl
   /// listed before internal vertices
   ///
   ///
-  /// @tparam MatV  matrix for vertex positions, e.g. MatrixXd
-  /// @tparam MatF  matrix for face indices, e.g. MatrixXi
-  /// @tparam VecI  vector for index map, e.g. VectorXi
+  /// @tparam MatV  matrix for vertex positions, e.g. Eigen::MatrixXd
+  /// @tparam MatF  matrix for face indices, e.g. Eigen::MatrixXi
+  /// @tparam VecI  vector for index map, e.g. Eigen::VectorXi
   /// @param[in] V  # vertices by 3 vertex positions
   /// @param[in] F  # faces by 3 list of face indices
   /// @param[out] RV  # vertices by 3 vertex positions, order such that if the jth vertex is

+ 2 - 3
include/igl/facet_adjacency_matrix.cpp

@@ -12,11 +12,10 @@ template <typename DerivedF, typename Atype>
 IGL_INLINE void igl::facet_adjacency_matrix(
   const Eigen::MatrixBase<DerivedF> & F, Eigen::SparseMatrix<Atype> & A)
 {
-  using namespace Eigen;
   typedef typename DerivedF::Scalar Index;
   const auto m = F.rows();
-  Eigen::Matrix<Index,Dynamic,1> EMAP,uEE,uEC;
-  Eigen::Matrix<Index,Dynamic,2> E,uE;
+  Eigen::Matrix<Index,Eigen::Dynamic,1> EMAP,uEE,uEC;
+  Eigen::Matrix<Index,Eigen::Dynamic,2> E,uE;
   igl::unique_edge_map(F,E,uE,EMAP,uEC,uEE);
   std::vector<Eigen::Triplet<Index> > AIJV;
   AIJV.reserve(2*uE.rows());

+ 3 - 4
include/igl/facet_components.cpp

@@ -35,13 +35,12 @@ IGL_INLINE void igl::facet_components(
   Eigen::PlainObjectBase<DerivedC> & C,
   Eigen::PlainObjectBase<Derivedcounts> & counts)
 {
-  using namespace std;
   typedef TTIndex Index;
   const Index m = TT.size();
   C.resize(m,1);
-  vector<bool> seen(m,false);
+  std::vector<bool> seen(m,false);
   Index id = 0;
-  vector<Index> vcounts;
+  std::vector<Index> vcounts;
   for(Index g = 0;g<m;g++)
   {
     if(seen[g])
@@ -49,7 +48,7 @@ IGL_INLINE void igl::facet_components(
       continue;
     }
     vcounts.push_back(0);
-    queue<Index> Q;
+    std::queue<Index> Q;
     Q.push(g);
     while(!Q.empty())
     {

+ 0 - 1
include/igl/false_barycentric_subdivision.cpp

@@ -18,7 +18,6 @@ IGL_INLINE void igl::false_barycentric_subdivision(
     Eigen::PlainObjectBase<DerivedVD> & VD,
     Eigen::PlainObjectBase<DerivedFD> & FD)
 {
-  using namespace Eigen;
   // Compute face barycenter
   PlainMatrix<DerivedV> BC;
   igl::barycenter(V,F,BC);

+ 1 - 1
include/igl/find_zero.cpp

@@ -38,7 +38,7 @@ IGL_INLINE void igl::find_zero(
       }
     }
   };
-  for_each(A,func);
+  igl::for_each(A,func);
 }
 
 #ifdef IGL_STATIC_LIBRARY

+ 0 - 2
include/igl/fit_rotations.cpp

@@ -20,7 +20,6 @@ IGL_INLINE void igl::fit_rotations(
   const bool single_precision,
   Eigen::PlainObjectBase<DerivedD> & R)
 {
-  using namespace std;
   const int dim = S.cols();
   const int nr = S.rows()/dim;
   assert(nr * dim == S.rows());
@@ -67,7 +66,6 @@ IGL_INLINE void igl::fit_rotations_planar(
   const Eigen::MatrixBase<DerivedS> & S,
         Eigen::PlainObjectBase<DerivedD> & R)
 { 
-  using namespace std;
   const int dim = S.cols();
   const int nr = S.rows()/dim;
   //assert(dim == 2 && "_planar input should be 2D");

+ 0 - 6
include/igl/flip_avoiding_line_search.cpp

@@ -24,7 +24,6 @@ namespace igl
     // http://math.ivanovo.ac.ru/dalgebra/Khashin/poly/index.html
     IGL_INLINE int SolveP3(std::vector<double>& x,double a,double b,double c)
     { // solve cubic equation x^3 + a*x^2 + b*x + c
-      using namespace std;
       double a2 = a*a;
         double q  = (a2 - 3*b)/9;
       double r  = (a*(2*a2-9*b) + 27*c)/54;
@@ -63,7 +62,6 @@ namespace igl
 
     IGL_INLINE double get_smallest_pos_quad_zero(double a,double b, double c)
     {
-      using namespace std;
       double t1, t2;
       if(std::abs(a) > 1.0e-10)
       {
@@ -114,7 +112,6 @@ namespace igl
                                           Eigen::MatrixXd& d,
                                           int f)
     {
-      using namespace std;
     /*
           Finding the smallest timestep t s.t a triangle get degenerated (<=> det = 0)
           The following code can be derived by a symbolic expression in matlab:
@@ -180,7 +177,6 @@ namespace igl
                                           Eigen::MatrixXd& direc,
                                           int f)
     {
-      using namespace std;
       /*
           Searching for the roots of:
             +-1/6 * |ax ay az 1|
@@ -275,7 +271,6 @@ namespace igl
                                                           const Eigen::MatrixXi& F,
                                                           Eigen::MatrixXd& d)
     {
-      using namespace std;
       double max_step = INFINITY;
 
       // The if statement is outside the for loops to avoid branching/ease parallelizing
@@ -307,7 +302,6 @@ IGL_INLINE double igl::flip_avoiding_line_search(
   std::function<double(Eigen::MatrixXd&)> & energy,
   double cur_energy)
 {
-  using namespace std;
   Eigen::MatrixXd d = dst_v - cur_v;
 
   double min_step_to_singularity = igl::flip_avoiding::compute_max_step_from_singularities(cur_v,F,d);

+ 1 - 3
include/igl/flood_fill.cpp

@@ -13,8 +13,6 @@ IGL_INLINE void igl::flood_fill(
   const Eigen::MatrixBase<Derivedres>& res,
   Eigen::PlainObjectBase<DerivedS> & S)
 {
-  using namespace Eigen;
-  using namespace std;
   typedef typename DerivedS::Scalar Scalar;
   const auto flood = [&res,&S] (
      const int xi,
@@ -51,7 +49,7 @@ IGL_INLINE void igl::flood_fill(
       }
     };
   int signed_zi = -1;
-  Scalar s = numeric_limits<Scalar>::quiet_NaN();
+  Scalar s = std::numeric_limits<Scalar>::quiet_NaN();
   for(int zi = 0;zi<res(2);zi++)
   {
     int signed_yi = -1;

+ 0 - 1
include/igl/floor.cpp

@@ -14,7 +14,6 @@ IGL_INLINE void igl::floor(
   const Eigen::DenseBase<DerivedX>& X,
   Eigen::PlainObjectBase<DerivedY>& Y)
 {
-  using namespace std;
   typedef typename DerivedX::Scalar Scalar;
   Y = X.unaryExpr([](const Scalar &x)->Scalar{return std::floor(x);}).template cast<typename DerivedY::Scalar >();
 }

+ 8 - 12
include/igl/forward_kinematics.cpp

@@ -20,17 +20,15 @@ IGL_INLINE void igl::forward_kinematics(
     Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & vQ,
   std::vector<Eigen::Vector3d> & vT)
 {
-  using namespace std;
-  using namespace Eigen;
-  const int m = BE.rows(); 
+  const int m = BE.rows();
   assert(m == P.rows());
   assert(m == (int)dQ.size());
   assert(m == (int)dT.size());
-  vector<bool> computed(m,false);
+  std::vector<bool> computed(m,false);
   vQ.resize(m);
   vT.resize(m);
   // Dynamic programming
-  function<void (int) > fk_helper = [&] (int b)
+  std::function<void (int) > fk_helper = [&] (int b)
   {
     if(!computed[b])
     {
@@ -38,7 +36,7 @@ IGL_INLINE void igl::forward_kinematics(
       {
         // base case for roots
         vQ[b] = dQ[b];
-        const Vector3d r = C.row(BE(b,0)).transpose();
+        const Eigen::Vector3d r = C.row(BE(b,0)).transpose();
         vT[b] = r-dQ[b]*r + dT[b];
       }else
       {
@@ -46,7 +44,7 @@ IGL_INLINE void igl::forward_kinematics(
         const int p = P(b);
         fk_helper(p);
         vQ[b] = vQ[p] * dQ[b];
-        const Vector3d r = C.row(BE(b,0)).transpose();
+        const Eigen::Vector3d r = C.row(BE(b,0)).transpose();
         vT[b] = vT[p] - vQ[b]*r + vQ[p]*(r + dT[b]);
       }
       computed[b] = true;
@@ -81,16 +79,14 @@ IGL_INLINE void igl::forward_kinematics(
   const std::vector<Eigen::Vector3d> & dT,
   Eigen::MatrixXd & T)
 {
-  using namespace Eigen;
-  using namespace std;
-  vector< Quaterniond,aligned_allocator<Quaterniond> > vQ;
-  vector< Vector3d> vT;
+  std::vector< Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > vQ;
+  std::vector< Eigen::Vector3d> vT;
   forward_kinematics(C,BE,P,dQ,dT,vQ,vT);
   const int dim = C.cols();
   T.resize(BE.rows()*(dim+1),dim);
   for(int e = 0;e<BE.rows();e++)
   {
-    Affine3d a = Affine3d::Identity();
+    Eigen::Affine3d a = Eigen::Affine3d::Identity();
     a.translate(vT[e]);
     a.rotate(vQ[e]);
     T.block(e*(dim+1),0,dim+1,dim) =

+ 23 - 32
include/igl/frame_field_deformer.cpp

@@ -159,7 +159,6 @@ IGL_INLINE void Frame_field_deformer::reset_opt()
 // precomputation of all components
 IGL_INLINE void Frame_field_deformer::precompute_opt()
 {
-  using namespace Eigen;
 	nfree = V.rows() - fixed;						    // free vertices (at the beginning ov m.V) - global
   nconst = V.rows()-nfree;						// #constrained vertices
   igl::vertex_triangle_adjacency(V,F,VT,VTi);                // compute vertex to face relationship
@@ -168,10 +167,10 @@ IGL_INLINE void Frame_field_deformer::precompute_opt()
 
   igl::cotmatrix(V,F,L);
 
-	SparseMatrix<double> MA;						// internal matrix for ARAP-warping energy
-	MatrixXd LfcVc;										  // RHS (partial) for ARAP-warping energy
-	SparseMatrix<double> MS;						// internal matrix for smoothing energy
-	MatrixXd bS;										    // RHS (full) for smoothing energy
+	Eigen::SparseMatrix<double> MA;						// internal matrix for ARAP-warping energy
+	Eigen::MatrixXd LfcVc;										  // RHS (partial) for ARAP-warping energy
+	Eigen::SparseMatrix<double> MS;						// internal matrix for smoothing energy
+	Eigen::MatrixXd bS;										    // RHS (full) for smoothing energy
 
 	precompute_ARAP(MA,LfcVc);					// precompute terms for the ARAP-warp part
 	precompute_SMOOTH(MS,bS);						// precompute terms for the smoothing part
@@ -190,32 +189,30 @@ IGL_INLINE void Frame_field_deformer::precompute_opt()
 
 IGL_INLINE void Frame_field_deformer::precompute_ARAP(Eigen::SparseMatrix<double> & Lff, Eigen::MatrixXd & LfcVc)
 {
-  using namespace Eigen;
 	fprintf(stdout,"Precomputing ARAP terms\n");
-	SparseMatrix<double> LL = -4*L;
-	Lff = SparseMatrix<double>(nfree,nfree);
+	Eigen::SparseMatrix<double> LL = -4*L;
+	Lff = Eigen::SparseMatrix<double>(nfree,nfree);
   extractBlock(LL,0,0,nfree,nfree,Lff);
-	SparseMatrix<double> Lfc = SparseMatrix<double>(nfree,nconst);
+	Eigen::SparseMatrix<double> Lfc = Eigen::SparseMatrix<double>(nfree,nconst);
   extractBlock(LL,0,nfree,nfree,nconst,Lfc);
 	LfcVc = - Lfc * V_w.block(nfree,0,nconst,3);
 }
 
 IGL_INLINE void Frame_field_deformer::precompute_SMOOTH(Eigen::SparseMatrix<double> & MS, Eigen::MatrixXd & bS)
 {
-  using namespace Eigen;
 	fprintf(stdout,"Precomputing SMOOTH terms\n");
 
-	SparseMatrix<double> LL = 4*L*L;
+	Eigen::SparseMatrix<double> LL = 4*L*L;
 
   // top-left
-	MS = SparseMatrix<double>(nfree,nfree);
+	MS = Eigen::SparseMatrix<double>(nfree,nfree);
   extractBlock(LL,0,0,nfree,nfree,MS);
 
   // top-right
-	SparseMatrix<double> Mfc = SparseMatrix<double>(nfree,nconst);
+	Eigen::SparseMatrix<double> Mfc = Eigen::SparseMatrix<double>(nfree,nconst);
   extractBlock(LL,0,nfree,nfree,nconst,Mfc);
 
-	MatrixXd MfcVc = Mfc * V_w.block(nfree,0,nconst,3);
+	Eigen::MatrixXd MfcVc = Mfc * V_w.block(nfree,0,nconst,3);
 	bS = (LL*V).block(0,0,nfree,3)-MfcVc;
 
 }
@@ -234,8 +231,7 @@ IGL_INLINE void Frame_field_deformer::precompute_SMOOTH(Eigen::SparseMatrix<doub
 
 IGL_INLINE void Frame_field_deformer::compute_optimal_rotations()
 {
-  using namespace Eigen;
-  Matrix<double,3,3> r,S,P,PP,D;
+  Eigen::Matrix<double,3,3> r,S,P,PP,D;
 
   for (int i=0;i<F.rows();i++)
 	{
@@ -257,9 +253,9 @@ IGL_INLINE void Frame_field_deformer::compute_optimal_rotations()
     0,      0,      C(i,1);
 
 		S = PP*D*P.transpose();
-		Eigen::JacobiSVD<Matrix<double,3,3> > svd(S, Eigen::ComputeFullU | Eigen::ComputeFullV );
-		Matrix<double,3,3>  su = svd.matrixU();
-		Matrix<double,3,3>  sv = svd.matrixV();
+		Eigen::JacobiSVD<Eigen::Matrix<double,3,3> > svd(S, Eigen::ComputeFullU | Eigen::ComputeFullV );
+		Eigen::Matrix<double,3,3>  su = svd.matrixU();
+		Eigen::Matrix<double,3,3>  sv = svd.matrixV();
 		r = su*sv.transpose();
 
 		if (r.determinant()<0)  // correct reflections
@@ -273,10 +269,9 @@ IGL_INLINE void Frame_field_deformer::compute_optimal_rotations()
 
 IGL_INLINE void Frame_field_deformer::compute_optimal_positions()
 {
-  using namespace Eigen;
 	// compute variable RHS of ARAP-warp part of the system
-  MatrixXd b(nfree,3);          // fx3 known term of the system
-	MatrixXd X;										// result
+  Eigen::MatrixXd b(nfree,3);          // fx3 known term of the system
+	Eigen::MatrixXd X;										// result
   int t;		  									// triangles incident to edge (i,j)
 	int vi,i1,i2;									// index of vertex i wrt tri t0
 
@@ -312,8 +307,7 @@ IGL_INLINE void Frame_field_deformer::compute_optimal_positions()
 
   IGL_INLINE void Frame_field_deformer::computeXField(std::vector< Eigen::Matrix<double,3,2> > & XF)
 {
-  using namespace Eigen;
-  Matrix<double,3,3> P,PP,DG;
+  Eigen::Matrix<double,3,3> P,PP,DG;
 	XF.resize(F.rows());
 
   for (int i=0;i<F.rows();i++)
@@ -341,27 +335,25 @@ IGL_INLINE void Frame_field_deformer::compute_optimal_positions()
 // computes in WW the ideal warp at each tri to make the frame field a cross
   IGL_INLINE void Frame_field_deformer::compute_idealWarp(std::vector< Eigen::Matrix<double,3,3> > & WW)
 {
-  using namespace Eigen;
-
   WW.resize(F.rows());
 	for (int i=0;i<(int)FF.size();i++)
 	{
-		Vector3d v0,v1,v2;
+		Eigen::Vector3d v0,v1,v2;
 		v0 = FF[i].col(0);
 		v1 = FF[i].col(1);
 		v2=v0.cross(v1); v2.normalize();			// normal
 
-		Matrix3d A,AI;								// compute affine map A that brings:
+		Eigen::Matrix3d A,AI;								// compute affine map A that brings:
 		A <<    v0[0], v1[0], v2[0],				//	first vector of FF to x unary vector
     v0[1], v1[1], v2[1],				//	second vector of FF to xy plane
     v0[2], v1[2], v2[2];				//	triangle normal to z unary vector
 		AI = A.inverse();
 
 		// polar decomposition to discard rotational component (unnecessary but makes it easier)
-		Eigen::JacobiSVD<Matrix<double,3,3> > svd(AI, Eigen::ComputeFullU | Eigen::ComputeFullV );
+		Eigen::JacobiSVD<Eigen::Matrix<double,3,3> > svd(AI, Eigen::ComputeFullU | Eigen::ComputeFullV );
 		//Matrix<double,3,3>  au = svd.matrixU();
-		Matrix<double,3,3>  av = svd.matrixV();
-		DiagonalMatrix<double,3>	as(svd.singularValues());
+		Eigen::Matrix<double,3,3>  av = svd.matrixV();
+		Eigen::DiagonalMatrix<double,3>	as(svd.singularValues());
 		WW[i] = av*as*av.transpose();
 	}
 }
@@ -381,7 +373,6 @@ IGL_INLINE void igl::frame_field_deformer(
   const double           lambda,
   const bool             perturb_initial_guess)
 {
-  using namespace Eigen;
   // Solvers
   Frame_field_deformer deformer;
 

Some files were not shown because too many files changed in this diff