connect_boundary_to_infinity.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_CONNECT_BOUNDARY_TO_INFINITY_H
  9. #define IGL_CONNECT_BOUNDARY_TO_INFINITY_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Connect all boundary edges to a fictitious point at infinity.
  15. //
  16. // Inputs:
  17. // F #F by 3 list of face indices into some V
  18. // Outputs:
  19. // FO #F+#O by 3 list of face indices into [V;inf inf inf], original F are
  20. // guaranteed to come first. If (V,F) was a manifold mesh, now it is
  21. // closed with a possibly non-manifold vertex at infinity (but it will be
  22. // edge-manifold).
  23. template <typename DerivedF, typename DerivedFO>
  24. IGL_INLINE void connect_boundary_to_infinity(
  25. const Eigen::PlainObjectBase<DerivedF> & F,
  26. Eigen::PlainObjectBase<DerivedFO> & FO);
  27. // Inputs:
  28. // inf_index index of point at infinity (usually V.rows() or F.maxCoeff())
  29. template <typename DerivedF, typename DerivedFO>
  30. IGL_INLINE void connect_boundary_to_infinity(
  31. const Eigen::PlainObjectBase<DerivedF> & F,
  32. const typename DerivedF::Scalar inf_index,
  33. Eigen::PlainObjectBase<DerivedFO> & FO);
  34. // Inputs:
  35. // V #V by 3 list of vertex positions
  36. // F #F by 3 list of face indices into some V
  37. // Outputs:
  38. // VO #V+1 by 3 list of vertex positions, original V are guaranteed to
  39. // come first. Last point is inf, inf, inf
  40. // FO #F+#O by 3 list of face indices into VO
  41. //
  42. template <
  43. typename DerivedV,
  44. typename DerivedF,
  45. typename DerivedVO,
  46. typename DerivedFO>
  47. IGL_INLINE void connect_boundary_to_infinity(
  48. const Eigen::PlainObjectBase<DerivedV> & V,
  49. const Eigen::PlainObjectBase<DerivedF> & F,
  50. Eigen::PlainObjectBase<DerivedVO> & VO,
  51. Eigen::PlainObjectBase<DerivedFO> & FO);
  52. }
  53. #ifndef IGL_STATIC_LIBRARY
  54. # include "connect_boundary_to_infinity.cpp"
  55. #endif
  56. #endif