all_pairs_distances.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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_ALL_PAIRS_DISTANCES_H
  9. #define IGL_ALL_PAIRS_DISTANCES_H
  10. #include "igl_inline.h"
  11. namespace igl
  12. {
  13. /// Compute distances between each point i in V and point j in U
  14. ///
  15. /// D = all_pairs_distances(V,U)
  16. ///
  17. /// @tparam matrix class like MatrixXd
  18. /// @param[in] V #V by dim list of points
  19. /// @param[in] U #U by dim list of points
  20. /// @param[in] squared whether to return squared distances
  21. /// @param[out] D #V by #U matrix of distances, where D(i,j) gives the distance or
  22. /// squareed distance between V(i,:) and U(j,:)
  23. template <typename Mat>
  24. IGL_INLINE void all_pairs_distances(
  25. const Mat & V,
  26. const Mat & U,
  27. const bool squared,
  28. Mat & D);
  29. }
  30. #ifndef IGL_STATIC_LIBRARY
  31. # include "all_pairs_distances.cpp"
  32. #endif
  33. #endif