Ver código fonte

Fix template instantiations.

Former-commit-id: 3ae5957eb7a1093c525d03eb3f56a8574c9180c5
Jérémie Dumas 7 anos atrás
pai
commit
ff75cfe954
2 arquivos alterados com 16 adições e 10 exclusões
  1. 15 10
      include/igl/ray_box_intersect.cpp
  2. 1 0
      include/igl/ray_mesh_intersect.cpp

+ 15 - 10
include/igl/ray_box_intersect.cpp

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2016 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// 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 "ray_box_intersect.h"
 #include <vector>
@@ -27,7 +27,7 @@ IGL_INLINE bool igl::ray_box_intersect(
     const Eigen::Vector3f& rayo,
     const Eigen::Vector3f& rayd,
     const Eigen::Vector3f& bmin,
-    const Eigen::Vector3f& bmax, 
+    const Eigen::Vector3f& bmax,
     float & tnear,
     float & tfar
     )->bool
@@ -35,12 +35,12 @@ IGL_INLINE bool igl::ray_box_intersect(
     Eigen::Vector3f bnear;
     Eigen::Vector3f bfar;
     // Checks for intersection testing on each direction coordinate
-    // Computes 
+    // Computes
     float t1, t2;
     tnear = -1e+6f, tfar = 1e+6f; //, tCube;
     bool intersectFlag = true;
     for (int i = 0; i < 3; ++i) {
-  //    std::cout << "coordinate " << i << ": bmin " << bmin(i) << ", bmax " << bmax(i) << std::endl; 
+  //    std::cout << "coordinate " << i << ": bmin " << bmin(i) << ", bmax " << bmax(i) << std::endl;
       assert(bmin(i) <= bmax(i));
       if (::fabs(rayd(i)) < 1e-6) {   // Ray parallel to axis i-th
         if (rayo(i) < bmin(i) || rayo(i) > bmax(i)) {
@@ -59,12 +59,12 @@ IGL_INLINE bool igl::ray_box_intersect(
         }
   //      std::cout << "  bnear " << bnear(i) << ", bfar " << bfar(i) << std::endl;
         // Finds the distance parameters t1 and t2 of the two ray-box intersections:
-        // t1 must be the closest to the ray origin rayo. 
+        // t1 must be the closest to the ray origin rayo.
         t1 = (bnear(i) - rayo(i)) / rayd(i);
         t2 = (bfar(i) - rayo(i)) / rayd(i);
         if (t1 > t2) {
           std::swap(t1,t2);
-        } 
+        }
         // The two intersection values are used to saturate tnear and tfar
         if (t1 > tnear) {
           tnear = t1;
@@ -72,7 +72,7 @@ IGL_INLINE bool igl::ray_box_intersect(
         if (t2 < tfar) {
           tfar = t2;
         }
-  //      std::cout << "  t1 " << t1 << ", t2 " << t2 << ", tnear " << tnear << ", tfar " << tfar 
+  //      std::cout << "  t1 " << t1 << ", t2 " << t2 << ", tnear " << tnear << ", tfar " << tfar
   //        << "  tnear > tfar? " << (tnear > tfar) << ", tfar < 0? " << (tfar < 0) << std::endl;
         if(tnear > tfar) {
           intersectFlag = false;
@@ -143,3 +143,8 @@ IGL_INLINE bool igl::ray_box_intersect(
   return true;
 #endif
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template instantiation
+template bool igl::ray_box_intersect<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, double>(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::AlignedBox<double, 3> const&, double const&, double const&, double&, double&);
+#endif

+ 1 - 0
include/igl/ray_mesh_intersect.cpp

@@ -82,4 +82,5 @@ IGL_INLINE bool igl::ray_mesh_intersect(
 // Explicit template instantiation
 template bool igl::ray_mesh_intersect<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<igl::Hit, std::allocator<igl::Hit> >&);
 template bool igl::ray_mesh_intersect<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::Hit&);
+template bool igl::ray_mesh_intersect<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, 1, -1, false> >(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, 1, -1, false> > const&, igl::Hit&);
 #endif