blue_noise.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2020 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_BLUE_NOISE_H
  9. #define IGL_BLUE_NOISE_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// "Fast Poisson Disk Sampling in Arbitrary Dimensions" [Bridson 2007].
  15. ///
  16. /// For very dense samplings this is faster than (up to 2x) cyCodeBase's
  17. /// implementation of "Sample Elimination for Generating Poisson Disk Sample
  18. /// Sets" [Yuksel 2015]. YMMV
  19. ///
  20. /// @param[in] V #V by dim list of mesh vertex positions
  21. /// @param[in] F #F by 3 list of mesh triangle indices into rows of V
  22. /// @param[in] r Poisson disk radius (evaluated according to Euclidean distance on V)
  23. /// @param[out] B #P by 3 list of barycentric coordinates, ith row are coordinates of
  24. /// ith sampled point in face FI(i)
  25. /// @param[out] FI #P list of indices into F
  26. /// @param[out] P #P by dim list of sample positions.
  27. /// \see random_points_on_mesh
  28. template <
  29. typename DerivedV,
  30. typename DerivedF,
  31. typename DerivedB,
  32. typename DerivedFI,
  33. typename DerivedP>
  34. IGL_INLINE void blue_noise(
  35. const Eigen::MatrixBase<DerivedV> & V,
  36. const Eigen::MatrixBase<DerivedF> & F,
  37. const typename DerivedV::Scalar r,
  38. Eigen::PlainObjectBase<DerivedB> & B,
  39. Eigen::PlainObjectBase<DerivedFI> & FI,
  40. Eigen::PlainObjectBase<DerivedP> & P);
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "blue_noise.cpp"
  44. #endif
  45. #endif