is_delaunay.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_IS_DELAUNAY_H
  9. #define IGL_IS_DELAUNAY_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. // IS_DELAUNAY Determine if each edge in the mesh (V,F) is Delaunay.
  16. //
  17. // Inputs:
  18. // V #V by dim list of vertex positions
  19. // F #F by 3 list of triangles indices
  20. // Outputs:
  21. // D #F by 3 list of bools revealing whether edges corresponding 23 31 12
  22. // are locally Delaunay. Boundary edges are by definition Delaunay.
  23. // Non-Manifold edges are by definition not Delaunay.
  24. template <
  25. typename DerivedV,
  26. typename DerivedF,
  27. typename DerivedD>
  28. IGL_INLINE void is_delaunay(
  29. const Eigen::MatrixBase<DerivedV> & V,
  30. const Eigen::MatrixBase<DerivedF> & F,
  31. Eigen::PlainObjectBase<DerivedD> & D);
  32. // Determine whether a single edge is Delaunay using a provided (extrinsic) incirle
  33. // test.
  34. //
  35. // Inputs:
  36. // V #V by dim list of vertex positions
  37. // F #F by 3 list of triangles indices
  38. // uE2E #uE list of lists of indices into E of coexisting edges (see
  39. // unique_edge_map)
  40. // incircle A functor such that incircle(pa, pb, pc, pd) returns
  41. // 1 if pd is on the positive size of circumcirle of (pa,pb,pc)
  42. // -1 if pd is on the positive size of circumcirle of (pa,pb,pc)
  43. // 0 if pd is cocircular with pa, pb, pc.
  44. // (see delaunay_triangulation)
  45. // uei index into uE2E of edge to check
  46. // Returns true iff edge is Delaunay
  47. template <
  48. typename DerivedV,
  49. typename DerivedF,
  50. typename uE2EType,
  51. typename InCircle,
  52. typename ueiType>
  53. IGL_INLINE bool is_delaunay(
  54. const Eigen::MatrixBase<DerivedV> & V,
  55. const Eigen::MatrixBase<DerivedF> & F,
  56. const std::vector<std::vector<uE2EType> > & uE2E,
  57. const InCircle incircle,
  58. const ueiType uei);
  59. }
  60. #ifndef IGL_STATIC_LIBRARY
  61. #include "is_delaunay.cpp"
  62. #endif
  63. #endif