complex_to_mesh.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 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_COPYLEFT_CGAL_COMPLEX_TO_MESH_H
  9. #define IGL_COPYLEFT_CGAL_COMPLEX_TO_MESH_H
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <CGAL/Complex_2_in_triangulation_3.h>
  13. namespace igl
  14. {
  15. namespace copyleft
  16. {
  17. namespace cgal
  18. {
  19. /// Convert a CGAL::Complex_2_in_triangulation_3 to a mesh (V,F)
  20. ///
  21. /// @tparam Tr CGAL triangulation type, e.g. CGAL::Surface_mesh_default_triangulation_3
  22. /// @param[in] c2t3 2-complex (surface) living in a 3d triangulation
  23. /// (e.g. result of CGAL::make_surface_mesh)
  24. /// @param[out] V #V by 3 list of vertex positions
  25. /// @param[out] F #F by 3 list of triangle indices
  26. /// @return true iff conversion was successful, failure can ok if CGAL code
  27. /// can't figure out ordering.
  28. ///
  29. template <typename Tr, typename DerivedV, typename DerivedF>
  30. IGL_INLINE bool complex_to_mesh(
  31. const CGAL::Complex_2_in_triangulation_3<Tr> & c2t3,
  32. Eigen::PlainObjectBase<DerivedV> & V,
  33. Eigen::PlainObjectBase<DerivedF> & F);
  34. }
  35. }
  36. }
  37. #ifndef IGL_STATIC_LIBRARY
  38. # include "complex_to_mesh.cpp"
  39. #endif
  40. #endif