Browse Source

fixed isolines and added missing windows template

Teseo Schneider 6 years ago
parent
commit
ce432e4f11
2 changed files with 11 additions and 10 deletions
  1. 10 10
      include/igl/isolines.cpp
  2. 1 0
      include/igl/point_mesh_squared_distance.cpp

+ 10 - 10
include/igl/isolines.cpp

@@ -38,21 +38,21 @@ IGL_INLINE void igl::isolines(
     const int nFaces = F.rows();
     const int nFaces = F.rows();
     const int np1 = n+1;
     const int np1 = n+1;
     const double min = z.minCoeff(), max = z.maxCoeff();
     const double min = z.minCoeff(), max = z.maxCoeff();
-    
-    
+
+
     //Following http://www.alecjacobson.com/weblog/?p=2529
     //Following http://www.alecjacobson.com/weblog/?p=2529
     typedef typename DerivedZ::Scalar Scalar;
     typedef typename DerivedZ::Scalar Scalar;
     typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> Vec;
     typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> Vec;
     Vec iso(np1);
     Vec iso(np1);
     for(int i=0; i<np1; ++i)
     for(int i=0; i<np1; ++i)
         iso(i) = Scalar(i)/Scalar(n)*(max-min) + min;
         iso(i) = Scalar(i)/Scalar(n)*(max-min) + min;
-    
+
     typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> Matrix;
     typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> Matrix;
     std::array<Matrix,3> t{{Matrix(nFaces, np1),
     std::array<Matrix,3> t{{Matrix(nFaces, np1),
         Matrix(nFaces, np1), Matrix(nFaces, np1)}};
         Matrix(nFaces, np1), Matrix(nFaces, np1)}};
     for(int i=0; i<nFaces; ++i) {
     for(int i=0; i<nFaces; ++i) {
         for(int k=0; k<3; ++k) {
         for(int k=0; k<3; ++k) {
-            const Scalar z1=z(F(i,k)), z2=z(F(i,(k+1)%3));
+            const Scalar z1=z(F(i,k), 0), z2=z(F(i,(k+1)%3), 0);
             for(int j=0; j<np1; ++j) {
             for(int j=0; j<np1; ++j) {
                 t[k](i,j) = (iso(j)-z1) / (z2-z1);
                 t[k](i,j) = (iso(j)-z1) / (z2-z1);
                 if(t[k](i,j)<0 || t[k](i,j)>1)
                 if(t[k](i,j)<0 || t[k](i,j)>1)
@@ -60,7 +60,7 @@ IGL_INLINE void igl::isolines(
             }
             }
         }
         }
     }
     }
-    
+
     std::array<std::vector<int>,3> Fij, Iij;
     std::array<std::vector<int>,3> Fij, Iij;
     for(int i=0; i<nFaces; ++i) {
     for(int i=0; i<nFaces; ++i) {
         for(int j=0; j<np1; ++j) {
         for(int j=0; j<np1; ++j) {
@@ -73,7 +73,7 @@ IGL_INLINE void igl::isolines(
             }
             }
         }
         }
     }
     }
-    
+
     const int K = Fij[0].size()+Fij[1].size()+Fij[2].size();
     const int K = Fij[0].size()+Fij[1].size()+Fij[2].size();
     isoV.resize(2*K, dim);
     isoV.resize(2*K, dim);
     int b = 0;
     int b = 0;
@@ -89,12 +89,12 @@ IGL_INLINE void igl::isolines(
         }
         }
         b += Fij[k].size();
         b += Fij[k].size();
     }
     }
-    
+
     isoE.resize(K,2);
     isoE.resize(K,2);
     for(int i=0; i<K; ++i)
     for(int i=0; i<K; ++i)
         isoE.row(i) << i, K+i;
         isoE.row(i) << i, K+i;
-    
-    
+
+
     //Remove double entries
     //Remove double entries
     typedef typename DerivedIsoV::Scalar LScalar;
     typedef typename DerivedIsoV::Scalar LScalar;
     typedef typename DerivedIsoE::Scalar LInt;
     typedef typename DerivedIsoE::Scalar LInt;
@@ -104,7 +104,7 @@ IGL_INLINE void igl::isolines(
     LIVec dummy1, dummy2;
     LIVec dummy1, dummy2;
     igl::remove_duplicate_vertices(LMat(isoV), LIMat(isoE),
     igl::remove_duplicate_vertices(LMat(isoV), LIMat(isoE),
                                    2.2204e-15, isoV, dummy1, dummy2, isoE);
                                    2.2204e-15, isoV, dummy1, dummy2, isoE);
-    
+
 }
 }
 
 
 
 

+ 1 - 0
include/igl/point_mesh_squared_distance.cpp

@@ -57,5 +57,6 @@ template void igl::point_mesh_squared_distance<Eigen::Matrix<double, -1, -1, 0,
 
 
 #ifdef WIN32
 #ifdef WIN32
 template void igl::point_mesh_squared_distance<class Eigen::Matrix<double, -1, -1, 0, -1, -1>, class Eigen::Matrix<double, -1, -1, 0, -1, -1>, class Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<double, -1, 3, 0, -1, 3>>(class Eigen::MatrixBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::MatrixBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, 3, 0, -1, 3>> &);
 template void igl::point_mesh_squared_distance<class Eigen::Matrix<double, -1, -1, 0, -1, -1>, class Eigen::Matrix<double, -1, -1, 0, -1, -1>, class Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<double, -1, 3, 0, -1, 3>>(class Eigen::MatrixBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::MatrixBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, 3, 0, -1, 3>> &);
+template void igl::point_mesh_squared_distance<class Eigen::Matrix<double, -1, -1, 0, -1, -1>, class Eigen::Matrix<double, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<double, -1, 1, 0, -1, 1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<double, -1, 3, 0, -1, 3>>(class Eigen::MatrixBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::MatrixBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, 3, 0, -1, 3>> &);
 #endif
 #endif
 #endif
 #endif