Browse Source

Merge commit 'b65b01c3b07dd28d15941e1eec344372a55ce462 [formerly 4b69d4b6e99c15c6a9b8192f84b378fee1ca1d4a]'

Former-commit-id: 933b25850e57766d1446f7deb5debd5cc7e24006
Daniele Panozzo 10 years ago
parent
commit
b792f556bf

+ 1 - 1
include/igl/cgal/peel_outer_hull_layers.cpp

@@ -17,7 +17,6 @@
 #include "../STR.h"
 #endif
 
-using namespace std;
 template <
   typename DerivedV,
   typename DerivedF,
@@ -126,6 +125,7 @@ IGL_INLINE size_t igl::cgal::peel_outer_hull_layers(
   Eigen::PlainObjectBase<Derivedodd > & odd,
   Eigen::PlainObjectBase<Derivedflip > & flip)
 {
+  using namespace std;
   Eigen::Matrix<typename DerivedV::Scalar,DerivedF::RowsAtCompileTime,3> N;
   per_face_normals(V,F,N);
   return peel_outer_hull_layers(V,F,N,odd,flip);

+ 1 - 1
include/igl/comiso/miq.cpp.REMOVED.git-id

@@ -1 +1 @@
-16464c7ad8917249fdb40e5b2be12ab61090ce28
+c3a59cef8b0ed62e24fe734dabfdb3cacf17548b

+ 3 - 0
include/igl/remove_unreferenced.cpp

@@ -6,6 +6,8 @@
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "remove_unreferenced.h"
+#include "slice.h"
+#include <algorithm>
 
 template <
   typename DerivedV,
@@ -39,6 +41,7 @@ IGL_INLINE void igl::remove_unreferenced(
   Eigen::PlainObjectBase<DerivedI> &I,
   Eigen::PlainObjectBase<DerivedJ> &J)
 {
+  using namespace std;
   const size_t n = V.rows();
   remove_unreferenced(n,F,I,J);
   NF = F;

+ 13 - 29
include/igl/slice.cpp

@@ -11,12 +11,12 @@
 #include <vector>
 #include <unsupported/Eigen/SparseExtra>
 
-template <typename T>
+template <typename TX, typename TY>
 IGL_INLINE void igl::slice(
-  const Eigen::SparseMatrix<T>& X,
+  const Eigen::SparseMatrix<TX>& X,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & C,
-  Eigen::SparseMatrix<T>& Y)
+  Eigen::SparseMatrix<TY>& Y)
 {
 #if 1
   int xm = X.rows();
@@ -51,7 +51,7 @@ IGL_INLINE void igl::slice(
     CI[C(i)].push_back(i);
   }
   // Resize output
-  Eigen::DynamicSparseMatrix<T, Eigen::RowMajor> dyn_Y(ym,yn);
+  Eigen::DynamicSparseMatrix<TY, Eigen::RowMajor> dyn_Y(ym,yn);
   // Take a guess at the number of nonzeros (this assumes uniform distribution
   // not banded or heavily diagonal)
   dyn_Y.reserve((X.nonZeros()/(X.rows()*X.cols())) * (ym*yn));
@@ -59,7 +59,7 @@ IGL_INLINE void igl::slice(
   for(int k=0; k<X.outerSize(); ++k)
   {
     // Iterate over inside
-    for(typename Eigen::SparseMatrix<T>::InnerIterator it (X,k); it; ++it)
+    for(typename Eigen::SparseMatrix<TX>::InnerIterator it (X,k); it; ++it)
     {
       std::vector<int>::iterator rit, cit;
       for(rit = RI[it.row()].begin();rit != RI[it.row()].end(); rit++)
@@ -71,7 +71,7 @@ IGL_INLINE void igl::slice(
       }
     }
   }
-  Y = Eigen::SparseMatrix<T>(dyn_Y);
+  Y = Eigen::SparseMatrix<TY>(dyn_Y);
 #else
 
   // Alec: This is _not_ valid for arbitrary R,C since they don't necessary
@@ -134,12 +134,12 @@ IGL_INLINE void igl::slice(
 #endif
 }
 
-template <typename Mat>
+template <typename MatX, typename MatY>
 IGL_INLINE void igl::slice(
-  const Mat& X,
+  const MatX& X,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
   const int dim,
-  Mat& Y)
+  MatY& Y)
 {
   Eigen::VectorXi C;
   switch(dim)
@@ -168,12 +168,12 @@ IGL_INLINE void igl::slice(
   }
 }
 
-template <typename DerivedX>
+template <typename DerivedX, typename DerivedY>
 IGL_INLINE void igl::slice(
   const Eigen::PlainObjectBase<DerivedX> & X,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & C,
-  Eigen::PlainObjectBase<DerivedX> & Y)
+  Eigen::PlainObjectBase<DerivedY> & Y)
 {
 #ifndef NDEBUG
   int xm = X.rows();
@@ -207,11 +207,11 @@ IGL_INLINE void igl::slice(
 }
 
 
-template <typename DerivedX>
+template <typename DerivedX, typename DerivedY>
 IGL_INLINE void igl::slice(
   const Eigen::PlainObjectBase<DerivedX> & X,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
-  Eigen::PlainObjectBase<DerivedX> & Y)
+  Eigen::PlainObjectBase<DerivedY> & Y)
 {
   // phony column indices
   Eigen::Matrix<int,Eigen::Dynamic,1> C;
@@ -243,24 +243,8 @@ IGL_INLINE Eigen::PlainObjectBase<DerivedX> igl::slice(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-// generated by autoexplicit.sh
-template void igl::slice<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-// generated by autoexplicit.sh
-template void igl::slice<Eigen::Matrix<float, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1> >&);
-// generated by autoexplicit.sh
-template void igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-// generated by autoexplicit.sh
-template void igl::slice<Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);
-// generated by autoexplicit.sh
-template void igl::slice<double>(Eigen::SparseMatrix<double, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<double, 0, int>&);
-template void igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template void igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
-template void igl::slice<Eigen::SparseMatrix<double, 0, int> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::SparseMatrix<double, 0, int>&);
 template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
 template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
-template void igl::slice<std::complex<double> >(Eigen::SparseMatrix<std::complex<double>, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<std::complex<double>, 0, int>&);
-template void igl::slice<Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::Matrix<double, -1, 3, 0, -1, 3> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::Matrix<double, -1, 3, 0, -1, 3>&);
 template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&);
 template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > igl::slice<Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
 template Eigen::PlainObjectBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> > igl::slice<Eigen::Matrix<double, 1, -1, 1, 1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);

+ 10 - 10
include/igl/slice.h

@@ -23,36 +23,36 @@ namespace igl
   //   Y  #R by #C matrix
   //
   // See also: slice_mask
-  template <typename T>
+  template <typename TX, typename TY>
   IGL_INLINE void slice(
-    const Eigen::SparseMatrix<T>& X,
+    const Eigen::SparseMatrix<TX>& X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & C,
-    Eigen::SparseMatrix<T>& Y);
+    Eigen::SparseMatrix<TY>& Y);
   // Wrapper to only slice in one direction
   //
   // Inputs:
   //   dim  dimension to slice in 1 or 2, dim=1 --> X(R,:), dim=2 --> X(:,R)
   //
   // Note: For now this is just a cheap wrapper.
-  template <typename Mat>
+  template <typename MatX, typename MatY>
   IGL_INLINE void slice(
-    const Mat& X,
+    const MatX& X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const int dim,
-    Mat& Y);
-  template <typename DerivedX>
+    MatY& Y);
+  template <typename DerivedX, typename DerivedY>
   IGL_INLINE void slice(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & C,
-    Eigen::PlainObjectBase<DerivedX> & Y);
+    Eigen::PlainObjectBase<DerivedY> & Y);
 
-  template <typename DerivedX>
+  template <typename DerivedX, typename DerivedY>
   IGL_INLINE void slice(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
-    Eigen::PlainObjectBase<DerivedX> & Y);
+    Eigen::PlainObjectBase<DerivedY> & Y);
   // VectorXi Y = slice(X,R);
   template <typename DerivedX>
   IGL_INLINE Eigen::PlainObjectBase<DerivedX> slice(

+ 5 - 1
include/igl/viewer/TextRenderer.cpp

@@ -17,12 +17,12 @@
 #define NANOVG_GL3
 #include <nanovg_gl.h>
 
-using namespace std;
 
   IGL_INLINE igl::viewer::TextRenderer::TextRenderer(): ctx(nullptr) {}
 
   IGL_INLINE int igl::viewer::TextRenderer::Init()
   {
+    using namespace std;
     #ifdef NDEBUG
       ctx = nvgCreateGL3(NVG_STENCIL_STROKES | NVG_ANTIALIAS);
     #else
@@ -37,6 +37,7 @@ using namespace std;
 
   IGL_INLINE int igl::viewer::TextRenderer::Shut()
   {
+    using namespace std;
     if(ctx)
       nvgDeleteGL3(ctx);
     return 0;
@@ -45,6 +46,7 @@ using namespace std;
   IGL_INLINE void igl::viewer::TextRenderer::BeginDraw(const Eigen::Matrix4f &view, const Eigen::Matrix4f &proj,
     const Eigen::Vector4f &_viewport, float _object_scale)
   {
+    using namespace std;
     viewport = _viewport;
     proj_matrix = proj;
     view_matrix = view;
@@ -67,11 +69,13 @@ using namespace std;
 
   IGL_INLINE void igl::viewer::TextRenderer::EndDraw()
   {
+    using namespace std;
     nvgEndFrame(ctx);
   }
 
   IGL_INLINE void igl::viewer::TextRenderer::DrawText(Eigen::Vector3d pos, Eigen::Vector3d normal, const std::string &text)
   {
+    using namespace std;
     pos += normal * 0.005f * object_scale;
     Eigen::Vector3f coord = igl::project(Eigen::Vector3f(pos(0), pos(1), pos(2)),
         view_matrix, proj_matrix, viewport);