orient_outward.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_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. // Inputs:
  18. // V #V by 3 list of vertex positions
  19. // F #F by 3 list of triangle indices
  20. // C #F list of components (output of orientable_patches)
  21. // Outputs:
  22. // FF #F by 3 list of new triangle indices such that FF(~I,:) = F(~I,:) and
  23. // FF(I,:) = fliplr(F(I,:)) (OK if &FF = &F)
  24. // I max(C)+1 list of whether face has been flipped
  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::PlainObjectBase<DerivedV> & V,
  33. const Eigen::PlainObjectBase<DerivedF> & F,
  34. const Eigen::PlainObjectBase<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