12345678910111213141516171819202122232425262728293031323334353637383940 |
- // 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/.
- #include "print_ijv.h"
- #include "find.h"
- #include <iostream>
- template <typename T>
- IGL_INLINE void igl::print_ijv(
- const Eigen::SparseMatrix<T>& X,
- const int offset)
- {
- Eigen::Matrix<int,Eigen::Dynamic,1> I;
- Eigen::Matrix<int,Eigen::Dynamic,1> J;
- Eigen::Matrix<T,Eigen::Dynamic,1> V;
- igl::find(X,I,J,V);
- // Concatenate I,J,V
- Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> IJV(I.size(),3);
- IJV.col(0) = I.cast<T>();
- IJV.col(1) = J.cast<T>();
- IJV.col(2) = V;
- // Offset
- if(offset != 0)
- {
- IJV.col(0).array() += offset;
- IJV.col(1).array() += offset;
- }
- std::cout<<IJV;
- }
- #ifdef IGL_STATIC_LIBRARY
- // Explicit template specialization
- // generated by autoexplicit.sh
- template void igl::print_ijv<double>(Eigen::SparseMatrix<double, 0, int> const&, int);
- #endif
|