polygon_mesh_to_triangle_mesh.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. }
  37. #ifndef IGL_STATIC_LIBRARY
  38. # include "polygon_mesh_to_triangle_mesh.cpp"
  39. #endif
  40. #endif