polygon_mesh_to_triangle_mesh.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Daniele Panozzo <daniele.panozzo@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_POLYGON_MESH_TO_TRIANGLE_MESH_H
  9. #define IGL_POLYGON_MESH_TO_TRIANGLE_MESH_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_triangle_mesh("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 polygon_mesh_to_triangle_mesh(
  34. const std::vector<std::vector<Index> > & vF,
  35. Eigen::PlainObjectBase<DerivedF>& F);
  36. template <typename DerivedP, typename DerivedF>
  37. IGL_INLINE void polygon_mesh_to_triangle_mesh(
  38. const Eigen::PlainObjectBase<DerivedP>& P,
  39. Eigen::PlainObjectBase<DerivedF>& F);
  40. }
  41. #ifndef IGL_STATIC_LIBRARY
  42. # include "polygon_mesh_to_triangle_mesh.cpp"
  43. #endif
  44. #endif