本文整理汇总了C#中Orbit.AscendingNodeEquatorialExists方法的典型用法代码示例。如果您正苦于以下问题:C# Orbit.AscendingNodeEquatorialExists方法的具体用法?C# Orbit.AscendingNodeEquatorialExists怎么用?C# Orbit.AscendingNodeEquatorialExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orbit
的用法示例。
在下文中一共展示了Orbit.AscendingNodeEquatorialExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeltaVToShiftLAN
//Computes the deltaV of the burn needed to set a given LAN at a given UT.
public static Vector3d DeltaVToShiftLAN(Orbit o, double UT, double newLAN)
{
Vector3d pos = o.SwappedAbsolutePositionAtUT(UT);
// Burn position in the same reference frame as LAN
double burn_latitude = o.referenceBody.GetLatitude(pos);
double burn_longitude = o.referenceBody.GetLongitude(pos) + o.referenceBody.rotationAngle;
const double target_latitude = 0; // Equator
double target_longitude = 0; // Prime Meridian
// Select the location of either the descending or ascending node.
// If the descending node is closer than the ascending node, or there is no ascending node, target the reverse of the newLAN
// Otherwise target the newLAN
if (o.AscendingNodeEquatorialExists() && o.DescendingNodeEquatorialExists())
{
if (o.TimeOfDescendingNodeEquatorial(UT) < o.TimeOfAscendingNodeEquatorial(UT))
{
// DN is closer than AN
// Burning for the AN would entail flipping the orbit around, and would be very expensive
// therefore, burn for the corresponding Longitude of the Descending Node
target_longitude = MuUtils.ClampDegrees360(newLAN + 180.0);
}
else
{
// DN is closer than AN
target_longitude = MuUtils.ClampDegrees360(newLAN);
}
}
else if (o.AscendingNodeEquatorialExists() && !o.DescendingNodeEquatorialExists())
{
// No DN
target_longitude = MuUtils.ClampDegrees360(newLAN);
}
else if (!o.AscendingNodeEquatorialExists() && o.DescendingNodeEquatorialExists())
{
// No AN
target_longitude = MuUtils.ClampDegrees360(newLAN + 180.0);
}
else
{
throw new ArgumentException("OrbitalManeuverCalculator.DeltaVToShiftLAN: No Equatorial Nodes");
}
double desiredHeading = MuUtils.ClampDegrees360(Heading(burn_latitude, burn_longitude, target_latitude, target_longitude));
Vector3d actualHorizontalVelocity = Vector3d.Exclude(o.Up(UT), o.SwappedOrbitalVelocityAtUT(UT));
Vector3d eastComponent = actualHorizontalVelocity.magnitude * Math.Sin(Math.PI / 180 * desiredHeading) * o.East(UT);
Vector3d northComponent = actualHorizontalVelocity.magnitude * Math.Cos(Math.PI / 180 * desiredHeading) * o.North(UT);
Vector3d desiredHorizontalVelocity = eastComponent + northComponent;
return desiredHorizontalVelocity - actualHorizontalVelocity;
}
示例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);
}
}
//.........这里部分代码省略.........