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

44 行
1.2 KiB

using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.physics {
public class ClampedSimulation : Simulation {
public ClampedSimulation(Simulation simulation,
double xMin = double.NegativeInfinity,
double xMax = double.PositiveInfinity,
double dxMin = double.NegativeInfinity,
double dxMax = double.PositiveInfinity
) {
D.assert(simulation != null);
D.assert(xMax >= xMin);
D.assert(dxMax >= dxMin);
this.simulation = simulation;
this.xMin = xMin;
this.dxMin = dxMin;
this.dxMax = dxMax;
}
public readonly Simulation simulation;
public readonly double xMin;
public readonly double xMax;
public readonly double dxMin;
public readonly double dxMax;
public override double x(double time) {
return this.simulation.x(time).clamp(this.xMin, this.xMax);
}
public override double dx(double time) {
return this.simulation.dx(time).clamp(this.dxMin, this.dxMax);
}
public override bool isDone(double time) {
return this.simulation.isDone(time);
}
}
}