triangulate.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_TRIANGULATE_H
  9. #define IGL_TRIANGULATE_H
  10. #include "igl_inline.h"
  11. #ifndef IGL_NO_EIGEN
  12. # include <Eigen/Core>
  13. #endif
  14. #include <vector>
  15. namespace igl
  16. {
  17. // Triangulate a general polygonal mesh into a triangle mesh.
  18. //
  19. // Inputs:
  20. // vF list of polygon index lists
  21. // Outputs:
  22. // F eigen int matrix #F by 3
  23. //
  24. // Example:
  25. // vector<vector<double > > vV;
  26. // vector<vector<int > > vF;
  27. // read("poly.obj",vV,vF);
  28. // MatrixXd V;
  29. // MatrixXi F;
  30. // list_to_matrix(vV,V);
  31. // triangulate(vF,F);
  32. template <typename Index, typename DerivedF>
  33. IGL_INLINE void triangulate(
  34. const std::vector<std::vector<Index> > & vF,
  35. Eigen::PlainObjectBase<DerivedF>& F);
  36. }
  37. #ifdef IGL_HEADER_ONLY
  38. # include "triangulate.cpp"
  39. #endif
  40. #endif