Browse Source

act on matrices

Former-commit-id: 3d97b96d2f672e0491d894b84877baba07667705
Alec Jacobson 9 years ago
parent
commit
a7b1c49dc5
1 changed files with 5 additions and 1 deletions
  1. 5 1
      include/igl/parula.cpp

+ 5 - 1
include/igl/parula.cpp

@@ -53,14 +53,18 @@ IGL_INLINE void igl::parula(
   Eigen::PlainObjectBase<DerivedC> & C)
   Eigen::PlainObjectBase<DerivedC> & C)
 {
 {
   C.resize(Z.rows(),3);
   C.resize(Z.rows(),3);
+  double denom = (max_z-min_z);
+  denom = denom==0?1:denom;
   for(int r = 0;r<Z.rows();r++)
   for(int r = 0;r<Z.rows();r++)
   {
   {
-    parula((-min_z+Z(r,0))/(max_z-min_z),C(r,0),C(r,1),C(r,2));
+    parula((-min_z+Z(r,0))/denom,C(r,0),C(r,1),C(r,2));
   }
   }
 }
 }
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
+// generated by autoexplicit.sh
+template void igl::parula<Eigen::Array<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Array<int, -1, 1, 0, -1, 1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::parula<double>(double, double*);
 template void igl::parula<double>(double, double*);
 template void igl::parula<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::parula<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif
 #endif