MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetAutoTangent

Function GetAutoTangent

trinity/Curves/Tr2CurveScalar.cpp:28–43  ·  view source on GitHub ↗

--------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

26
27// --------------------------------------------------------------------------------
28float GetAutoTangent( float prevTime, float prevValue, float time, float value, float nextTime, float nextValue )
29{
30 float left = 0;
31 if( time - prevTime > EPSILON )
32 {
33 left = ( value - prevValue ) / ( time - prevTime );
34 }
35 float right = 0;
36 if( nextTime - time > EPSILON )
37 {
38 right = ( nextValue - value ) / ( nextTime - time );
39 }
40
41 float x = ( time - prevTime ) / ( nextTime - prevTime );
42 return left * ( 1 - x ) + right * x;
43}
44
45// --------------------------------------------------------------------------------
46float GetAutoClamppedTangent( float prevTime, float prevValue, float time, float value, float nextTime, float nextValue )

Callers 2

OnKeysChangedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected