Files
LifeProject/LifeCore/math/Spline.h
T
2025-05-13 02:46:21 +03:00

22 lines
622 B
C++

#ifndef Spline_h__
#define Spline_h__
namespace LifeCore
{
template<typename T>
static inline T LinearBezier(float t, const T& v1, const T& v2)
{
return (v1 * (1-t)) + (v2 * t);
}
template<typename T>
static inline T QuadraticBezier(float t, const T& v1, const T& v2, const T& v3)
{
return (LinearBezier<T>(t, v1, v2) * (1 - t)) + (LinearBezier<T>(t, v2, v3) * (t));
}
template<typename T>
static inline T CubicBezier(float t, const T& v1, const T& v2, const T& v3, const T& v4)
{
return (QuadraticBezier<T>(t, v1, v2, v3) * (1 - t)) + (QuadraticBezier<T>(t, v2, v3, v4) * (t));
}
}
#endif // Spline_h__