squared_edge_lengths.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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. #ifndef IGL_SQUARED_EDGE_LENGTHS_H
  9. #define IGL_SQUARED_EDGE_LENGTHS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. /// Constructs a list of squared lengths of edges opposite each index in a face
  15. /// (triangle/tet) list
  16. ///
  17. /// @tparam DerivedV derived from vertex positions matrix type: i.e. Eigen::MatrixXd
  18. /// @tparam DerivedF derived from face indices matrix type: i.e. Eigen::MatrixXi
  19. /// @tparam DerivedL derived from edge lengths matrix type: i.e. Eigen::MatrixXd
  20. /// @param[in] V eigen matrix #V by 3
  21. /// @param[in] F #F by (2|3|4) list of mesh edges, triangles or tets
  22. /// @param[out] L #F by {1|3|6} list of edge lengths squared
  23. /// for edges, column of lengths
  24. /// for triangles, columns correspond to edges [1,2],[2,0],[0,1]
  25. /// for tets, columns correspond to edges
  26. /// [3 0],[3 1],[3 2],[1 2],[2 0],[0 1]
  27. ///
  28. template <typename DerivedV, typename DerivedF, typename DerivedL>
  29. IGL_INLINE void squared_edge_lengths(
  30. const Eigen::MatrixBase<DerivedV>& V,
  31. const Eigen::MatrixBase<DerivedF>& F,
  32. Eigen::PlainObjectBase<DerivedL>& L);
  33. }
  34. #ifndef IGL_STATIC_LIBRARY
  35. # include "squared_edge_lengths.cpp"
  36. #endif
  37. #endif