uniformly_sample_two_manifold.h 2.1 KB

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