本文整理汇总了C#中Orbit.NextApoapsisTime方法的典型用法代码示例。如果您正苦于以下问题:C# Orbit.NextApoapsisTime方法的具体用法?C# Orbit.NextApoapsisTime怎么用?C# Orbit.NextApoapsisTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orbit
的用法示例。
在下文中一共展示了Orbit.NextApoapsisTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawNextAp
private void DrawNextAp(Orbit o, CelestialBody referenceBody, double referenceTime, Color iconColor, Matrix4x4 screenTransform)
{
if (o.eccentricity >= 1.0) {
// Early return: There is no apoapsis on a hyperbolic orbit
return;
}
double nextApTime = o.NextApoapsisTime(referenceTime);
if (nextApTime < o.EndUT || (o.patchEndTransition == Orbit.PatchTransitionType.FINAL)) {
Vector3d relativePosition = o.SwappedRelativePositionAtUT(nextApTime) + o.referenceBody.getTruePositionAtUT(nextApTime) - referenceBody.getTruePositionAtUT(nextApTime);
var transformedPosition = screenTransform.MultiplyPoint3x4(relativePosition);
DrawIcon(transformedPosition.x, transformedPosition.y, VesselType.Unknown, iconColor, MapIcons.OtherIcon.AP);
}
}
示例2: ComputeManeuverTime
public double ComputeManeuverTime(Orbit o, double UT, MechJebModuleTargetController target)
{
switch (allowedTimeRef[currentTimeRef])
{
case TimeReference.X_FROM_NOW:
UT += leadTime.val;
break;
case TimeReference.APOAPSIS:
if (o.eccentricity < 1)
{
UT = o.NextApoapsisTime(UT);
}
else
{
throw new OperationException("Warning: orbit is hyperbolic, so apoapsis doesn't exist.");
}
break;
case TimeReference.PERIAPSIS:
UT = o.NextPeriapsisTime(UT);
break;
case TimeReference.CLOSEST_APPROACH:
if (target.NormalTargetExists)
{
UT = o.NextClosestApproachTime(target.TargetOrbit, UT);
}
else
{
throw new OperationException("Warning: no target selected.");
}
break;
case TimeReference.ALTITUDE:
if (circularizeAltitude > o.PeA && (circularizeAltitude < o.ApA || o.eccentricity >= 1))
{
UT = o.NextTimeOfRadius(UT, o.referenceBody.Radius + circularizeAltitude);
}
else
{
throw new OperationException("Warning: can't circularize at this altitude, since current orbit does not reach it.");
}
break;
case TimeReference.EQ_ASCENDING:
if (o.AscendingNodeEquatorialExists())
{
UT = o.TimeOfAscendingNodeEquatorial(UT);
}
else
{
throw new OperationException("Warning: equatorial ascending node doesn't exist.");
}
break;
case TimeReference.EQ_DESCENDING:
if (o.DescendingNodeEquatorialExists())
{
UT = o.TimeOfDescendingNodeEquatorial(UT);
}
else
{
throw new OperationException("Warning: equatorial descending node doesn't exist.");
}
break;
case TimeReference.EQ_NEAREST_AD:
if(o.AscendingNodeEquatorialExists())
{
UT = o.DescendingNodeEquatorialExists()
? System.Math.Min(o.TimeOfAscendingNodeEquatorial(UT), o.TimeOfDescendingNodeEquatorial(UT))
: o.TimeOfAscendingNodeEquatorial(UT);
}
else if(o.DescendingNodeEquatorialExists())
{
UT = o.TimeOfDescendingNodeEquatorial(UT);
}
else
{
throw new OperationException("Warning: neither ascending nor descending node exists.");
}
break;
case TimeReference.EQ_HIGHEST_AD:
if(o.AscendingNodeEquatorialExists())
{
if(o.DescendingNodeEquatorialExists())
{
var anTime = o.TimeOfAscendingNodeEquatorial(UT);
var dnTime = o.TimeOfDescendingNodeEquatorial(UT);
UT = o.getOrbitalVelocityAtUT(anTime).magnitude <= o.getOrbitalVelocityAtUT(dnTime).magnitude
? anTime
: dnTime;
}
else
{
UT = o.TimeOfAscendingNodeEquatorial(UT);
}
}
//.........这里部分代码省略.........