13 #ifndef OGLPLUS_MATH_SLERP_1310291021_HPP
14 #define OGLPLUS_MATH_SLERP_1310291021_HPP
16 #include <oglplus/config/compiler.hpp>
27 template <
typename Value,
typename T>
40 Value _lerp(
T t)
const
42 return _v1*(
T(1)-t) + _v2*t;
45 Value _slerp(
T t)
const
47 return _v1*Sin((
T(1)-t)*_omega)*_inv_sin_omega+
48 _v2*Sin(t*_omega)*_inv_sin_omega;
64 , _inv_sin_omega(Sin(_omega))
67 if(_inv_sin_omega ==
T(0))
69 _func = &BaseSLERP::_first;
71 else if(std::abs(_inv_sin_omega) < eps)
73 _func = &BaseSLERP::_lerp;
77 _func = &BaseSLERP::_slerp;
78 _inv_sin_omega =
T(1)/_inv_sin_omega;
80 assert(_func !=
nullptr);
89 assert(_func !=
nullptr);
90 return (this->*_func)(param);
96 #endif // include guard
Class implementing planar angle-related functionality.
Definition: fwd.hpp:24
Angle< AngleValueType > ArcCos(AngleValueType x)
Creates a new angle using the arc cosine function.
Definition: angle.hpp:558
BaseSLERP(const Value &v1, const Value &v2, T eps)
Constructs a SLERP functor from two values.
Definition: slerp.hpp:57
Base template for spherical-linear interpolation functors.
Definition: slerp.hpp:28
Value operator()(T param) const
Interpolates between the values passed to constructor.
Definition: slerp.hpp:87