shortest_edge_and_midpoint.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 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_SHORTEST_EDGE_AND_MIDPOINT_H
  9. #define IGL_SHORTEST_EDGE_AND_MIDPOINT_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. // Cost and placement function compatible with igl::decimate. The cost of
  16. // collapsing an edge is its length (prefer to collapse short edges) and the
  17. // placement strategy for the new vertex is the midpoint of the collapsed
  18. // edge.
  19. //
  20. // Inputs:
  21. // e index into E of edge to be considered for collapse
  22. // V #V by dim list of vertex positions
  23. // F #F by 3 list of faces (ignored)
  24. // E #E by 2 list of edge indices into V
  25. // EMAP #F*3 list of half-edges indices into E (ignored)
  26. // EF #E by 2 list of edge-face flaps into F (ignored)
  27. // EI #E by 2 list of edge-face opposite corners (ignored)
  28. // Outputs:
  29. // cost set to edge length
  30. // p placed point set to edge midpoint
  31. IGL_INLINE void shortest_edge_and_midpoint(
  32. const int e,
  33. const Eigen::MatrixXd & V,
  34. const Eigen::MatrixXi & /*F*/,
  35. const Eigen::MatrixXi & E,
  36. const Eigen::VectorXi & /*EMAP*/,
  37. const Eigen::MatrixXi & /*EF*/,
  38. const Eigen::MatrixXi & /*EI*/,
  39. double & cost,
  40. Eigen::RowVectorXd & p);
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "shortest_edge_and_midpoint.cpp"
  44. #endif
  45. #endif