subdivide_segments.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 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_SUBDIVIDE_SEGMENTS_H
  9. #define IGL_COPYLEFT_CGAL_SUBDIVIDE_SEGMENTS_H
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <CGAL/Segment_2.h>
  13. #include <CGAL/Point_2.h>
  14. #include <vector>
  15. namespace igl
  16. {
  17. namespace copyleft
  18. {
  19. namespace cgal
  20. {
  21. /// Insert steiner points to subdivide a given set of line segments
  22. ///
  23. /// @param[in] V #V by 2 list of vertex positions
  24. /// @param[in] E #E by 2 list of segment indices into V
  25. /// @param[in] steiner #E list of lists of unsorted steiner points (including
  26. /// endpoints) along the #E original segments
  27. /// @param[out] VI #VI by 2 list of output vertex positions, copies of V are always
  28. /// the first #V vertices
  29. /// @param[out] EI #EI by 2 list of segment indices into V, #EI ≥ #E
  30. /// @param[out] J #EI list of indices into E revealing "parent segments"
  31. /// @param[out] IM #VI list of indices into VV of unique vertices.
  32. template <
  33. typename DerivedV,
  34. typename DerivedE,
  35. typename Kernel,
  36. typename DerivedVI,
  37. typename DerivedEI,
  38. typename DerivedJ,
  39. typename DerivedIM>
  40. IGL_INLINE void subdivide_segments(
  41. const Eigen::MatrixBase<DerivedV> & V,
  42. const Eigen::MatrixBase<DerivedE> & E,
  43. const std::vector<std::vector<CGAL::Point_2<Kernel> > > & steiner,
  44. Eigen::PlainObjectBase<DerivedVI> & VI,
  45. Eigen::PlainObjectBase<DerivedEI> & EI,
  46. Eigen::PlainObjectBase<DerivedJ> & J,
  47. Eigen::PlainObjectBase<DerivedIM> & IM);
  48. }
  49. }
  50. }
  51. #ifndef IGL_STATIC_LIBRARY
  52. # include "subdivide_segments.cpp"
  53. #endif
  54. #endif