snap_points.h 1.9 KB

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