Selaa lähdekoodia

Merge pull request #659 from jdumas/master

Compatibility with Eigen 3.3

Former-commit-id: 8a6e45fa818e2f94c41feaa5edd819b15570f79a
Daniele Panozzo 7 vuotta sitten
vanhempi
commit
153db726b8
3 muutettua tiedostoa jossa 62 lisäystä ja 62 poistoa
  1. 48 48
      include/igl/AABB.cpp
  2. 6 6
      include/igl/hessian.cpp
  3. 8 8
      include/igl/hessian_energy.cpp

+ 48 - 48
include/igl/AABB.cpp

@@ -27,7 +27,7 @@ template <typename DerivedV, int DIM>
 template <typename DerivedEle, typename Derivedbb_mins, typename Derivedbb_maxs, typename Derivedelements>
 template <typename DerivedEle, typename Derivedbb_mins, typename Derivedbb_maxs, typename Derivedelements>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
 IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
     const Eigen::MatrixBase<DerivedV> & V,
     const Eigen::MatrixBase<DerivedV> & V,
-    const Eigen::MatrixBase<DerivedEle> & Ele, 
+    const Eigen::MatrixBase<DerivedEle> & Ele,
     const Eigen::MatrixBase<Derivedbb_mins> & bb_mins,
     const Eigen::MatrixBase<Derivedbb_mins> & bb_mins,
     const Eigen::MatrixBase<Derivedbb_maxs> & bb_maxs,
     const Eigen::MatrixBase<Derivedbb_maxs> & bb_maxs,
     const Eigen::MatrixBase<Derivedelements> & elements,
     const Eigen::MatrixBase<Derivedelements> & elements,
@@ -106,7 +106,7 @@ template <
   typename DerivedI>
   typename DerivedI>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
 IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
     const Eigen::MatrixBase<DerivedV> & V,
     const Eigen::MatrixBase<DerivedV> & V,
-    const Eigen::MatrixBase<DerivedEle> & Ele, 
+    const Eigen::MatrixBase<DerivedEle> & Ele,
     const Eigen::MatrixBase<DerivedSI> & SI,
     const Eigen::MatrixBase<DerivedSI> & SI,
     const Eigen::MatrixBase<DerivedI> & I)
     const Eigen::MatrixBase<DerivedI> & I)
 {
 {
@@ -204,15 +204,15 @@ template <typename DerivedV, int DIM>
 template <typename DerivedEle, typename Derivedq>
 template <typename DerivedEle, typename Derivedq>
 IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
 IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
     const Eigen::MatrixBase<DerivedV> & V,
     const Eigen::MatrixBase<DerivedV> & V,
-    const Eigen::MatrixBase<DerivedEle> & Ele, 
+    const Eigen::MatrixBase<DerivedEle> & Ele,
     const Eigen::MatrixBase<Derivedq> & q,
     const Eigen::MatrixBase<Derivedq> & q,
     const bool first) const
     const bool first) const
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
-  assert(q.size() == DIM && 
+  assert(q.size() == DIM &&
       "Query dimension should match aabb dimension");
       "Query dimension should match aabb dimension");
-  assert(Ele.cols() == V.cols()+1 && 
+  assert(Ele.cols() == V.cols()+1 &&
       "AABB::find only makes sense for (d+1)-simplices");
       "AABB::find only makes sense for (d+1)-simplices");
   const Scalar epsilon = igl::EPS<Scalar>();
   const Scalar epsilon = igl::EPS<Scalar>();
   // Check if outside bounding box
   // Check if outside bounding box
@@ -250,7 +250,7 @@ IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
           const Vector2S V2 = V.row(Ele(m_primitive,1));
           const Vector2S V2 = V.row(Ele(m_primitive,1));
           const Vector2S V3 = V.row(Ele(m_primitive,2));
           const Vector2S V3 = V.row(Ele(m_primitive,2));
           // Hack for now to keep templates simple. If becomes bottleneck
           // Hack for now to keep templates simple. If becomes bottleneck
-          // consider using std::enable_if_t 
+          // consider using std::enable_if_t
           const Vector2S q2 = q.head(2);
           const Vector2S q2 = q.head(2);
           a1 = doublearea_single(V1,V2,q2);
           a1 = doublearea_single(V1,V2,q2);
           a2 = doublearea_single(V2,V3,q2);
           a2 = doublearea_single(V2,V3,q2);
@@ -266,9 +266,9 @@ IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
     a3 /= sum;
     a3 /= sum;
     a4 /= sum;
     a4 /= sum;
     if(
     if(
-        a1>=-epsilon && 
-        a2>=-epsilon && 
-        a3>=-epsilon && 
+        a1>=-epsilon &&
+        a2>=-epsilon &&
+        a3>=-epsilon &&
         a4>=-epsilon)
         a4>=-epsilon)
     {
     {
       return std::vector<int>(1,m_primitive);
       return std::vector<int>(1,m_primitive);
@@ -345,10 +345,10 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::serialize(
 
 
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 template <typename DerivedEle>
-IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar 
+IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
 igl::AABB<DerivedV,DIM>::squared_distance(
 igl::AABB<DerivedV,DIM>::squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   const RowVectorDIMS & p,
   int & i,
   int & i,
   Eigen::PlainObjectBase<RowVectorDIMS> & c) const
   Eigen::PlainObjectBase<RowVectorDIMS> & c) const
@@ -359,10 +359,10 @@ igl::AABB<DerivedV,DIM>::squared_distance(
 
 
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 template <typename DerivedEle>
-IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar 
+IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
 igl::AABB<DerivedV,DIM>::squared_distance(
 igl::AABB<DerivedV,DIM>::squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   const RowVectorDIMS & p,
   Scalar low_sqr_d,
   Scalar low_sqr_d,
   Scalar up_sqr_d,
   Scalar up_sqr_d,
@@ -393,7 +393,7 @@ igl::AABB<DerivedV,DIM>::squared_distance(
     {
     {
       int i_left;
       int i_left;
       RowVectorDIMS c_left = c;
       RowVectorDIMS c_left = c;
-      Scalar sqr_d_left = 
+      Scalar sqr_d_left =
         m_left->squared_distance(V,Ele,p,low_sqr_d,sqr_d,i_left,c_left);
         m_left->squared_distance(V,Ele,p,low_sqr_d,sqr_d,i_left,c_left);
       this->set_min(p,sqr_d_left,i_left,c_left,sqr_d,i,c);
       this->set_min(p,sqr_d_left,i_left,c_left,sqr_d,i,c);
       looked_left = true;
       looked_left = true;
@@ -401,8 +401,8 @@ igl::AABB<DerivedV,DIM>::squared_distance(
     const auto & look_right = [&]()
     const auto & look_right = [&]()
     {
     {
       int i_right;
       int i_right;
-      Eigen::PlainObjectBase<RowVectorDIMS> c_right = c;
-      Scalar sqr_d_right = 
+      RowVectorDIMS c_right = c;
+      Scalar sqr_d_right =
         m_right->squared_distance(V,Ele,p,low_sqr_d,sqr_d,i_right,c_right);
         m_right->squared_distance(V,Ele,p,low_sqr_d,sqr_d,i_right,c_right);
       this->set_min(p,sqr_d_right,i_right,c_right,sqr_d,i,c);
       this->set_min(p,sqr_d_right,i_right,c_right,sqr_d,i,c);
       looked_right = true;
       looked_right = true;
@@ -418,9 +418,9 @@ igl::AABB<DerivedV,DIM>::squared_distance(
       look_right();
       look_right();
     }
     }
     // if haven't looked left and could be less than current min, then look
     // if haven't looked left and could be less than current min, then look
-    Scalar left_up_sqr_d = 
+    Scalar left_up_sqr_d =
       m_left->m_box.squaredExteriorDistance(p.transpose());
       m_left->m_box.squaredExteriorDistance(p.transpose());
-    Scalar right_up_sqr_d = 
+    Scalar right_up_sqr_d =
       m_right->m_box.squaredExteriorDistance(p.transpose());
       m_right->m_box.squaredExteriorDistance(p.transpose());
     if(left_up_sqr_d < right_up_sqr_d)
     if(left_up_sqr_d < right_up_sqr_d)
     {
     {
@@ -449,10 +449,10 @@ igl::AABB<DerivedV,DIM>::squared_distance(
 
 
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 template <typename DerivedEle>
-IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar 
+IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
 igl::AABB<DerivedV,DIM>::squared_distance(
 igl::AABB<DerivedV,DIM>::squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   const RowVectorDIMS & p,
   Scalar up_sqr_d,
   Scalar up_sqr_d,
   int & i,
   int & i,
@@ -464,13 +464,13 @@ igl::AABB<DerivedV,DIM>::squared_distance(
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
 template <
 template <
   typename DerivedEle,
   typename DerivedEle,
-  typename DerivedP, 
-  typename DerivedsqrD, 
-  typename DerivedI, 
+  typename DerivedP,
+  typename DerivedsqrD,
+  typename DerivedI,
   typename DerivedC>
   typename DerivedC>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
 IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const Eigen::MatrixBase<DerivedP> & P,
   const Eigen::MatrixBase<DerivedP> & P,
   Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
   Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
   Eigen::PlainObjectBase<DerivedI> & I,
   Eigen::PlainObjectBase<DerivedI> & I,
@@ -493,24 +493,24 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
 }
 }
 
 
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
-template < 
+template <
   typename DerivedEle,
   typename DerivedEle,
   typename Derivedother_V,
   typename Derivedother_V,
   typename Derivedother_Ele,
   typename Derivedother_Ele,
-  typename DerivedsqrD, 
-  typename DerivedI, 
+  typename DerivedsqrD,
+  typename DerivedI,
   typename DerivedC>
   typename DerivedC>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
 IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const AABB<Derivedother_V,DIM> & other,
   const AABB<Derivedother_V,DIM> & other,
   const Eigen::MatrixBase<Derivedother_V> & other_V,
   const Eigen::MatrixBase<Derivedother_V> & other_V,
-  const Eigen::MatrixBase<Derivedother_Ele> & other_Ele, 
+  const Eigen::MatrixBase<Derivedother_Ele> & other_Ele,
   Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
   Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
   Eigen::PlainObjectBase<DerivedI> & I,
   Eigen::PlainObjectBase<DerivedI> & I,
   Eigen::PlainObjectBase<DerivedC> & C) const
   Eigen::PlainObjectBase<DerivedC> & C) const
 {
 {
-  assert(other_Ele.cols() == 1 && 
+  assert(other_Ele.cols() == 1 &&
     "Only implemented for other as list of points");
     "Only implemented for other as list of points");
   assert(other_V.cols() == V.cols() && "other must match this dimension");
   assert(other_V.cols() == V.cols() && "other must match this dimension");
   sqrD.setConstant(other_Ele.rows(),1,std::numeric_limits<double>::infinity());
   sqrD.setConstant(other_Ele.rows(),1,std::numeric_limits<double>::infinity());
@@ -528,20 +528,20 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
 }
 }
 
 
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
-template < 
+template <
   typename DerivedEle,
   typename DerivedEle,
   typename Derivedother_V,
   typename Derivedother_V,
   typename Derivedother_Ele,
   typename Derivedother_Ele,
-  typename DerivedsqrD, 
-  typename DerivedI, 
+  typename DerivedsqrD,
+  typename DerivedI,
   typename DerivedC>
   typename DerivedC>
-IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar 
+IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
   igl::AABB<DerivedV,DIM>::squared_distance_helper(
   igl::AABB<DerivedV,DIM>::squared_distance_helper(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const AABB<Derivedother_V,DIM> * other,
   const AABB<Derivedother_V,DIM> * other,
   const Eigen::MatrixBase<Derivedother_V> & other_V,
   const Eigen::MatrixBase<Derivedother_V> & other_V,
-  const Eigen::MatrixBase<Derivedother_Ele> & other_Ele, 
+  const Eigen::MatrixBase<Derivedother_Ele> & other_Ele,
   const Scalar /*up_sqr_d*/,
   const Scalar /*up_sqr_d*/,
   Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
   Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
   Eigen::PlainObjectBase<DerivedI> & I,
   Eigen::PlainObjectBase<DerivedI> & I,
@@ -731,9 +731,9 @@ IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
       //assert(mc == mm);
       //assert(mc == mm);
       // Only look left/right in this_list if can possible decrease somebody's
       // Only look left/right in this_list if can possible decrease somebody's
       // distance in this_tree.
       // distance in this_tree.
-      const Scalar min_this_other = min_squared_distance(this_tree,other_tree); 
+      const Scalar min_this_other = min_squared_distance(this_tree,other_tree);
       if(
       if(
-          min_this_other < sqr_d && 
+          min_this_other < sqr_d &&
           min_this_other < other_tree->m_low_sqr_d)
           min_this_other < other_tree->m_low_sqr_d)
       {
       {
         //cout<<"before: "<<other_low_sqr_d(child)<<endl;
         //cout<<"before: "<<other_low_sqr_d(child)<<endl;
@@ -764,7 +764,7 @@ template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 template <typename DerivedEle>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
 IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   const RowVectorDIMS & p,
   const Scalar low_sqr_d,
   const Scalar low_sqr_d,
   Scalar & sqr_d,
   Scalar & sqr_d,
@@ -789,7 +789,7 @@ template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 template <typename DerivedEle>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
 IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   const RowVectorDIMS & p,
   Scalar & sqr_d,
   Scalar & sqr_d,
   int & i,
   int & i,
@@ -801,7 +801,7 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
 
 
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::set_min(
 IGL_INLINE void igl::AABB<DerivedV,DIM>::set_min(
-  const RowVectorDIMS & 
+  const RowVectorDIMS &
 #ifndef NDEBUG
 #ifndef NDEBUG
   p
   p
 #endif
 #endif
@@ -831,10 +831,10 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::set_min(
 
 
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 template <typename DerivedEle>
-IGL_INLINE bool 
+IGL_INLINE bool
 igl::AABB<DerivedV,DIM>::intersect_ray(
 igl::AABB<DerivedV,DIM>::intersect_ray(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & dir,
   const RowVectorDIMS & dir,
   std::vector<igl::Hit> & hits) const
   std::vector<igl::Hit> & hits) const
@@ -874,10 +874,10 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
 
 
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 template <typename DerivedEle>
-IGL_INLINE bool 
+IGL_INLINE bool
 igl::AABB<DerivedV,DIM>::intersect_ray(
 igl::AABB<DerivedV,DIM>::intersect_ray(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & dir,
   const RowVectorDIMS & dir,
   igl::Hit & hit) const
   igl::Hit & hit) const
@@ -932,10 +932,10 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
 
 
 template <typename DerivedV, int DIM>
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 template <typename DerivedEle>
-IGL_INLINE bool 
+IGL_INLINE bool
 igl::AABB<DerivedV,DIM>::intersect_ray(
 igl::AABB<DerivedV,DIM>::intersect_ray(
   const Eigen::MatrixBase<DerivedV> & V,
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & dir,
   const RowVectorDIMS & dir,
   const Scalar _min_t,
   const Scalar _min_t,
@@ -1001,7 +1001,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
 
 
 // This is a bullshit template because AABB annoyingly needs templates for bad
 // This is a bullshit template because AABB annoyingly needs templates for bad
 // combinations of 3D V with DIM=2 AABB
 // combinations of 3D V with DIM=2 AABB
-// 
+//
 // _Define_ as a no-op rather than monkeying around with the proper code above
 // _Define_ as a no-op rather than monkeying around with the proper code above
 //
 //
 // Meanwhile, GCC seems to have a bug. Let's see if GCC likes using explicit
 // Meanwhile, GCC seems to have a bug. Let's see if GCC likes using explicit

+ 6 - 6
include/igl/hessian.cpp

@@ -27,15 +27,15 @@ IGL_INLINE void igl::hessian(
     typedef typename Eigen::SparseMatrix<Scalar> SparseMat;
     typedef typename Eigen::SparseMatrix<Scalar> SparseMat;
     typedef typename Eigen::DiagonalMatrix
     typedef typename Eigen::DiagonalMatrix
                        <Scalar, Eigen::Dynamic, Eigen::Dynamic> DiagMat;
                        <Scalar, Eigen::Dynamic, Eigen::Dynamic> DiagMat;
-    
+
     int dim = V.cols();
     int dim = V.cols();
     assert((dim==2 || dim==3) &&
     assert((dim==2 || dim==3) &&
            "The dimension of the vertices should be 2 or 3");
            "The dimension of the vertices should be 2 or 3");
-    
+
     //Construct the combined gradient matric
     //Construct the combined gradient matric
     SparseMat G;
     SparseMat G;
-    igl::grad(Eigen::PlainObjectBase<DerivedV>(V),
-              Eigen::PlainObjectBase<DerivedF>(F),
+    igl::grad(DerivedV(V),
+              DerivedF(F),
               G, false);
               G, false);
     SparseMat GG(F.rows(), dim*V.rows());
     SparseMat GG(F.rows(), dim*V.rows());
     GG.reserve(G.nonZeros());
     GG.reserve(G.nonZeros());
@@ -43,12 +43,12 @@ IGL_INLINE void igl::hessian(
         GG.middleCols(i*G.cols(),G.cols()) = G.middleRows(i*F.rows(),F.rows());
         GG.middleCols(i*G.cols(),G.cols()) = G.middleRows(i*F.rows(),F.rows());
     SparseMat D;
     SparseMat D;
     igl::repdiag(GG,dim,D);
     igl::repdiag(GG,dim,D);
-    
+
     //Compute area matrix
     //Compute area matrix
     VecXd areas;
     VecXd areas;
     igl::doublearea(V, F, areas);
     igl::doublearea(V, F, areas);
     DiagMat A = (0.5*areas).replicate(dim,1).asDiagonal();
     DiagMat A = (0.5*areas).replicate(dim,1).asDiagonal();
-    
+
     //Compute FEM Hessian
     //Compute FEM Hessian
     H = D.transpose()*A*G;
     H = D.transpose()*A*G;
 }
 }

+ 8 - 8
include/igl/hessian_energy.cpp

@@ -25,35 +25,35 @@ IGL_INLINE void igl::hessian_energy(
     typedef typename Eigen::SparseMatrix<Scalar> SparseMat;
     typedef typename Eigen::SparseMatrix<Scalar> SparseMat;
     typedef typename Eigen::DiagonalMatrix
     typedef typename Eigen::DiagonalMatrix
                        <Scalar, Eigen::Dynamic, Eigen::Dynamic> DiagMat;
                        <Scalar, Eigen::Dynamic, Eigen::Dynamic> DiagMat;
-    
+
     int dim = V.cols();
     int dim = V.cols();
     assert((dim==2 || dim==3) &&
     assert((dim==2 || dim==3) &&
            "The dimension of the vertices should be 2 or 3");
            "The dimension of the vertices should be 2 or 3");
-    
+
     SparseMat M;
     SparseMat M;
     igl::massmatrix(V,F,igl::MASSMATRIX_TYPE_VORONOI,M);
     igl::massmatrix(V,F,igl::MASSMATRIX_TYPE_VORONOI,M);
-    
+
     //Kill non-interior DOFs
     //Kill non-interior DOFs
     VecXd Mint = M.diagonal();
     VecXd Mint = M.diagonal();
     std::vector<std::vector<int> > bdryLoop;
     std::vector<std::vector<int> > bdryLoop;
-    igl::boundary_loop(Eigen::PlainObjectBase<DerivedF>(F),bdryLoop);
+    igl::boundary_loop(DerivedF(F),bdryLoop);
     for(const std::vector<int>& loop : bdryLoop)
     for(const std::vector<int>& loop : bdryLoop)
         for(const int& bdryVert : loop)
         for(const int& bdryVert : loop)
             Mint(bdryVert) = 0.;
             Mint(bdryVert) = 0.;
-    
+
     //Invert Mint
     //Invert Mint
     for(int i=0; i<Mint.rows(); ++i)
     for(int i=0; i<Mint.rows(); ++i)
         if(Mint(i) > 0)
         if(Mint(i) > 0)
             Mint(i) = 1./Mint(i);
             Mint(i) = 1./Mint(i);
-    
+
     //Repeat Mint to form diaginal matrix
     //Repeat Mint to form diaginal matrix
     DiagMat stackedMinv = Mint.replicate(dim*dim,1).asDiagonal();
     DiagMat stackedMinv = Mint.replicate(dim*dim,1).asDiagonal();
-    
+
     //Compute squared Hessian
     //Compute squared Hessian
     SparseMat H;
     SparseMat H;
     igl::hessian(V,F,H);
     igl::hessian(V,F,H);
     Q = H.transpose()*stackedMinv*H;
     Q = H.transpose()*stackedMinv*H;
-    
+
 }
 }