exploded_view.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2020 Alec Jacobson <[email protected]>
  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_EXPLODED_VIEW_H
  9. #define IGL_EXPLODED_VIEW_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Given a tet-mesh, create a trivial surface mesh (4 triangles per tet) with
  15. /// each tet scaled individually and translated outward from the mesh's
  16. /// centroid, creating an exploded-view visualization.
  17. ///
  18. /// @param[in] V #V by 3 list of tet mesh vertex positions
  19. /// @param[in] T #T by 4 list of tet mesh indices into rows of V
  20. /// @param[in] s amount to scale each tet indvidually, typically (0,1]
  21. /// @param[in] t amount to scale away from mesh's centroid, typically >=1
  22. /// @param[out] EV #T*4 by 3 list of output mesh vertex positions
  23. /// @param[out] EF #T*4 by 3 list of output triangle indices into rows of EV
  24. /// @param[out] I #EV list of indices into V revealing birth parent
  25. /// @param[out] J #EF list of indices into F revealing birth parent
  26. template <
  27. typename DerivedV,
  28. typename DerivedT,
  29. typename DerivedEV,
  30. typename DerivedEF,
  31. typename DerivedI,
  32. typename DerivedJ>
  33. IGL_INLINE void exploded_view(
  34. const Eigen::MatrixBase<DerivedV> & V,
  35. const Eigen::MatrixBase<DerivedT> & T,
  36. const typename DerivedV::Scalar s,
  37. const typename DerivedV::Scalar t,
  38. Eigen::PlainObjectBase<DerivedEV> & EV,
  39. Eigen::PlainObjectBase<DerivedEF> & EF,
  40. Eigen::PlainObjectBase<DerivedI> & I,
  41. Eigen::PlainObjectBase<DerivedJ> & J);
  42. }
  43. #ifndef IGL_STATIC_LIBRARY
  44. # include "exploded_view.cpp"
  45. #endif
  46. #endif