intrinsic_delaunay_triangulation.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2018 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_INTRINSIC_DELAUNAY_TRIANGULATION_H
  9. #define IGL_INTRINSIC_DELAUNAY_TRIANGULATION_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. /// INTRINSIC_DELAUNAY_TRIANGULATION Flip edges _intrinsically_ until all are
  16. /// "intrinsic Delaunay". See "An algorithm for the construction of intrinsic
  17. /// delaunay triangulations with applications to digital geometry processing"
  18. /// [Fisher et al. 2007].
  19. ///
  20. /// @param[in] l_in #F_in by 3 list of edge lengths (see edge_lengths)
  21. /// @param[in] F_in #F_in by 3 list of face indices into some unspecified vertex list V
  22. /// @param[out] l #F by 3 list of edge lengths
  23. /// @param[out] F #F by 3 list of new face indices. Note: Combinatorially F may contain
  24. /// non-manifold edges, duplicate faces and self-loops (e.g., an edge [1,1]
  25. /// or a face [1,1,1]). However, the *intrinsic geometry* is still
  26. /// well-defined and correct. See [Fisher et al. 2007] Figure 3 and 2nd to
  27. /// last paragraph of 1st page. Since F may be "non-eddge-manifold" in the
  28. /// usual combinatorial sense, it may be useful to call the more verbose
  29. /// overload below if disentangling edges will be necessary later on.
  30. /// Calling unique_edge_map on this F will give a _different_ result than
  31. /// those outputs.
  32. ///
  33. /// \see is_intrinsic_delaunay
  34. template <
  35. typename Derivedl_in,
  36. typename DerivedF_in,
  37. typename Derivedl,
  38. typename DerivedF>
  39. IGL_INLINE void intrinsic_delaunay_triangulation(
  40. const Eigen::MatrixBase<Derivedl_in> & l_in,
  41. const Eigen::MatrixBase<DerivedF_in> & F_in,
  42. Eigen::PlainObjectBase<Derivedl> & l,
  43. Eigen::PlainObjectBase<DerivedF> & F);
  44. /// \overload
  45. /// @param[out] E #F*3 by 2 list of all directed edges, such that E.row(f+#F*c) is the
  46. /// @param[out] edge opposite F(f,c)
  47. /// @param[out] uE #uE by 2 list of unique undirected edges
  48. /// @param[out] EMAP #F*3 list of indices into uE, mapping each directed edge to unique
  49. /// @param[out] undirected edge
  50. /// @param[out] uE2E #uE list of lists of indices into E of coexisting edges
  51. ///
  52. /// \see unique_edge_map
  53. template <
  54. typename Derivedl_in,
  55. typename DerivedF_in,
  56. typename Derivedl,
  57. typename DerivedF,
  58. typename DerivedE,
  59. typename DeriveduE,
  60. typename DerivedEMAP,
  61. typename uE2EType>
  62. IGL_INLINE void intrinsic_delaunay_triangulation(
  63. const Eigen::MatrixBase<Derivedl_in> & l_in,
  64. const Eigen::MatrixBase<DerivedF_in> & F_in,
  65. Eigen::PlainObjectBase<Derivedl> & l,
  66. Eigen::PlainObjectBase<DerivedF> & F,
  67. Eigen::PlainObjectBase<DerivedE> & E,
  68. Eigen::PlainObjectBase<DeriveduE> & uE,
  69. Eigen::PlainObjectBase<DerivedEMAP> & EMAP,
  70. std::vector<std::vector<uE2EType> > & uE2E);
  71. }
  72. #ifndef IGL_STATIC_LIBRARY
  73. # include "intrinsic_delaunay_triangulation.cpp"
  74. #endif
  75. #endif