partition.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 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_PARTITION_H
  9. #define IGL_PARTITION_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. /// Partition vertices into groups based on each vertex's vector: vertices
  15. /// with similar coordinates (close in space) will be put in the same group.
  16. ///
  17. /// @param[in] W #W by dim coordinate matrix
  18. /// @param[in] k desired number of groups default is dim
  19. /// @param[out] G #W list of group indices (1 to k) for each vertex, such that vertex i
  20. /// is assigned to group G(i)
  21. /// @param[out] S k list of seed vertices
  22. /// @param[out] D #W list of squared distances for each vertex to it's corresponding
  23. /// closest seed
  24. IGL_INLINE void partition(
  25. const Eigen::MatrixXd & W,
  26. const int k,
  27. Eigen::Matrix<int,Eigen::Dynamic,1> & G,
  28. Eigen::Matrix<int,Eigen::Dynamic,1> & S,
  29. Eigen::Matrix<double,Eigen::Dynamic,1> & D);
  30. }
  31. #ifndef IGL_STATIC_LIBRARY
  32. #include "partition.cpp"
  33. #endif
  34. #endif