intrinsic_delaunay_triangulation.h 3.0 KB

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