snap_points.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_SNAP_POINTS_H
  9. #define IGL_SNAP_POINTS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // SNAP_POINTS snap list of points C to closest of another list of points V
  15. //
  16. // [I,minD,VI] = snap_points(C,V)
  17. //
  18. // Inputs:
  19. // C #C by dim list of query point positions
  20. // V #V by dim list of data point positions
  21. // Outputs:
  22. // I #C list of indices into V of closest points to C
  23. // minD #C list of squared (^p) distances to closest points
  24. // VI #C by dim list of new point positions, VI = V(I,:)
  25. template <
  26. typename DerivedC,
  27. typename DerivedV,
  28. typename DerivedI,
  29. typename DerivedminD,
  30. typename DerivedVI>
  31. IGL_INLINE void snap_points(
  32. const Eigen::PlainObjectBase<DerivedC > & C,
  33. const Eigen::PlainObjectBase<DerivedV > & V,
  34. Eigen::PlainObjectBase<DerivedI > & I,
  35. Eigen::PlainObjectBase<DerivedminD > & minD,
  36. Eigen::PlainObjectBase<DerivedVI > & VI);
  37. template <
  38. typename DerivedC,
  39. typename DerivedV,
  40. typename DerivedI,
  41. typename DerivedminD>
  42. IGL_INLINE void snap_points(
  43. const Eigen::PlainObjectBase<DerivedC > & C,
  44. const Eigen::PlainObjectBase<DerivedV > & V,
  45. Eigen::PlainObjectBase<DerivedI > & I,
  46. Eigen::PlainObjectBase<DerivedminD > & minD);
  47. template <
  48. typename DerivedC,
  49. typename DerivedV,
  50. typename DerivedI >
  51. IGL_INLINE void snap_points(
  52. const Eigen::PlainObjectBase<DerivedC > & C,
  53. const Eigen::PlainObjectBase<DerivedV > & V,
  54. Eigen::PlainObjectBase<DerivedI > & I);
  55. }
  56. #ifndef IGL_STATIC_LIBRARY
  57. # include "snap_points.cpp"
  58. #endif
  59. #endif