| 926 | } |
| 927 | |
| 928 | float Hermite( |
| 929 | float v1, |
| 930 | float r, |
| 931 | float v2, |
| 932 | float l, |
| 933 | float t, |
| 934 | float dt ) |
| 935 | { |
| 936 | // minimize number of math operations for max speed: |
| 937 | float _1_T = 1.0f / dt; |
| 938 | float _1_T2 = _1_T * _1_T; |
| 939 | float t2 = t * t; |
| 940 | float t2_T = t2 * _1_T; |
| 941 | float t3_T2 = t2 * t * _1_T2; |
| 942 | float _2t3_T3 = 2.0f * t3_T2 * _1_T; |
| 943 | float _3t2_T2 = 3.0f * t2 * _1_T2; |
| 944 | |
| 945 | return ( v1 * ( _2t3_T3 - _3t2_T2 + 1.0f ) + |
| 946 | v2 * ( -_2t3_T3 + _3t2_T2 ) + |
| 947 | r * ( t3_T2 - t2_T - t2_T + t ) + |
| 948 | l * ( t3_T2 - t2_T ) ); |
| 949 | } |
| 950 | |
| 951 | float TriLinearize( float min, float max, float v ) |
| 952 | { |