sort_triangles.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_SORT_TRIANGLES_H
  9. #define IGL_SORT_TRIANGLES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Sort triangles by depth (from back to front) using a painter's algorithm.
  15. ///
  16. /// @param[in] V #V by **4** list of homogeneous vertex positions
  17. /// @param[in] F #F by 3 list of triangle indices
  18. /// @param[in] MV 4 by 4 model view matrix
  19. /// @param[in] P 4 by 4 projection matrix
  20. /// @param[out] FF #F by 3 list of sorted triangles indices
  21. /// @param[out] I #F list of sorted indices
  22. template <
  23. typename DerivedV,
  24. typename DerivedF,
  25. typename DerivedMV,
  26. typename DerivedP,
  27. typename DerivedFF,
  28. typename DerivedI>
  29. IGL_INLINE void sort_triangles(
  30. const Eigen::MatrixBase<DerivedV> & V,
  31. const Eigen::MatrixBase<DerivedF> & F,
  32. const Eigen::MatrixBase<DerivedMV> & MV,
  33. const Eigen::MatrixBase<DerivedP> & P,
  34. Eigen::PlainObjectBase<DerivedFF> & FF,
  35. Eigen::PlainObjectBase<DerivedI> & I);
  36. }
  37. #ifndef IGL_STATIC_LIBRARY
  38. # include "sort_triangles.cpp"
  39. #endif
  40. #endif