all_pairs_distances.h 1.1 KB

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