Эх сурвалжийг харах

FUCK OFF GIT, merge

Former-commit-id: 899e19f5ae265465812722cb42d35c016af98bb3
Alec Jacobson 10 жил өмнө
parent
commit
e56ed94e69

+ 8 - 2
include/igl/cgal/point_mesh_squared_distance.cpp

@@ -56,6 +56,12 @@ IGL_INLINE void igl::point_mesh_squared_distance_precompute(
   // Must be triangles
   // Must be triangles
   assert(F.cols() == 3);
   assert(F.cols() == 3);
 
 
+  // WTF ALERT!!!! 
+  //
+  // There's a bug in clang probably or at least in cgal. Without calling this
+  // line (I guess invoking some compilation from <vector>), clang will vomit
+  // errors inside CGAL.
+  //
   // http://stackoverflow.com/questions/27748442/is-clangs-c11-support-reliable
   // http://stackoverflow.com/questions/27748442/is-clangs-c11-support-reliable
   T.reserve(0);
   T.reserve(0);
 
 
@@ -114,7 +120,7 @@ IGL_INLINE void igl::point_mesh_squared_distance(
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
-template void igl::point_mesh_squared_distance<CGAL::Epeck>( const Eigen::MatrixXd & P, const Eigen::MatrixXd & V, const Eigen::MatrixXi & F, Eigen::VectorXd & sqrD, Eigen::VectorXi & I, Eigen::MatrixXd & C);
 template void igl::point_mesh_squared_distance_precompute<CGAL::Epick>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epick, CGAL::AABB_triangle_primitive<CGAL::Epick, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > >::iterator, CGAL::Boolean_tag<false> > > >&, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > >&);
 template void igl::point_mesh_squared_distance_precompute<CGAL::Epick>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epick, CGAL::AABB_triangle_primitive<CGAL::Epick, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > >::iterator, CGAL::Boolean_tag<false> > > >&, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > >&);
-
+template void igl::point_mesh_squared_distance<CGAL::Epeck>( const Eigen::MatrixXd & P, const Eigen::MatrixXd & V, const Eigen::MatrixXi & F, Eigen::VectorXd & sqrD, Eigen::VectorXi & I, Eigen::MatrixXd & C);
+template void igl::point_mesh_squared_distance<CGAL::Epick>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1>&, Eigen::Matrix<int, -1, 1, 0, -1, 1>&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
 #endif
 #endif

+ 54 - 0
include/igl/matlab/mexStream.h

@@ -0,0 +1,54 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_MEX_STREAM_H
+#define IGL_MEX_STREAM_H
+#include <iostream>
+namespace igl
+{
+  // http://stackoverflow.com/a/249008/148668
+  
+  // Class to implement "cout" for mex files to print to the matlab terminal
+  // window.
+  //
+  // Insert at the beginning of mexFunction():
+  //  MexStream mout;
+  //  std::streambuf *outbuf = std::cout.rdbuf(&mout); 
+  //  ...
+  //  ALWAYS restore original buffer to avoid memory leak problems in matlab
+  //  std::cout.rdbuf(outbuf);
+  //
+  class MexStream : public std::streambuf
+  {
+    public:
+    protected:
+      inline virtual std::streamsize xsputn(const char *s, std::streamsize n); 
+      inline virtual int overflow(int c = EOF);
+  }; 
+}
+
+// Implementation 
+#include <mex.h>
+#include <cstdio>
+inline std::streamsize igl::MexStream::xsputn(
+  const char *s, 
+  std::streamsize n) 
+{
+  mexPrintf("%.*s",n,s);
+  mexEvalString("drawnow;"); // to dump string.
+  return n;
+}
+
+inline int igl::MexStream::overflow(int c) 
+{
+    if (c != EOF) {
+      mexPrintf("%.1s",&c);
+      mexEvalString("drawnow;"); // to dump string.
+    }
+    return 1;
+}
+#endif