Browse Source

template instanciation

Former-commit-id: 925a42eef2e3d2d8000127856cf10a3aa8dab4f4
Alec Jacobson (jalec 11 years ago
parent
commit
e96173c4f0

+ 1 - 1
examples/patches/temp.rbr

@@ -1,6 +1,6 @@
 wireframe_visible: TW_TYPE_BOOLCPP 0
 fill_visible: TW_TYPE_BOOLCPP 1
-camera_rotation: TW_TYPE_QUAT4D 0.416858 0.0264188 -0.0596578 0.906627
+camera_rotation: TW_TYPE_QUAT4D -0.330949 0.602303 0.486214 0.539722
 rotation_type: RotationType igl trackball
 orient_method: OrientMethod ambient occlusion
 

+ 2 - 0
include/igl/cat.cpp

@@ -145,4 +145,6 @@ template Eigen::SparseMatrix<double, 0, int> igl::cat<Eigen::SparseMatrix<double
 // generated by autoexplicit.sh
 template Eigen::Matrix<int, -1, -1, 0, -1, -1> igl::cat<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(int, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&);
 template void igl::cat<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(int, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<double, -1, 1, 0, -1, 1>&);
+template Eigen::Matrix<int, -1, 1, 0, -1, 1> igl::cat<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(int, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&);
+template Eigen::Matrix<double, -1, 1, 0, -1, 1> igl::cat<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(int, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&);
 #endif

+ 3 - 0
include/igl/normalize_row_lengths.cpp

@@ -13,6 +13,9 @@ IGL_INLINE void igl::normalize_row_lengths(
   {
     B.row(i) = A.row(i).normalized();
   }
+  //// Or just:
+  //B = A;
+  //B.rowwise().normalize();
 }
 #ifndef IGL_HEADER_ONLY
 // Explicit template specialization

+ 11 - 0
include/igl/slice.cpp

@@ -154,6 +154,17 @@ IGL_INLINE void igl::slice(
   return igl::slice(X,R,C,Y);
 }
 
+template <typename DerivedX>
+IGL_INLINE Eigen::PlainObjectBase<DerivedX> igl::slice(
+  const Eigen::PlainObjectBase<DerivedX> & X,
+  const Eigen::Matrix<int,Eigen::Dynamic,1> & R)
+{
+  Eigen::PlainObjectBase<DerivedX> Y;
+  // phony column indices
+  igl::slice(X,R,Y);
+  return Y;
+}
+
 #ifndef IGL_HEADER_ONLY
 // Explicit template specialization
 // generated by autoexplicit.sh

+ 5 - 2
include/igl/slice.h

@@ -35,19 +35,22 @@ namespace igl
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const int dim,
     Mat& Y);
-
   template <typename DerivedX>
   IGL_INLINE void slice(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & C,
     Eigen::PlainObjectBase<DerivedX> & Y);
-
   template <typename DerivedX>
   IGL_INLINE void slice(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     Eigen::PlainObjectBase<DerivedX> & Y);
+  // VectorXi Y = slice(X,R);
+  template <typename DerivedX>
+  IGL_INLINE Eigen::PlainObjectBase<DerivedX> slice(
+    const Eigen::PlainObjectBase<DerivedX> & X,
+    const Eigen::Matrix<int,Eigen::Dynamic,1> & R);
 }
 
 #ifdef IGL_HEADER_ONLY

+ 1 - 0
include/igl/sparse.cpp

@@ -102,4 +102,5 @@ template void igl::sparse<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<dou
 template void igl::sparse<Eigen::Matrix<double, -1, -1, 0, -1, -1>, double>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
 template Eigen::SparseMatrix<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, 0, int> igl::sparse<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&);
 template Eigen::SparseMatrix<Eigen::Matrix<double, -1, 1, 0, -1, 1>::Scalar, 0, int> igl::sparse<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&);
+template void igl::sparse<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >, double>(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, unsigned long, unsigned long, Eigen::SparseMatrix<double, 0, int>&);
 #endif

+ 11 - 0
matlab-to-eigen.html

@@ -226,6 +226,17 @@ A.setFromTriplets(IJV);
         </code></pre></td>
         <td>Coefficient-wise minimum of matrix and scalar (or matching size matrix)</td>
       </tr>
+
+      <tr class=d1>
+        <td><pre><code>IP = I(P==0);</code></pre></td>
+        <td><pre><code>VectorXi IP = I;
+IP.conservativeResize(stable_partition(
+  IP.data(), 
+  IP.data()+IP.size(), 
+  [&amp;P](int i){return P(i)==0;})-IP.data());
+        </code></pre></td>
+        <td>Where I and P are vectors. <i>Requires C++11 and <code>#include &lt;algorithm&gt;</code></i></td>
+      </tr>
       <!-- Insert rows for each command pair -->
 
       <!-- Leave this here for copy and pasting