您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

36 行
978 B

using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.physics {
public class GravitySimulation : Simulation {
public GravitySimulation(
double acceleration,
double distance,
double endDistance,
double velocity
) {
D.assert(endDistance >= 0);
this._a = acceleration;
this._x = distance;
this._v = velocity;
this._end = endDistance;
}
readonly double _x;
readonly double _v;
readonly double _a;
readonly double _end;
public override double x(double time) {
return this._x + this._v * time + 0.5 * this._a * time * time;
}
public override double dx(double time) {
return this._v + time * this._a;
}
public override bool isDone(double time) {
return this.x(time).abs() >= this._end;
}
}
}