boundary_facets.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_BOUNDARY_FACETS_H
  9. #define IGL_BOUNDARY_FACETS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <vector>
  13. namespace igl
  14. {
  15. // BOUNDARY_FACETS Determine boundary faces (edges) of tetrahedra (triangles)
  16. // stored in T (analogous to qptoolbox's `outline` and `boundary_faces`).
  17. //
  18. // Input:
  19. // T tetrahedron (triangle) index list, m by 4 (3), where m is the number of tetrahedra
  20. // Output:
  21. // F list of boundary faces, n by 3 (2), where n is the number of boundary faces
  22. // J list of indices into T, n by 1
  23. // K list of indices revealing across from which vertex is this facet
  24. //
  25. //
  26. template <
  27. typename DerivedT,
  28. typename DerivedF,
  29. typename DerivedJ,
  30. typename DerivedK>
  31. IGL_INLINE void boundary_facets(
  32. const Eigen::MatrixBase<DerivedT>& T,
  33. Eigen::PlainObjectBase<DerivedF>& F,
  34. Eigen::PlainObjectBase<DerivedJ>& J,
  35. Eigen::PlainObjectBase<DerivedK>& K);
  36. template <typename DerivedT, typename DerivedF>
  37. IGL_INLINE void boundary_facets(
  38. const Eigen::MatrixBase<DerivedT>& T,
  39. Eigen::PlainObjectBase<DerivedF>& F);
  40. template <typename IntegerT, typename IntegerF>
  41. IGL_INLINE void boundary_facets(
  42. const std::vector<std::vector<IntegerT> > & T,
  43. std::vector<std::vector<IntegerF> > & F);
  44. // Templates:
  45. // DerivedT integer-value: i.e. from MatrixXi
  46. // DerivedF integer-value: i.e. from MatrixXi
  47. template <typename DerivedT, typename DerivedF>
  48. IGL_INLINE void boundary_facets(
  49. const Eigen::MatrixBase<DerivedT>& T,
  50. Eigen::PlainObjectBase<DerivedF>& F);
  51. // Same as above but returns F
  52. template <typename DerivedT, typename Ret>
  53. Ret boundary_facets(
  54. const Eigen::MatrixBase<DerivedT>& T);
  55. }
  56. #ifndef IGL_STATIC_LIBRARY
  57. # include "boundary_facets.cpp"
  58. #endif
  59. #endif