本文整理汇总了C#中Orbit.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Orbit.Clone方法的具体用法?C# Orbit.Clone怎么用?C# Orbit.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orbit
的用法示例。
在下文中一共展示了Orbit.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Propagate
// Constructor & calculate
public void Propagate(Navigator navigator, Orbit orbit0, double UT0, double UTf, double dT, Control control, double m0in)
{
// Control parameters
var throttle = control.throttle;
var sailon = control.sailon;
var frame = control.frame;
// Update segment initial mass
m0 = m0in;
// Working orbit at each time step
Orbit orbit = orbit0.Clone();
// Number of time steps
int nsteps = Convert.ToInt32(Math.Ceiling((UTf - UT0) / dT));
// Last time step size
double dTlast = (UTf - UT0) % dT;
// Current universal time
double UT;
// Current mass
double m0i = m0;
// Reseting time step to sample orbits for saving
double dTchoose = 0.0;
// List of orbits to preview
orbits = new List<Orbit>();
// Add initial orbit
orbits.Add(orbit0.Clone());
// Iterate for nsteps
for (int i = 0; i < nsteps; i++) {
// Last step goes to UTf
if (i == nsteps - 1) {
dT = dTlast;
UT = UTf;
} else {
UT = UT0 + i * dT;
}
// Spacecraft reference frame
Quaternion sailFrame = frame.qfn(orbit, UT, control.angles);
// Total deltaV vector
Vector3d deltaVV = new Vector3d(0.0, 0.0, 0.0);
// Accumulated mass change for all engines
double dms = 0.0;
// Iterate over engines
foreach (var pe in navigator.persistentEngines) {
// Only count thrust of engines that are not shut down in preview
if (pe.engine.getIgnitionState) {
// Thrust unit vector
Vector3d thrustUV = sailFrame * new Vector3d(0.0, 1.0, 0.0);
// Isp: Currently vacuum. TODO: calculate at current air pressure
float isp = pe.engine.atmosphereCurve.Evaluate(0);
// Thrust vector
float thrust = throttle * pe.engine.maxThrust;
// Calculate deltaV vector
double demandMass;
deltaVV += pe.CalculateDeltaVV(m0i, dT, thrust, isp, thrustUV, out demandMass);
// Update mass usage
dms += demandMass * pe.densityAverage;
}
}
// Iterate over sails
if (sailon) {
foreach (var s in navigator.solarSails) {
// Check if sail in sun
double sunlightFactor = 1.0;
if (!SolarSailPart.inSun(orbit, UT)) {
sunlightFactor = 0.0;
}
// Normal vector
Vector3d n = sailFrame * new Vector3d(0.0, 1.0, 0.0);
// Force on sail
Vector3d solarForce = SolarSailPart.CalculateSolarForce(s, orbit, n, UT) * sunlightFactor;
// Sail acceleration
Vector3d solarAccel = solarForce / m0i / 1000.0;
// Update deltaVV
deltaVV += solarAccel * dT;
//.........这里部分代码省略.........