ramer_douglas_peucker.h 870 B

1234567891011121314151617181920212223242526
  1. #ifndef IGL_RAMER_DOUGLAS_PEUCKER_H
  2. #define IGL_RAMER_DOUGLAS_PEUCKER_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Ramer-Douglas-Peucker piecewise-linear curve simplification.
  8. //
  9. // Inputs:
  10. // P #P by dim ordered list of vertices along the curve
  11. // tol tolerance (maximal euclidean distance allowed between the new line
  12. // and a vertex)
  13. // Outputs:
  14. // S #S by dim ordered list of points along the curve
  15. // J #S list of indices into P so that S = P(J,:)
  16. template <typename DerivedP, typename DerivedS, typename DerivedJ>
  17. IGL_INLINE void ramer_douglas_peucker(
  18. const Eigen::MatrixBase<DerivedP> & P,
  19. const typename DerivedP::Scalar tol,
  20. Eigen::PlainObjectBase<DerivedS> & S,
  21. Eigen::PlainObjectBase<DerivedJ> & J);
  22. }
  23. #ifndef IGL_STATIC_LIBRARY
  24. # include "ramer_douglas_peucker.cpp"
  25. #endif
  26. #endif