internal_angles.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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. #ifndef IGL_INTERNAL_ANGLES_H
  9. #define IGL_INTERNAL_ANGLES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Compute internal angles for a triangle mesh
  15. //
  16. // Inputs:
  17. // V #V by dim eigen Matrix of mesh vertex nD positions
  18. // F #F by poly-size eigen Matrix of face (triangle) indices
  19. // Output:
  20. // K #F by poly-size eigen Matrix of internal angles
  21. // for triangles, columns correspond to edges [1,2],[2,0],[0,1]
  22. //
  23. // Known Issues:
  24. // if poly-size ≠ 3 then dim must equal 3.
  25. template <typename DerivedV, typename DerivedF, typename DerivedK>
  26. IGL_INLINE void internal_angles(
  27. const Eigen::MatrixBase<DerivedV>& V,
  28. const Eigen::MatrixBase<DerivedF>& F,
  29. Eigen::PlainObjectBase<DerivedK> & K);
  30. // Inputs:
  31. // L_sq #F by 3 list of squared edge lengths
  32. // Output:
  33. // K #F by poly-size eigen Matrix of internal angles
  34. // for triangles, columns correspond to edges [1,2],[2,0],[0,1]
  35. //
  36. // Note:
  37. // Usage of internal_angles_using_squared_edge_lengths is preferred to internal_angles_using_squared_edge_lengths
  38. template <typename DerivedL, typename DerivedK>
  39. IGL_INLINE void internal_angles_using_squared_edge_lengths(
  40. const Eigen::MatrixBase<DerivedL>& L_sq,
  41. Eigen::PlainObjectBase<DerivedK> & K);
  42. // Inputs:
  43. // L #F by 3 list of edge lengths
  44. // Output:
  45. // K #F by poly-size eigen Matrix of internal angles
  46. // for triangles, columns correspond to edges [1,2],[2,0],[0,1]
  47. //
  48. // Note:
  49. // Usage of internal_angles_using_squared_edge_lengths is preferred to internal_angles_using_squared_edge_lengths
  50. // This function is deprecated and probably will be removed in future versions
  51. template <typename DerivedL, typename DerivedK>
  52. IGL_INLINE void internal_angles_using_edge_lengths(
  53. const Eigen::MatrixBase<DerivedL>& L,
  54. Eigen::PlainObjectBase<DerivedK> & K);}
  55. #ifndef IGL_STATIC_LIBRARY
  56. # include "internal_angles.cpp"
  57. #endif
  58. #endif