edge_vectors.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2020 Oded Stein <[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. #ifndef IGL_EDGE_VECTORS_H
  9. #define IGL_EDGE_VECTORS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. /// Computes the normalized edge vectors for edges in a triangle mesh
  15. ///
  16. /// @tparam whether to compute edge perpendiculars
  17. /// @param[in] V #V by 3 list of vertex positions
  18. /// @param[in] F #F by 3 list of triangle indices
  19. /// @param[in] E #F by 3 a mapping from each halfedge to each edge
  20. /// @param[in] oE #F by 3 the orientation (e.g., -1 or 1) of each halfedge
  21. /// compared to the orientation of the actual edge, as computed with
  22. /// orient_halfedges. will be computed if not provided.
  23. /// @param[out] vecParallel |HE| list of edge vectors
  24. /// @param[out] vecPerpendicular |HE| list of vectors perpendicular to vec
  25. template<bool computePerpendicular=true,
  26. typename DerivedV,typename DerivedF,typename DerivedE,
  27. typename DerivedoE, typename DerivedvecParallel,
  28. typename DerivedvecPerpendicular>
  29. IGL_INLINE void edge_vectors(
  30. const Eigen::MatrixBase<DerivedV> &V,
  31. const Eigen::MatrixBase<DerivedF> &F,
  32. const Eigen::MatrixBase<DerivedE> &E,
  33. const Eigen::MatrixBase<DerivedoE> &oE,
  34. Eigen::PlainObjectBase<DerivedvecParallel> &vecParallel,
  35. Eigen::PlainObjectBase<DerivedvecPerpendicular> &vecPerpendicular);
  36. /// \overload
  37. template<typename DerivedV,typename DerivedF,typename DerivedE,
  38. typename DerivedoE, typename Derivedvec>
  39. IGL_INLINE void edge_vectors(
  40. const Eigen::MatrixBase<DerivedV> &V,
  41. const Eigen::MatrixBase<DerivedF> &F,
  42. const Eigen::MatrixBase<DerivedE> &E,
  43. const Eigen::MatrixBase<DerivedoE> &oE,
  44. Eigen::PlainObjectBase<Derivedvec> &vec);
  45. }
  46. #ifndef IGL_STATIC_LIBRARY
  47. # include "edge_vectors.cpp"
  48. #endif
  49. #endif