Преглед изворни кода

annoying fix to cgal templates

Former-commit-id: 0a98f9bdc2b6aa720891cab5a09cb588e8412ac0
Alec Jacobson пре 10 година
родитељ
комит
22dcd26a75
1 измењених фајлова са 58 додато и 7 уклоњено
  1. 58 7
      include/igl/cgal/SelfIntersectMesh.h

+ 58 - 7
include/igl/cgal/SelfIntersectMesh.h

@@ -217,6 +217,11 @@ namespace igl
         SelfIntersectMesh * SIM, 
         const Box &a, 
         const Box &b);
+      // Annoying wrappers to conver from cgal to double or cgal
+      static inline void to_output_type(const typename Kernel::FT & cgal,double & d);
+      static inline void to_output_type(
+        const typename CGAL::Epeck::FT & cgal,
+        CGAL::Epeck::FT & d);
   };
 }
 
@@ -600,13 +605,7 @@ inline igl::SelfIntersectMesh<
       {
         const Point_3 & p = *nvit;
         // Don't convert via double if output type is same as Kernel
-        if(std::is_same<typename DerivedVV::Scalar,typename Kernel::FT>::value)
-        {
-          VV(V.rows()+i,d) = p[d];
-        }else
-        {
-          VV(V.rows()+i,d) = CGAL::to_double(p[d]);
-        }
+        to_output_type(p[d], VV(V.rows()+i,d));
       }
       i++;
     }
@@ -1213,5 +1212,57 @@ inline void igl::SelfIntersectMesh<
   }
 }
 
+template <
+  typename Kernel,
+  typename DerivedV,
+  typename DerivedF,
+  typename DerivedVV,
+  typename DerivedFF,
+  typename DerivedIF,
+  typename DerivedJ,
+  typename DerivedIM>
+inline 
+void 
+igl::SelfIntersectMesh<
+  Kernel,
+  DerivedV,
+  DerivedF,
+  DerivedVV,
+  DerivedFF,
+  DerivedIF,
+  DerivedJ,
+  DerivedIM>::to_output_type(
+    const typename Kernel::FT & cgal,
+    double & d)
+{
+  d = CGAL::to_double(cgal);
+}
+
+template <
+  typename Kernel,
+  typename DerivedV,
+  typename DerivedF,
+  typename DerivedVV,
+  typename DerivedFF,
+  typename DerivedIF,
+  typename DerivedJ,
+  typename DerivedIM>
+inline 
+void 
+igl::SelfIntersectMesh<
+  Kernel,
+  DerivedV,
+  DerivedF,
+  DerivedVV,
+  DerivedFF,
+  DerivedIF,
+  DerivedJ,
+  DerivedIM>::to_output_type(
+    const typename CGAL::Epeck::FT & cgal,
+    CGAL::Epeck::FT & d)
+{
+  d = cgal;
+}
+
 #endif