TransitionDynamics::dynamicsShape definitions
The user guide should contain more explanation on how calculate values for TransitionDynamics. Here I have summarized (after derivation) some formulas to be used. The "step" shape is not considered since it is an instantaneous change.
When dynamicsDimension == “time” OR dynamicsDimension == “distance”:
Independent dimension -> X(time or distance)
Dependent dimension -> Y
Initial state -> i
Final state -> f
value -> V = Xf - Xi
Yi = Y(Xi)
Yf = Y(Xf)
Rate of change at initial state -> (dY/dX)i = initRate (Propose to use "initRate" attribute when dynamicsShape == "cubic")
Rate of change at final state -> (dY/dX)f = 0
-
Case: dynamicsShape == “linear”
Y = A(X - Xi) + B
Where
B = Yi
A=((Yf - Yi))/V
-
Case: dynamicsShape == “sinusoidal”
V = Xf - Xi = value
Y = A.sin(B(X - Xi)) + C
dY/dX = A.B.cos(B(X - Xi))
Where
C = Yi
B = ((2n-1)π)/2V ∀nϵZ^+
A = (Yf - Yi)/sin(((2n-1)π)/2)
It should be noted that these values also define the initial rate of change of Y.
(dY/dX)i = ((Yf - Yi)/sin(((2n-1)π)/2) )(((2n-1)π)/2V).cos((((2n-1)π)/2V)(X - Xi))
-
Case: dynamicsShape == ”cubic”
Y = A(X - Xi)3 + B(X - Xi)2 + C(X - Xi) + D
dY/dX = 3A(X - Xi)2 + 2B(X - Xi) + C
Where
D = Yi
C = (dY/dX)i
B = (Yf - Yi - (2V/3).(dY/dX)i)/(V2/3)
A = (Yf - Yi - (V/2).(dY/dX)i)/(-V3/2)
As it can be seen, cubic needs an additional parameter (initial rate of change (dY/dX)i) to be completely defined.
When dynamicsDimension == “rate”:
The rate implies the rate of change w.r.t to time (t).
value -> V = dY/dt
Independent dimension -> t
Dependent dimension -> Y
Initial state -> i
Final state -> f
Since only rate is given, time at final state can be calculated for each dynamicsShape.
-
Case: dynamicsShape == “linear”
The rate is constant with time.
V = value = (dY/dt)
Y = Yi + V(t - ti)
-
Case: dynamicsShape == “sinusoidal”
The rate is at the point of inflexion. Initial and final rates are assumed to be zero.
Y = A.sin(B(t - ti)) + C
dY/dt = A.B.cos(B(t - ti))
where
tf = ti + π(Yf - Yi)/(V.2.sqrt(2))
C = Yi
B = π/(2(tf - ti))
A = Yf - Yi
-
Case: dynamicsShape == “cubic”
The rate is at the point of inflexion. Initial and final rates are assumed to be zero.
Y = A(t - ti)3 + B(t - ti)2 + C(t - ti) + D
dY/dt = 3A(t - ti)2 + 2B(t - ti) + C
Where
tf = ti + (Yf - Yi)/(2V/3)
D = Yi
C = (dY/dt)i = 0
B = 2V/(tf - ti)
A = -4V/3(tf - ti)2
These equations could be prone to error since they were derived manually, hence, re-checking is necessary.