本文整理汇总了C#中Orbit.NextPeriapsisTime方法的典型用法代码示例。如果您正苦于以下问题:C# Orbit.NextPeriapsisTime方法的具体用法?C# Orbit.NextPeriapsisTime怎么用?C# Orbit.NextPeriapsisTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orbit
的用法示例。
在下文中一共展示了Orbit.NextPeriapsisTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawNextPe
private void DrawNextPe(Orbit o, CelestialBody referenceBody, double referenceTime, Color iconColor, Matrix4x4 screenTransform)
{
/*
switch (o.patchEndTransition)
{
case Orbit.PatchTransitionType.ENCOUNTER:
Debug.Log("ENCOUNTER patch end type");
break;
case Orbit.PatchTransitionType.ESCAPE:
Debug.Log("ESCAPE patch end type");
break;
// FINAL is applied to the active vessel in a stable elliptical
// orbit.
case Orbit.PatchTransitionType.FINAL:
Debug.Log("FINAL patch end type");
break;
// INITIAL patchEndTransition appears to be applied to inactive
// vessels (targeted vessels).
case Orbit.PatchTransitionType.INITIAL:
Debug.Log("INITIAL patch end type");
break;
case Orbit.PatchTransitionType.MANEUVER:
Debug.Log("MANEUVER patch end type");
break;
}
*/
double nextPeTime = o.NextPeriapsisTime(referenceTime);
if (nextPeTime < o.EndUT || (o.patchEndTransition == Orbit.PatchTransitionType.FINAL)) {
Vector3d relativePosition = o.SwappedRelativePositionAtUT(nextPeTime) + o.referenceBody.getTruePositionAtUT(nextPeTime) - referenceBody.getTruePositionAtUT(nextPeTime);
var transformedPosition = screenTransform.MultiplyPoint3x4(relativePosition);
DrawIcon(transformedPosition.x, transformedPosition.y, VesselType.Unknown, iconColor, MapIcons.OtherIcon.PE);
}
}
示例2: FindFreefallEndTime
//This is a convenience function used by the reentry simulation. It does a binary search for the first UT
//in the interval (lowerUT, upperUT) for which condition(UT, relative position, orbital velocity) is true
double FindFreefallEndTime(Orbit initialOrbit)
{
if (FreefallEnded(initialOrbit, t))
{
return t;
}
double lowerUT = t;
double upperUT = initialOrbit.NextPeriapsisTime(t);
const double PRECISION = 1.0;
while (upperUT - lowerUT > PRECISION)
{
double testUT = (upperUT + lowerUT) / 2;
if (FreefallEnded(initialOrbit, testUT)) upperUT = testUT;
else lowerUT = testUT;
}
return (upperUT + lowerUT) / 2;
}
示例3: 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);
}
}
//.........这里部分代码省略.........