Interpolation.h 478 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2022, Rodrigo Tobar <rtobarc@gmail.com>.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Span.h>
  8. #include <AK/Vector.h>
  9. namespace PDF {
  10. class LinearInterpolation1D {
  11. public:
  12. LinearInterpolation1D(float x_min, float x_max, float y_min, float y_max);
  13. float interpolate(float) const;
  14. void interpolate(Span<float> const& x, Span<float> y) const;
  15. private:
  16. float m_x_min;
  17. float m_y_min;
  18. float m_slope;
  19. };
  20. }