slice_tets.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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_SLICE_TETS_H
  9. #define IGL_SLICE_TETS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <Eigen/Sparse>
  13. #include <vector>
  14. namespace igl
  15. {
  16. // SLICE_TETS Slice through a tet mesh (V,T) along a given plane (via its
  17. // implicit equation).
  18. //
  19. // Inputs:
  20. // V #V by 3 list of tet mesh vertices
  21. // T #T by 4 list of tet indices into V
  22. // plane list of 4 coefficients in the plane equation: [x y z 1]'*plane = 0
  23. // Outputs:
  24. // U #U by 3 list of triangle mesh vertices along slice
  25. // G #G by 3 list of triangles indices into U
  26. // J #G list of indices into T revealing from which tet each faces comes
  27. // BC #U by #V list of barycentric coordinates (or more generally: linear
  28. // interpolation coordinates) so that U = BC*V
  29. //
  30. template <
  31. typename DerivedV,
  32. typename DerivedT,
  33. typename Derivedplane,
  34. typename DerivedU,
  35. typename DerivedG,
  36. typename DerivedJ,
  37. typename BCType>
  38. IGL_INLINE void slice_tets(
  39. const Eigen::PlainObjectBase<DerivedV>& V,
  40. const Eigen::PlainObjectBase<DerivedT>& T,
  41. const Eigen::PlainObjectBase<Derivedplane> & plane,
  42. Eigen::PlainObjectBase<DerivedU>& U,
  43. Eigen::PlainObjectBase<DerivedG>& G,
  44. Eigen::PlainObjectBase<DerivedJ>& J,
  45. Eigen::SparseMatrix<BCType> & BC);
  46. }
  47. #ifndef IGL_STATIC_LIBRARY
  48. # include "slice_tets.cpp"
  49. #endif
  50. #endif