Browse Source

explicit and quite embreeintersector

Former-commit-id: badb2c4149007bf06847b24074e5d3a812b6d3f9
Alec Jacobson (jalec 11 years ago
parent
commit
057290c556
2 changed files with 10 additions and 0 deletions
  1. 1 0
      include/igl/barycenter.cpp
  2. 9 0
      include/igl/embree/EmbreeIntersector.h

+ 1 - 0
include/igl/barycenter.cpp

@@ -29,4 +29,5 @@ IGL_INLINE void igl::barycenter(
 template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 4, 0, -1, 4> >(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, 4, 0, -1, 4> >&);
 template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 4, 0, -1, 4> >(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, 4, 0, -1, 4> >&);
 template void igl::barycenter<Eigen::Matrix<double, -1, 4, 0, -1, 4>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 4, 0, -1, 4> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> >&);
 template void igl::barycenter<Eigen::Matrix<double, -1, 4, 0, -1, 4>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 4, 0, -1, 4> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> >&);
 template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(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, 3, 0, -1, 3> >&);
 template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(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, 3, 0, -1, 3> >&);
+template void igl::barycenter<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::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> >&);
 #endif
 #endif

+ 9 - 0
include/igl/embree/EmbreeIntersector.h

@@ -68,6 +68,8 @@ namespace igl
 
 
 // Implementation
 // Implementation
 #include <igl/EPS.h>
 #include <igl/EPS.h>
+#include <iostream>
+#include <sstream>
 
 
 template <typename RowVector3>
 template <typename RowVector3>
 inline embree::Vec3f toVec3f(const RowVector3 &p) { return embree::Vec3f((float)p[0], (float)p[1], (float)p[2]); }
 inline embree::Vec3f toVec3f(const RowVector3 &p) { return embree::Vec3f((float)p[0], (float)p[1], (float)p[2]); }
@@ -82,6 +84,7 @@ igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
     _accel(),
     _accel(),
     _intersector()
     _intersector()
 {
 {
+  using namespace std;
   static bool inited = false;
   static bool inited = false;
   if(!inited)
   if(!inited)
   {
   {
@@ -111,8 +114,14 @@ igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
     triangles[numTriangles++] = embree::BuildTriangle((int)F(i,0),(int)F(i,1),(int)F(i,2),i);
     triangles[numTriangles++] = embree::BuildTriangle((int)F(i,0),(int)F(i,1),(int)F(i,2),i);
   }
   }
   
   
+  // turn off verbose output by disabling cout
+  // http://stackoverflow.com/a/8246536/148668
+  streambuf *old = cout.rdbuf(); // <-- save        
+  stringstream ss;
+  cout.rdbuf (ss.rdbuf());       // <-- redirect
   _accel = embree::rtcCreateAccel("default", "default", triangles, numTriangles, vertices, numVertices);
   _accel = embree::rtcCreateAccel("default", "default", triangles, numTriangles, vertices, numVertices);
   _intersector = _accel->queryInterface<embree::Intersector>();
   _intersector = _accel->queryInterface<embree::Intersector>();
+  cout.rdbuf (old);  
 }
 }
 
 
 template <
 template <