slice_tets.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. // S #V list of values so that S = 0 is the desired isosurface
  24. // Outputs:
  25. // SV #SV by 3 list of triangle mesh vertices along slice
  26. // SF #SF by 3 list of triangles indices into SV
  27. // J #SF list of indices into T revealing from which tet each faces comes
  28. // BC #SU by #V list of barycentric coordinates (or more generally: linear
  29. // interpolation coordinates) so that SV = BC*V
  30. //
  31. template <
  32. typename DerivedV,
  33. typename DerivedT,
  34. typename DerivedS,
  35. typename DerivedSV,
  36. typename DerivedSF,
  37. typename DerivedJ,
  38. typename BCType>
  39. IGL_INLINE void slice_tets(
  40. const Eigen::MatrixBase<DerivedV>& V,
  41. const Eigen::MatrixBase<DerivedT>& T,
  42. const Eigen::MatrixBase<DerivedS> & S,
  43. Eigen::PlainObjectBase<DerivedSV>& SV,
  44. Eigen::PlainObjectBase<DerivedSF>& SF,
  45. Eigen::PlainObjectBase<DerivedJ>& J,
  46. Eigen::SparseMatrix<BCType> & BC);
  47. template <
  48. typename DerivedV,
  49. typename DerivedT,
  50. typename DerivedS,
  51. typename DerivedSV,
  52. typename DerivedSF,
  53. typename DerivedJ,
  54. typename DerivedsE,
  55. typename Derivedlambda
  56. >
  57. IGL_INLINE void slice_tets(
  58. const Eigen::MatrixBase<DerivedV>& V,
  59. const Eigen::MatrixBase<DerivedT>& T,
  60. const Eigen::MatrixBase<DerivedS> & S,
  61. Eigen::PlainObjectBase<DerivedSV>& SV,
  62. Eigen::PlainObjectBase<DerivedSF>& SF,
  63. Eigen::PlainObjectBase<DerivedJ>& J,
  64. Eigen::PlainObjectBase<DerivedsE>& sE,
  65. Eigen::PlainObjectBase<Derivedlambda>& lambda);
  66. }
  67. #ifndef IGL_STATIC_LIBRARY
  68. # include "slice_tets.cpp"
  69. #endif
  70. #endif