本文整理汇总了C#中Orbit.RadiusAtTrueAnomaly方法的典型用法代码示例。如果您正苦于以下问题:C# Orbit.RadiusAtTrueAnomaly方法的具体用法?C# Orbit.RadiusAtTrueAnomaly怎么用?C# Orbit.RadiusAtTrueAnomaly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orbit
的用法示例。
在下文中一共展示了Orbit.RadiusAtTrueAnomaly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeltaVAndApsisPhaseAngleOfHohmannTransfer
//Computes the dV of a Hohmann transfer burn at time UT that will put the apoapsis or periapsis
//of the transfer orbit on top of the target orbit.
//The output value apsisPhaseAngle is the phase angle between the transferring vessel and the
//target object as the transferring vessel crosses the target orbit at the apoapsis or periapsis
//of the transfer orbit.
//Actually, it's not exactly the phase angle. It's a sort of mean anomaly phase angle. The
//difference is not important for how this function is used by DeltaVAndTimeForHohmannTransfer.
private static Vector3d DeltaVAndApsisPhaseAngleOfHohmannTransfer(Orbit o, Orbit target, double UT, out double apsisPhaseAngle)
{
Vector3d apsisDirection = -o.SwappedRelativePositionAtUT(UT);
double desiredApsis = target.RadiusAtTrueAnomaly(MathExtensions.Deg2Rad * target.TrueAnomalyFromVector(apsisDirection));
Vector3d dV;
if (desiredApsis > o.ApR)
{
dV = DeltaVToChangeApoapsis(o, UT, desiredApsis);
Orbit transferOrbit = o.PerturbedOrbit(UT, dV);
double transferApTime = transferOrbit.NextApoapsisTime(UT);
Vector3d transferApDirection = transferOrbit.SwappedRelativePositionAtApoapsis(); // getRelativePositionAtUT was returning NaNs! :(((((
double targetTrueAnomaly = target.TrueAnomalyFromVector(transferApDirection);
double meanAnomalyOffset = 360 * (target.TimeOfTrueAnomaly(targetTrueAnomaly, UT) - transferApTime) / target.period;
apsisPhaseAngle = meanAnomalyOffset;
}
else
{
dV = DeltaVToChangePeriapsis(o, UT, desiredApsis);
Orbit transferOrbit = o.PerturbedOrbit(UT, dV);
double transferPeTime = transferOrbit.NextPeriapsisTime(UT);
Vector3d transferPeDirection = transferOrbit.SwappedRelativePositionAtPeriapsis(); // getRelativePositionAtUT was returning NaNs! :(((((
double targetTrueAnomaly = target.TrueAnomalyFromVector(transferPeDirection);
double meanAnomalyOffset = 360 * (target.TimeOfTrueAnomaly(targetTrueAnomaly, UT) - transferPeTime) / target.period;
apsisPhaseAngle = meanAnomalyOffset;
}
apsisPhaseAngle = MuUtils.ClampDegrees180(apsisPhaseAngle);
return dV;
}
示例2: DeltaVAndTimeForHohmannTransfer
//Computes the time and dV of a Hohmann transfer injection burn such that at apoapsis the transfer
//orbit passes as close as possible to the target.
//The output burnUT will be the first transfer window found after the given UT.
//Assumes o and target are in approximately the same plane, and orbiting in the same direction.
//Also assumes that o is a perfectly circular orbit (though result should be OK for small eccentricity).
public static Vector3d DeltaVAndTimeForHohmannTransfer(Orbit o, Orbit target, double UT, out double burnUT)
{
double synodicPeriod = o.SynodicPeriod(target);
Vector3d burnDV = Vector3d.zero;
burnUT = UT;
double bestApproachDistance = Double.MaxValue;
double minTime = UT;
double maxTime = UT + 1.1 * synodicPeriod;
int numDivisions = 20;
for (int iter = 0; iter < 8; iter++)
{
double dt = (maxTime - minTime) / numDivisions;
for (int i = 0; i < numDivisions; i++)
{
double t = minTime + i * dt;
Vector3d apsisDirection = -o.SwappedRelativePositionAtUT(t);
double desiredApsis = target.RadiusAtTrueAnomaly(target.TrueAnomalyFromVector(apsisDirection));
double approachDistance;
Vector3d burn;
if (desiredApsis > o.ApR)
{
burn = DeltaVToChangeApoapsis(o, t, desiredApsis);
Orbit transferOrbit = o.PerturbedOrbit(t, burn);
approachDistance = transferOrbit.Separation(target, transferOrbit.NextApoapsisTime(t));
}
else
{
burn = DeltaVToChangePeriapsis(o, t, desiredApsis);
Orbit transferOrbit = o.PerturbedOrbit(t, burn);
approachDistance = transferOrbit.Separation(target, transferOrbit.NextPeriapsisTime(t));
}
if (approachDistance < bestApproachDistance)
{
bestApproachDistance = approachDistance;
burnUT = t;
burnDV = burn;
}
}
minTime = MuUtils.Clamp(burnUT - dt, UT, UT + synodicPeriod);
maxTime = MuUtils.Clamp(burnUT + dt, UT, UT + synodicPeriod);
}
return burnDV;
}
示例3: PrepData
// Gather and prepare data needed for rendering this frame.
protected void PrepData(Orbit orbit, Rectangle rect)
{
// Get the color of the body being orbited
if(!body_colors.TryGetValue(orbit.referenceBody.GetName(), out body_color)){
body_colors.TryGetValue("Default", out body_color);
}
if (rect.Width != 0 && rect.Height != 0)
{
width = rect.Width;
height = rect.Height;
xoff = rect.X;
yoff = rect.Y;
}
else
{
width = dev.width;
height = dev.height;
xoff = 0;
yoff = 0;
}
// Orbit info
ApR = orbit.ApR;
PeR = orbit.PeR;
ApA = orbit.ApA;
PeA = orbit.PeA;
// Calc the diameter of the reference body and the diameter of its atmosphere
dia = orbit.referenceBody.Radius * 2;
atmos_dia = dia + (orbit.referenceBody.maxAtmosphereAltitude * 2);
semi_major_axis = orbit.semiMajorAxis;
semi_minor_axis = orbit.semiMinorAxis;
eccentricity = orbit.eccentricity;
r = orbit.RadiusAtTrueAnomaly(orbit.trueAnomaly);
a = orbit.trueAnomaly;//(360.0 - orbit.trueAnomaly) + 90.0;
}