|
@@ -13,14 +13,14 @@
|
|
|
template <typename T, class Mat>
|
|
|
IGL_INLINE bool igl::list_to_matrix(const std::vector<std::vector<T > > & V,Mat & M)
|
|
|
{
|
|
|
- // number of columns
|
|
|
+ // number of rows
|
|
|
int m = V.size();
|
|
|
if(m == 0)
|
|
|
{
|
|
|
fprintf(stderr,"Error: list_to_matrix() list is empty()\n");
|
|
|
return false;
|
|
|
}
|
|
|
- // number of rows
|
|
|
+ // number of columns
|
|
|
int n = igl::min_size(V);
|
|
|
if(n != igl::max_size(V))
|
|
|
{
|
|
@@ -45,6 +45,29 @@ IGL_INLINE bool igl::list_to_matrix(const std::vector<std::vector<T > > & V,Mat
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+template <typename T, class Mat>
|
|
|
+IGL_INLINE bool igl::list_to_matrix(const std::vector<T > & V,Mat & M)
|
|
|
+{
|
|
|
+ // number of rows
|
|
|
+ int m = V.size();
|
|
|
+ if(m == 0)
|
|
|
+ {
|
|
|
+ fprintf(stderr,"Error: list_to_matrix() list is empty()\n");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ assert(n != -1);
|
|
|
+ // Resize output
|
|
|
+ M.resize(m,1);
|
|
|
+
|
|
|
+ // Loop over rows
|
|
|
+ for(int i = 0;i<m;i++)
|
|
|
+ {
|
|
|
+ M(i) = V[i];
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
#ifndef IGL_HEADER_ONLY
|
|
|
// Explicit template specialization
|
|
|
// generated by autoexplicit.sh
|
|
@@ -59,4 +82,6 @@ template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(s
|
|
|
template bool igl::list_to_matrix<double, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
|
|
|
// generated by autoexplicit.sh
|
|
|
template bool igl::list_to_matrix<double, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);
|
|
|
+template bool igl::list_to_matrix<bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
+template bool igl::list_to_matrix<bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
#endif
|