add linear interpolation function
This commit is contained in:
@ -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)
|
||||||
{
|
{
|
||||||
|
2
utils.h
2
utils.h
@ -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;
|
||||||
|
Reference in New Issue
Block a user