本文整理汇总了C#中Orbit.NextClosestApproachDistance方法的典型用法代码示例。如果您正苦于以下问题:C# Orbit.NextClosestApproachDistance方法的具体用法?C# Orbit.NextClosestApproachDistance怎么用?C# Orbit.NextClosestApproachDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orbit
的用法示例。
在下文中一共展示了Orbit.NextClosestApproachDistance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeNodeImpl
public override ManeuverParameters MakeNodeImpl(Orbit o, double UT, MechJebModuleTargetController target)
{
if (!target.NormalTargetExists)
throw new OperationException("must select a target for the course correction.");
Orbit correctionPatch = o;
while (correctionPatch != null)
{
if (correctionPatch.referenceBody == target.TargetOrbit.referenceBody)
{
o = correctionPatch;
UT = correctionPatch.StartUT;
break;
}
correctionPatch = target.core.vessel.GetNextPatch(correctionPatch);
}
if (correctionPatch == null || correctionPatch.referenceBody != target.TargetOrbit.referenceBody)
throw new OperationException("target for course correction must be in the same sphere of influence");
if (o.NextClosestApproachTime(target.TargetOrbit, UT) < UT + 1 ||
o.NextClosestApproachDistance(target.TargetOrbit, UT) > target.TargetOrbit.semiMajorAxis * 0.2)
{
errorMessage = "Warning: orbit before course correction doesn't seem to approach target very closely. Planned course correction may be extreme. Recommend plotting an approximate intercept orbit and then plotting a course correction.";
}
CelestialBody targetBody = target.Target as CelestialBody;
Vector3d dV = targetBody != null ?
OrbitalManeuverCalculator.DeltaVAndTimeForCheapestCourseCorrection(o, UT, target.TargetOrbit, targetBody, targetBody.Radius + courseCorrectFinalPeA, out UT):
OrbitalManeuverCalculator.DeltaVAndTimeForCheapestCourseCorrection(o, UT, target.TargetOrbit, interceptDistance, out UT);
return new ManeuverParameters(dV, UT);
}
示例2: CheckPreconditions
//.........这里部分代码省略.........
}
else if (o.eccentricity > 1)
{
error = true;
errorMessage = "starting orbit for Hohmann transfer must not be hyperbolic.";
}
else if (core.target.Orbit.eccentricity > 1)
{
error = true;
errorMessage = "target orbit for Hohmann transfer must not be hyperbolic.";
}
else if (o.RelativeInclination(core.target.Orbit) > 30 && o.RelativeInclination(core.target.Orbit) < 150)
{
errorMessage = "Warning: target's orbital plane is at a " + o.RelativeInclination(core.target.Orbit).ToString("F0") + "º angle to starting orbit's plane (recommend at most 30º). Planned transfer may not intercept target properly.";
}
else if (o.eccentricity > 0.2)
{
errorMessage = "Warning: Recommend starting Hohmann transfers from a near-circular orbit (eccentricity < 0.2). Planned transfer is starting from an orbit with eccentricity " + o.eccentricity.ToString("F2") + " and so may not intercept target properly.";
}
break;
case Operation.COURSE_CORRECTION:
if (!core.target.NormalTargetExists)
{
error = true;
errorMessage = "must select a target for the course correction.";
}
else if (o.referenceBody != core.target.Orbit.referenceBody)
{
error = true;
errorMessage = "target for course correction must be in the same sphere of influence";
}
else if (o.NextClosestApproachTime(core.target.Orbit, UT) < UT + 1 ||
o.NextClosestApproachDistance(core.target.Orbit, UT) > core.target.Orbit.semiMajorAxis * 0.2)
{
errorMessage = "Warning: orbit before course correction doesn't seem to approach target very closely. Planned course correction may be extreme. Recommend plotting an approximate intercept orbit and then plotting a course correction.";
}
break;
case Operation.INTERPLANETARY_TRANSFER:
if (!core.target.NormalTargetExists)
{
error = true;
errorMessage = "must select a target for the interplanetary transfer.";
}
else if (o.referenceBody.referenceBody == null)
{
error = true;
errorMessage = "doesn't make sense to plot an interplanetary transfer from an orbit around " + o.referenceBody.theName + ".";
}
else if (o.referenceBody.referenceBody != core.target.Orbit.referenceBody)
{
error = true;
if (o.referenceBody == core.target.Orbit.referenceBody) errorMessage = "use regular Hohmann transfer function to intercept another body orbiting " + o.referenceBody.theName + ".";
else errorMessage = "an interplanetary transfer from within " + o.referenceBody.theName + "'s sphere of influence must target a body that orbits " + o.referenceBody.theName + "'s parent, " + o.referenceBody.referenceBody.theName + ".";
}
else if (o.referenceBody.orbit.RelativeInclination(core.target.Orbit) > 30)
{
errorMessage = "Warning: target's orbital plane is at a " + o.RelativeInclination(core.target.Orbit).ToString("F0") + "º angle to " + o.referenceBody.theName + "'s orbital plane (recommend at most 30º). Planned interplanetary transfer may not intercept target properly.";
}
else
{
double relativeInclination = Vector3d.Angle(o.SwappedOrbitNormal(), o.referenceBody.orbit.SwappedOrbitNormal());
if (relativeInclination > 10)
{
errorMessage = "Warning: Recommend starting interplanetary transfers from " + o.referenceBody.theName + " from an orbit in the same plane as " + o.referenceBody.theName + "'s orbit around " + o.referenceBody.referenceBody.theName + ". Starting orbit around " + o.referenceBody.theName + " is inclined " + relativeInclination.ToString("F1") + "º with respect to " + o.referenceBody.theName + "'s orbit around " + o.referenceBody.referenceBody.theName + " (recommend < 10º). Planned transfer may not intercept target properly.";