Explorar o código

better histc prototype, fixed warnings

Former-commit-id: e891c78cec7cf92eee08259eadab43abc018aba0
Alec Jacobson (jalec %!s(int64=11) %!d(string=hai) anos
pai
achega
aebcaf8c6d
Modificáronse 3 ficheiros con 11 adicións e 6 borrados
  1. 5 2
      include/igl/histc.cpp
  2. 2 2
      include/igl/histc.h
  3. 4 2
      include/igl/sample_mesh.cpp

+ 5 - 2
include/igl/histc.cpp

@@ -1,5 +1,7 @@
 #include "histc.h"
+#include "matlab_format.h"
 #include <cassert>
+#include <iostream>
 
 template <typename DerivedX, typename DerivedE, typename DerivedN, typename DerivedB>
 IGL_INLINE void igl::histc(
@@ -32,9 +34,10 @@ IGL_INLINE void igl::histc(
   Eigen::PlainObjectBase<DerivedB > & B)
 {
   const int m = X.size();
+  using namespace std;
   assert( 
-    (E.topLeftCorner(E.size()-1) - 
-      E.bottomRightCorner(E.size()-1)).maxCoeff() >= 0 && 
+    (E.bottomRightCorner(E.size()-1,1) -
+      E.topLeftCorner(E.size()-1,1)).maxCoeff() >= 0 && 
     "E should be monotonically increasing");
   B.resize(m,1);
 #pragma omp parallel for

+ 2 - 2
include/igl/histc.h

@@ -5,8 +5,8 @@
 // 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_histc_H
-#define IGL_histc_H
+#ifndef IGL_HISTC_H
+#define IGL_HISTC_H
 
 #include "igl_inline.h"
 #include <Eigen/Core>

+ 4 - 2
include/igl/sample_mesh.cpp

@@ -2,6 +2,8 @@
 #include "doublearea.h"
 #include "cumsum.h"
 #include "histc.h"
+#include "matlab_format.h"
+#include <iostream>
 #include <cassert>
 
 template <typename DerivedV, typename DerivedF, typename DerivedB, typename DerivedFI>
@@ -13,6 +15,7 @@ IGL_INLINE void igl::sample_mesh(
   Eigen::PlainObjectBase<DerivedFI > & FI)
 {
   using namespace Eigen;
+  using namespace std;
   typedef typename DerivedV::Scalar Scalar;
   typedef Matrix<Scalar,Dynamic,1> VectorXs;
   VectorXs A;
@@ -28,8 +31,7 @@ IGL_INLINE void igl::sample_mesh(
   const VectorXs R = (VectorXs::Random(n,1).array() + 1.)/2.;
   assert(R.minCoeff() >= 0);
   assert(R.maxCoeff() <= 1);
-  VectorXi _;
-  histc(R,C,_,FI);
+  histc(R,C,FI);
   const VectorXs S = (VectorXs::Random(n,1).array() + 1.)/2.;
   const VectorXs T = (VectorXs::Random(n,1).array() + 1.)/2.;
   B.resize(n,3);