add linear interpolation function

This commit is contained in:
Akos Horvath 2022-07-19 20:39:34 +02:00
parent b8e9ea816d
commit d4cc9853cf
2 changed files with 7 additions and 0 deletions

View File

@ -84,6 +84,11 @@ void init(uint32_t prec)
// mpfr::mpreal::set_default_prec(prec); // mpfr::mpreal::set_default_prec(prec);
} }
double Util::linear_interpolate(double v0, double v1, float t)
{
return (1 - t) * v0 + t * v1;
}
Vec2mp::Vec2mp(mpfr::mpreal x, mpfr::mpreal y) Vec2mp::Vec2mp(mpfr::mpreal x, mpfr::mpreal y)
: x(x), y(y) : x(x), y(y)
{ {

View File

@ -195,6 +195,8 @@ public:
void init(uint32_t prec); void init(uint32_t prec);
double linear_interpolate(double v0, double v1, float t);
class Vec2mp { class Vec2mp {
public: public:
mpfr::mpreal x; mpfr::mpreal x;