partition.h 932 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef IGL_PARTITION_H
  2. #define IGL_PARTITION_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Dense>
  5. namespace igl
  6. {
  7. // PARTITION partition vertices into groups based on each
  8. // vertex's vector: vertices with similar coordinates (close in
  9. // space) will be put in the same group.
  10. //
  11. // Inputs:
  12. // W #W by dim coordinate matrix
  13. // k desired number of groups default is dim
  14. // Output:
  15. // G #W list of group indices (1 to k) for each vertex, such that vertex i
  16. // is assigned to group G(i)
  17. // S k list of seed vertices
  18. // D #W list of squared distances for each vertex to it's corresponding
  19. // closest seed
  20. IGL_INLINE void partition(
  21. const Eigen::MatrixXd & W,
  22. const int k,
  23. Eigen::Matrix<int,Eigen::Dynamic,1> & G,
  24. Eigen::Matrix<int,Eigen::Dynamic,1> & S,
  25. Eigen::Matrix<double,Eigen::Dynamic,1> & D);
  26. }
  27. #ifdef IGL_HEADER_ONLY
  28. #include "partition.cpp"
  29. #endif
  30. #endif