obj-c linear interpolation between two numbers

前端 未结 1 1759
我在风中等你
我在风中等你 2021-02-07 21:08

Just wondering if there are methods already implemented for handling linear interpolation between two numbers in foundation/something else that comes with Xcode? It\'s hardly an

相关标签:
1条回答
  • 2021-02-07 21:56

    No, but it's an easy one-liner:

    inline double lerp(double a, double b, double t)
    {
        return a + (b - a) * t;
    }
    
    inline float lerpf(float a, float b, float t)
    {
        return a + (b - a) * t;
    }
    
    0 讨论(0)
提交回复
热议问题