snap_points.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. }
  48. #ifndef IGL_STATIC_LIBRARY
  49. # include "snap_points.cpp"
  50. #endif
  51. #endif