intrinsic_delaunay_triangulation.h 3.1 KB

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