public static void EvaluateVectors(State state, float t, float dt, Derivative d) { State temp; temp.Position = state.Position + d.dVelocity * dt; temp.Velocity = state.Velocity + d.dAcceleration * dt; Derivative output; output.dVelocity = state.Velocity; output.dAcceleration = Acceleration(temp, t+dt); }
public static Vector2 Acceleration(State state, float t) { float k = 10; float b = 1; return -k * state.Position - b * state.Velocity; }