animationmgr: fixup stack-use-after-return

This commit is contained in:
Vaxry 2024-12-16 18:31:07 +00:00
parent e06b520427
commit b9f82e9968
3 changed files with 15 additions and 15 deletions

View file

@ -43,14 +43,14 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
ELAPSEDUS, ELAPSEDCALCAVG);
}
float CBezierCurve::getXForT(float const& t) {
float CBezierCurve::getXForT(float const& t) const {
float t2 = t * t;
float t3 = t2 * t;
return 3 * t * (1 - t) * (1 - t) * m_vPoints[1].x + 3 * t2 * (1 - t) * m_vPoints[2].x + t3 * m_vPoints[3].x;
}
float CBezierCurve::getYForT(float const& t) {
float CBezierCurve::getYForT(float const& t) const {
float t2 = t * t;
float t3 = t2 * t;
@ -58,7 +58,7 @@ float CBezierCurve::getYForT(float const& t) {
}
// Todo: this probably can be done better and faster
float CBezierCurve::getYForPoint(float const& x) {
float CBezierCurve::getYForPoint(float const& x) const {
if (x >= 1.f)
return 1.f;
if (x <= 0.f)

View file

@ -16,9 +16,9 @@ class CBezierCurve {
// this EXCLUDES the 0,0 and 1,1 points,
void setup(std::vector<Vector2D>* points);
float getYForT(float const& t);
float getXForT(float const& t);
float getYForPoint(float const& x);
float getYForT(float const& t) const;
float getXForT(float const& t) const;
float getYForPoint(float const& x) const;
private:
// this INCLUDES the 0,0 and 1,1 points.