Beispiel #1
0
 public static float ConstantAccelerationStart(float t, ConstantAccelerationLength info)
 {
     if (t <= 0)
     {
         return(0);
     }
     else if (t < info.AccelerationLength)
     {
         return(t * t * info.HalfAcceleration);
     }
     else if (t < 1)
     {
         return(t * info.SpeedLimit + info.LinearPartOffset);
     }
     else
     {
         return(1);
     }
 }
Beispiel #2
0
 public static float ConstantAccelerationStop(float t, ConstantAccelerationLength info)
 {
     if (t <= 0)
     {
         return(0);
     }
     else if (t < 1 - info.AccelerationLength)
     {
         return(t * info.SpeedLimit);
     }
     else if (t < 1)
     {
         t = 1 - t;
         return(1 - t * t * info.HalfAcceleration);
     }
     else
     {
         return(1);
     }
 }