bezier.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef BEZIER_H
  2. #define BEZIER_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <vector>
  6. namespace igl
  7. {
  8. /// Evaluate a polynomial Bezier Curve at single parameter value.
  9. ///
  10. /// @param[in] V #V by dim list of Bezier control points
  11. /// @param[in] t evaluation parameter within [0,1]
  12. /// @param[out] P 1 by dim output point
  13. template <typename DerivedV, typename DerivedP>
  14. IGL_INLINE void bezier(
  15. const Eigen::MatrixBase<DerivedV> & V,
  16. const typename DerivedV::Scalar t,
  17. Eigen::PlainObjectBase<DerivedP> & P);
  18. /// Evaluate a polynomial Bezier Curve at many parameter values.
  19. ///
  20. /// @param[in] V #V by dim list of Bezier control points
  21. /// @param[in] T #T evaluation parameters within [0,1]
  22. /// @param[out] P #T by dim output points
  23. template <typename DerivedV, typename DerivedT, typename DerivedP>
  24. IGL_INLINE void bezier(
  25. const Eigen::MatrixBase<DerivedV> & V,
  26. const Eigen::MatrixBase<DerivedT> & T,
  27. Eigen::PlainObjectBase<DerivedP> & P);
  28. /// Evaluate a polynomial Bezier spline with a fixed parameter set for each
  29. /// sub-curve.
  30. ///
  31. /// @tparam VMat type of matrix of each list of control points
  32. /// @tparam DerivedT Derived type of evaluation parameters
  33. /// @tparam DerivedP Derived type of output points
  34. /// @param[in] spline #curves list of lists of Bezier control points
  35. /// @param[in] T #T evaluation parameters within [0,1] to use for each spline
  36. /// @param[out] P #curves*#T by dim output points
  37. template <typename VMat, typename DerivedT, typename DerivedP>
  38. IGL_INLINE void bezier(
  39. const std::vector<VMat> & spline,
  40. const Eigen::MatrixBase<DerivedT> & T,
  41. Eigen::PlainObjectBase<DerivedP> & P);
  42. }
  43. #ifndef IGL_STATIC_LIBRARY
  44. # include "bezier.cpp"
  45. #endif
  46. #endif