Jelajahi Sumber

Compatibility with Eigen 3.3

Former-commit-id: 0f53371e285083ba8af15237a302b8f2c6f68ac3
Jérémie Dumas 7 tahun lalu
induk
melakukan
fab12b747a
1 mengubah file dengan 48 tambahan dan 48 penghapusan
  1. 48 48
      include/igl/AABB.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>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
     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_maxs> & bb_maxs,
     const Eigen::MatrixBase<Derivedelements> & elements,
@@ -106,7 +106,7 @@ template <
   typename DerivedI>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
     const Eigen::MatrixBase<DerivedV> & V,
-    const Eigen::MatrixBase<DerivedEle> & Ele, 
+    const Eigen::MatrixBase<DerivedEle> & Ele,
     const Eigen::MatrixBase<DerivedSI> & SI,
     const Eigen::MatrixBase<DerivedI> & I)
 {
@@ -204,15 +204,15 @@ template <typename DerivedV, int DIM>
 template <typename DerivedEle, typename Derivedq>
 IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
     const Eigen::MatrixBase<DerivedV> & V,
-    const Eigen::MatrixBase<DerivedEle> & Ele, 
+    const Eigen::MatrixBase<DerivedEle> & Ele,
     const Eigen::MatrixBase<Derivedq> & q,
     const bool first) const
 {
   using namespace std;
   using namespace Eigen;
-  assert(q.size() == DIM && 
+  assert(q.size() == DIM &&
       "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");
   const Scalar epsilon = igl::EPS<Scalar>();
   // 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 V3 = V.row(Ele(m_primitive,2));
           // 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);
           a1 = doublearea_single(V1,V2,q2);
           a2 = doublearea_single(V2,V3,q2);
@@ -266,9 +266,9 @@ IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
     a3 /= sum;
     a4 /= sum;
     if(
-        a1>=-epsilon && 
-        a2>=-epsilon && 
-        a3>=-epsilon && 
+        a1>=-epsilon &&
+        a2>=-epsilon &&
+        a3>=-epsilon &&
         a4>=-epsilon)
     {
       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 DerivedEle>
-IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar 
+IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
 igl::AABB<DerivedV,DIM>::squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   int & i,
   Eigen::PlainObjectBase<RowVectorDIMS> & c) const
@@ -359,10 +359,10 @@ igl::AABB<DerivedV,DIM>::squared_distance(
 
 template <typename DerivedV, int DIM>
 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(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   Scalar low_sqr_d,
   Scalar up_sqr_d,
@@ -393,7 +393,7 @@ igl::AABB<DerivedV,DIM>::squared_distance(
     {
       int i_left;
       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);
       this->set_min(p,sqr_d_left,i_left,c_left,sqr_d,i,c);
       looked_left = true;
@@ -401,8 +401,8 @@ igl::AABB<DerivedV,DIM>::squared_distance(
     const auto & look_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);
       this->set_min(p,sqr_d_right,i_right,c_right,sqr_d,i,c);
       looked_right = true;
@@ -418,9 +418,9 @@ igl::AABB<DerivedV,DIM>::squared_distance(
       look_right();
     }
     // 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());
-    Scalar right_up_sqr_d = 
+    Scalar right_up_sqr_d =
       m_right->m_box.squaredExteriorDistance(p.transpose());
     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 DerivedEle>
-IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar 
+IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
 igl::AABB<DerivedV,DIM>::squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   Scalar up_sqr_d,
   int & i,
@@ -464,13 +464,13 @@ igl::AABB<DerivedV,DIM>::squared_distance(
 template <typename DerivedV, int DIM>
 template <
   typename DerivedEle,
-  typename DerivedP, 
-  typename DerivedsqrD, 
-  typename DerivedI, 
+  typename DerivedP,
+  typename DerivedsqrD,
+  typename DerivedI,
   typename DerivedC>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const Eigen::MatrixBase<DerivedP> & P,
   Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
   Eigen::PlainObjectBase<DerivedI> & I,
@@ -493,24 +493,24 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
 }
 
 template <typename DerivedV, int DIM>
-template < 
+template <
   typename DerivedEle,
   typename Derivedother_V,
   typename Derivedother_Ele,
-  typename DerivedsqrD, 
-  typename DerivedI, 
+  typename DerivedsqrD,
+  typename DerivedI,
   typename DerivedC>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const AABB<Derivedother_V,DIM> & other,
   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<DerivedI> & I,
   Eigen::PlainObjectBase<DerivedC> & C) const
 {
-  assert(other_Ele.cols() == 1 && 
+  assert(other_Ele.cols() == 1 &&
     "Only implemented for other as list of points");
   assert(other_V.cols() == V.cols() && "other must match this dimension");
   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 < 
+template <
   typename DerivedEle,
   typename Derivedother_V,
   typename Derivedother_Ele,
-  typename DerivedsqrD, 
-  typename DerivedI, 
+  typename DerivedsqrD,
+  typename DerivedI,
   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(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const AABB<Derivedother_V,DIM> * other,
   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*/,
   Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
   Eigen::PlainObjectBase<DerivedI> & I,
@@ -731,9 +731,9 @@ IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
       //assert(mc == mm);
       // Only look left/right in this_list if can possible decrease somebody's
       // 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(
-          min_this_other < sqr_d && 
+          min_this_other < sqr_d &&
           min_this_other < other_tree->m_low_sqr_d)
       {
         //cout<<"before: "<<other_low_sqr_d(child)<<endl;
@@ -764,7 +764,7 @@ template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   const Scalar low_sqr_d,
   Scalar & sqr_d,
@@ -789,7 +789,7 @@ template <typename DerivedV, int DIM>
 template <typename DerivedEle>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & p,
   Scalar & sqr_d,
   int & i,
@@ -801,7 +801,7 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
 
 template <typename DerivedV, int DIM>
 IGL_INLINE void igl::AABB<DerivedV,DIM>::set_min(
-  const RowVectorDIMS & 
+  const RowVectorDIMS &
 #ifndef NDEBUG
   p
 #endif
@@ -831,10 +831,10 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::set_min(
 
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
-IGL_INLINE bool 
+IGL_INLINE bool
 igl::AABB<DerivedV,DIM>::intersect_ray(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & dir,
   std::vector<igl::Hit> & hits) const
@@ -874,10 +874,10 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
 
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
-IGL_INLINE bool 
+IGL_INLINE bool
 igl::AABB<DerivedV,DIM>::intersect_ray(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & dir,
   igl::Hit & hit) const
@@ -932,10 +932,10 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
 
 template <typename DerivedV, int DIM>
 template <typename DerivedEle>
-IGL_INLINE bool 
+IGL_INLINE bool
 igl::AABB<DerivedV,DIM>::intersect_ray(
   const Eigen::MatrixBase<DerivedV> & V,
-  const Eigen::MatrixBase<DerivedEle> & Ele, 
+  const Eigen::MatrixBase<DerivedEle> & Ele,
   const RowVectorDIMS & origin,
   const RowVectorDIMS & dir,
   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
 // combinations of 3D V with DIM=2 AABB
-// 
+//
 // _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