orient_outward.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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_ORIENT_OUTWARD_H
  9. #define IGL_ORIENT_OUTWARD_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Orient each component (identified by C) of a mesh (V,F) so the normals on
  15. /// average point away from the patch's centroid.
  16. ///
  17. /// @param[in] V #V by 3 list of vertex positions
  18. /// @param[in] F #F by 3 list of triangle indices
  19. /// @param[in] C #F list of components (output of orientable_patches)
  20. /// @param[out] FF #F by 3 list of new triangle indices such that FF(~I,:) = F(~I,:) and
  21. /// FF(I,:) = fliplr(F(I,:)) (OK if &FF = &F)
  22. /// @param[out] I max(C)+1 list of whether face has been flipped
  23. ///
  24. /// \see orientable_patches, reorient_facets_raycast
  25. template <
  26. typename DerivedV,
  27. typename DerivedF,
  28. typename DerivedC,
  29. typename DerivedFF,
  30. typename DerivedI>
  31. IGL_INLINE void orient_outward(
  32. const Eigen::MatrixBase<DerivedV> & V,
  33. const Eigen::MatrixBase<DerivedF> & F,
  34. const Eigen::MatrixBase<DerivedC> & C,
  35. Eigen::PlainObjectBase<DerivedFF> & FF,
  36. Eigen::PlainObjectBase<DerivedI> & I);
  37. };
  38. #ifndef IGL_STATIC_LIBRARY
  39. # include "orient_outward.cpp"
  40. #endif
  41. #endif