intrinsic_delaunay_cotmatrix.cpp 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2018 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #include "intrinsic_delaunay_cotmatrix.h"
  9. #include "edge_lengths.h"
  10. #include "intrinsic_delaunay_triangulation.h"
  11. #include "cotmatrix_intrinsic.h"
  12. #include "PlainMatrix.h"
  13. #include <cassert>
  14. template <typename DerivedV, typename DerivedF, typename Scalar>
  15. IGL_INLINE void igl::intrinsic_delaunay_cotmatrix(
  16. const Eigen::MatrixBase<DerivedV> & V,
  17. const Eigen::MatrixBase<DerivedF> & F,
  18. Eigen::SparseMatrix<Scalar>& L)
  19. {
  20. Eigen::Matrix<Scalar, Eigen::Dynamic, 3> l_intrinsic;
  21. PlainMatrix<DerivedF> F_intrinsic;
  22. return igl::intrinsic_delaunay_cotmatrix(V,F,L,l_intrinsic,F_intrinsic);
  23. }
  24. template <
  25. typename DerivedV,
  26. typename DerivedF,
  27. typename Scalar,
  28. typename Derivedl_intrinsic,
  29. typename DerivedF_intrinsic>
  30. IGL_INLINE void igl::intrinsic_delaunay_cotmatrix(
  31. const Eigen::MatrixBase<DerivedV> & V,
  32. const Eigen::MatrixBase<DerivedF> & F,
  33. Eigen::SparseMatrix<Scalar>& L,
  34. Eigen::PlainObjectBase<Derivedl_intrinsic> & l_intrinsic,
  35. Eigen::PlainObjectBase<DerivedF_intrinsic> & F_intrinsic)
  36. {
  37. assert(F.cols() == 3 && "Only triangles are supported");
  38. Eigen::Matrix<Scalar, Eigen::Dynamic, 3> l;
  39. igl::edge_lengths(V,F,l);
  40. igl::intrinsic_delaunay_triangulation(l,F,l_intrinsic,F_intrinsic);
  41. igl::cotmatrix_intrinsic(l_intrinsic,F_intrinsic,L);
  42. }
  43. #ifdef IGL_STATIC_LIBRARY
  44. // Explicit template instantiation
  45. // generated by autoexplicit.sh
  46. template void igl::intrinsic_delaunay_cotmatrix<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  47. // generated by autoexplicit.sh
  48. template void igl::intrinsic_delaunay_cotmatrix<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
  49. // generated by autoexplicit.sh
  50. template void igl::intrinsic_delaunay_cotmatrix<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  51. // generated by autoexplicit.sh
  52. #endif