fome-fw/firmware/controllers/core/interpolation.h

34 lines
1014 B
C
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file interpolation.h
*
* @date Oct 17, 2013
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2014-08-29 07:52:33 -07:00
*/
#ifndef INTERPOLATION_3D_H_
#define INTERPOLATION_3D_H_
2015-02-14 19:04:03 -08:00
#include "datalogging.h"
2014-11-24 10:04:56 -08:00
#define INTERPOLATION_A(x1, y1, x2, y2) ((y1 - y2) / (x1 - x2))
2014-12-15 17:03:49 -08:00
int findIndex(const float array[], int size, float value);
2015-02-13 12:04:38 -08:00
int findIndex2(const float array[], unsigned size, float value);
2014-08-29 07:52:33 -07:00
float interpolate(float x1, float y1, float x2, float y2, float x);
float interpolate2d(float value, float bin[], float values[], int size);
float interpolate3d(float x, float xBin[], int xBinSize, float y, float yBin[], int yBinSize, float* map[]);
void setTableValue(float bins[], float values[], int size, float key, float value);
2015-02-14 19:04:03 -08:00
void initInterpolation(Logging *sharedLogger);
2014-08-29 07:52:33 -07:00
class FastInterpolation {
public:
2015-02-10 05:05:46 -08:00
FastInterpolation();
2014-08-29 07:52:33 -07:00
FastInterpolation(float x1, float y1, float x2, float y2);
void init(float x1, float y1, float x2, float y2);
float getValue(float x);
private:
float a, b;
};
#endif /* INTERPOLATION_3D_H_ */