Files
cocos4/native/cocos/core/geometry/Curve.cpp
T
minggo 5410a48a58 Implement more logic in native (#4131)
Co-authored-by: bofeng.song <bofeng.song@chukong-inc.com>
Co-authored-by: dumganhar <dumganhar@gmail.com>
Co-authored-by: mmyduckx <308303735@qq.com>
Co-authored-by: Patrice Jiang <397136899@qq.com>
Co-authored-by: 江战 <40414978+PatriceJiang@users.noreply.github.com>
2022-01-07 18:39:40 +08:00

15 lines
382 B
C++

#include "cocos/core/geometry/Curve.h"
#include <vector>
namespace cc {
namespace geometry {
float OptimizedKey::evaluate(float tt) {
const t = tt - time;
return evalOptCurve(t, coefficient);
}
float evalOptCurve(float t, const std::vector<float> &coefs) {
return (t * (t * (t * coefs[0] + coefs[1]) + coefs[2])) + coefs[3];
}
} // namespace geometry
} // namespace cc