uniformly_sample_two_manifold.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_UNIFORMLY_SAMPLE_TWO_MANIFOLD_H
  9. #define IGL_UNIFORMLY_SAMPLE_TWO_MANIFOLD_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. /// Attempt to sample a mesh uniformly with k-points by furthest point
  15. /// relaxation as described in "Fast Automatic Skinning Transformations"
  16. /// [Jacobson et al. 12] Section 3.3. The input is not expected to be a typical
  17. /// 3D triangle mesh (e.g., [V,F]), instead each vertex is embedded in a high
  18. /// dimensional unit-hypercude ("weight space") defined by W, with triangles
  19. /// given by F. This algorithm will first conduct furthest point sampling from
  20. /// the set of vertices and then attempt to relax the sampled points along the
  21. /// surface of the high-dimensional triangle mesh (i.e., the output points may
  22. /// be in the middle of triangles, not just at vertices). An additional "push"
  23. /// factor will repel samples away from the corners of the hypercube.
  24. ///
  25. /// @param[in] W #W by dim positions of mesh in weight space
  26. /// @param[in] F #F by 3 indices of triangles
  27. /// @param[in] k number of samples
  28. /// @param[in] push factor by which corners should be pushed away
  29. /// @param[out] WS k by dim locations in weight space
  30. ///
  31. /// \see random_points_on_mesh
  32. ///
  33. IGL_INLINE void uniformly_sample_two_manifold(
  34. const Eigen::MatrixXd & W,
  35. const Eigen::MatrixXi & F,
  36. const int k,
  37. const double push,
  38. Eigen::MatrixXd & WS);
  39. /// \overload
  40. ///
  41. /// \fileinfo
  42. IGL_INLINE void uniformly_sample_two_manifold_at_vertices(
  43. const Eigen::MatrixXd & W,
  44. const int k,
  45. const double push,
  46. Eigen::VectorXi & S);
  47. }
  48. #ifndef IGL_STATIC_LIBRARY
  49. # include "uniformly_sample_two_manifold.cpp"
  50. #endif
  51. #endif