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

templates

Former-commit-id: d00d5ddc6812254646fa40d7f88409318d04b4d8
Alec Jacobson пре 8 година
родитељ
комит
e650edcc01

+ 1 - 0
include/igl/copyleft/cgal/point_triangle_squared_distance.cpp

@@ -6,6 +6,7 @@
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "point_triangle_squared_distance.h"
+#include <CGAL/Segment_3.h>
 template < typename Kernel>
 IGL_INLINE void point_triangle_squared_distance(
   const CGAL::Point_3<Kernel> & P1,

+ 8 - 7
include/igl/copyleft/cgal/segment_segment_squared_distance.cpp

@@ -6,6 +6,7 @@
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "segment_segment_squared_distance.h"
+#include <CGAL/Vector_3.h>
 
 // http://geomalgorithms.com/a07-_distance.html
 template < typename Kernel>
@@ -14,23 +15,23 @@ IGL_INLINE bool igl::copyleft::cgal::segment_segment_squared_distance(
     const CGAL::Segment_3<Kernel> & S2,
     CGAL::Point_3<Kernel> & P1,
     CGAL::Point_3<Kernel> & P2,
-    typename Kernel::FT & d)
+    typename Kernel::FT & dst)
 {
   typedef CGAL::Point_3<Kernel> Point_3;
   typedef CGAL::Vector_3<Kernel> Vector_3;
-  typedef Kernel::FT EScalar;
+  typedef typename Kernel::FT EScalar;
   if(S1.is_degenerate())
   {
     // All points on S1 are the same
     P1 = S1.source();
-    point_segment_squared_distance(P1,S2,P2,d);
+    point_segment_squared_distance(P1,S2,P2,dst);
     return true;
   }else if(S2.is_degenerate())
   {
     assert(!S1.is_degenerate());
     // All points on S2 are the same
     P2 = S2.source();
-    point_segment_squared_distance(P2,S1,P1,d);
+    point_segment_squared_distance(P2,S1,P1,dst);
     return true;
   }
 
@@ -48,8 +49,8 @@ IGL_INLINE bool igl::copyleft::cgal::segment_segment_squared_distance(
   const auto e = v.dot(w);
   const auto D = a*c - b*b;        // always >= 0
   assert(D>=0);
-  const auto sc, sN, sD = D;       // sc = sN / sD, default sD = D >= 0
-  const auto tc, tN, tD = D;       // tc = tN / tD, default tD = D >= 0
+  const auto sc=D, sN=D, sD = D;       // sc = sN / sD, default sD = D >= 0
+  const auto tc=D, tN=D, tD = D;       // tc = tN / tD, default tD = D >= 0
 
   bool parallel = false;
   // compute the line parameters of the two closest points
@@ -123,6 +124,6 @@ IGL_INLINE bool igl::copyleft::cgal::segment_segment_squared_distance(
   Vector_3   dP = w + (sc * u) - (tc * v);  // =  S1(sc) - S2(tc)
   assert(dP == (P1-P2));
 
-  d = dP.squared_length();   // return the closest distance
+  dst = dP.squared_length();   // return the closest distance
   return parallel;
 }

+ 10 - 7
include/igl/copyleft/cgal/triangle_triangle_squared_distance.cpp

@@ -7,9 +7,12 @@
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "triangle_triangle_squared_distance.h"
 #include "point_triangle_squared_distance.h"
+#include <CGAL/Vector_3.h>
+#include <CGAL/Segment_3.h>
+#include <CGAL/intersections.h>
 
 template < typename Kernel>
-IGL_INLINE bool igl::copyleft:cgal::triangle_triangle_squared_distance(
+IGL_INLINE bool igl::copyleft::cgal::triangle_triangle_squared_distance(
   const CGAL::Triangle_3<Kernel> & T1,
   const CGAL::Triangle_3<Kernel> & T2,
   CGAL::Point_3<Kernel> & P1,
@@ -20,7 +23,7 @@ IGL_INLINE bool igl::copyleft:cgal::triangle_triangle_squared_distance(
   typedef CGAL::Vector_3<Kernel> Vector_3;
   typedef CGAL::Triangle_3<Kernel> Triangle_3;
   typedef CGAL::Segment_3<Kernel> Segment_3;
-  typedef Kernel::FT EScalar;
+  typedef typename Kernel::FT EScalar;
   assert(!T1.is_degenerate());
   assert(!T2.is_degenerate());
 
@@ -38,12 +41,12 @@ IGL_INLINE bool igl::copyleft:cgal::triangle_triangle_squared_distance(
     {
       unique = false;
       Q = s->source();
-    }else if(const Triangle_3 *itri = CGAL::object_cast<Triangle_3 >(&obj))
+    }else if(const Triangle_3 *itri = CGAL::object_cast<Triangle_3 >(&result))
     {
       Q = s->vertex(0);
       unique = false;
     }else if(const std::vector<Point_3 > *polyp = 
-      CGAL::object_cast< std::vector<Point_3 > >(&obj))
+      CGAL::object_cast< std::vector<Point_3 > >(&result))
     {
       assert(polyp->size() > 0 && "intersection poly should not be empty");
       Q = polyp[0];
@@ -60,7 +63,7 @@ IGL_INLINE bool igl::copyleft:cgal::triangle_triangle_squared_distance(
   // triangles do not intersect: the points of closest approach must be on the
   // boundary of one of the triangles
   d = std::numeric_limits<double>::infinity();
-  const auto & vertices_face = [](
+  const auto & vertices_face = [&unique](
     const Triangle_3 & T1,
     const Triangle_3 & T2,
     Point_3 & P1,
@@ -90,10 +93,10 @@ IGL_INLINE bool igl::copyleft:cgal::triangle_triangle_squared_distance(
   vertices_face(T2,T1,P1,P2,d);
   for(int i = 0;i<3;i++)
   {
-    const Segment_3<Kernel> s1( T1.vertex(i+1), T1.vertex(i+2));
+    const Segment_3 s1( T1.vertex(i+1), T1.vertex(i+2));
     for(int j = 0;j<3;j++)
     {
-      const Segment_3<Kernel> s2( T2.vertex(i+1), T2.vertex(i+2));
+      const Segment_3 s2( T2.vertex(i+1), T2.vertex(i+2));
       Point_3 P1ij;
       Point_3 P2ij;
       EScalar dij;

+ 1 - 0
include/igl/list_to_matrix.cpp

@@ -151,6 +151,7 @@ template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, -1, 0, -1, -
 template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template bool igl::list_to_matrix<unsigned long, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::vector<unsigned long, std::allocator<unsigned long> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, 3, 1, -1, 3> >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&);
+template bool igl::list_to_matrix<unsigned long, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
 
 #ifdef WIN32
 template bool igl::list_to_matrix<unsigned long long,class Eigen::Matrix<int,-1,1,0,-1,1> >(class std::vector<unsigned long long,class std::allocator<unsigned long long> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,1,0,-1,1> > &);

+ 4 - 0
include/igl/loop.cpp

@@ -167,3 +167,7 @@ IGL_INLINE void igl::loop(
     NV = (S*NV).eval();
   }
 }
+
+#ifdef IGL_STATIC_LIBRARY
+template void igl::loop<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, int);
+#endif

+ 1 - 0
include/igl/sort.cpp

@@ -338,4 +338,5 @@ template void igl::sort<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<doub
 template void igl::sort<Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template void igl::sort<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 
+template void igl::sort<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
 #endif

+ 1 - 0
include/igl/unique.cpp

@@ -279,6 +279,7 @@ template void igl::unique<double>(std::vector<double, std::allocator<double> > c
 template void igl::unique<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template void igl::unique<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template void igl::unique_rows<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::unique<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
 
 #ifdef WIN32
 template void __cdecl igl::unique_rows<class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1> >(class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1> > const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1> > &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1> > &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1> > &);

+ 3 - 3
include/igl/upsample.cpp

@@ -139,7 +139,7 @@ IGL_INLINE void igl::upsample(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-// generated by autoexplicit.sh
-template void igl::upsample<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
-template void igl::upsample<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::Matrix<double, -1, -1, 0, -1, -1>&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);
+template void igl::upsample<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, int);
+template void igl::upsample<Eigen::Matrix<int, -1, -1, 0, -1, -1>, double, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::upsample<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::Matrix<double, -1, -1, 0, -1, -1>&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&, int);
 #endif