intrinsic_delaunay_cotmatrix.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2018 Alec Jacobson <alecjacobson@gmail.com>
  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 <cassert>
  13. template <typename DerivedV, typename DerivedF, typename Scalar>
  14. IGL_INLINE void igl::intrinsic_delaunay_cotmatrix(
  15. const Eigen::MatrixBase<DerivedV> & V,
  16. const Eigen::MatrixBase<DerivedF> & F,
  17. Eigen::SparseMatrix<Scalar>& L)
  18. {
  19. Eigen::Matrix<Scalar, Eigen::Dynamic, 3> l_intrinsic;
  20. DerivedF F_intrinsic;
  21. return igl::intrinsic_delaunay_cotmatrix(V,F,L,l_intrinsic,F_intrinsic);
  22. }
  23. template <
  24. typename DerivedV,
  25. typename DerivedF,
  26. typename Scalar,
  27. typename Derivedl_intrinsic,
  28. typename DerivedF_intrinsic>
  29. IGL_INLINE void igl::intrinsic_delaunay_cotmatrix(
  30. const Eigen::MatrixBase<DerivedV> & V,
  31. const Eigen::MatrixBase<DerivedF> & F,
  32. Eigen::SparseMatrix<Scalar>& L,
  33. Eigen::PlainObjectBase<Derivedl_intrinsic> & l_intrinsic,
  34. Eigen::PlainObjectBase<DerivedF_intrinsic> & F_intrinsic)
  35. {
  36. assert(F.cols() == 3 && "Only triangles are supported");
  37. Eigen::Matrix<Scalar, Eigen::Dynamic, 3> l;
  38. igl::edge_lengths(V,F,l);
  39. igl::intrinsic_delaunay_triangulation(l,F,l_intrinsic,F_intrinsic);
  40. igl::cotmatrix_intrinsic(l_intrinsic,F_intrinsic,L);
  41. }
  42. #ifdef IGL_STATIC_LIBRARY
  43. // Explicit template instantiation
  44. // generated by autoexplicit.sh
  45. 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> >&);
  46. // generated by autoexplicit.sh
  47. 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>&);
  48. // generated by autoexplicit.sh
  49. 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> >&);
  50. // generated by autoexplicit.sh
  51. #endif