本文整理汇总了C#中Orbit.AscendingNodeExists方法的典型用法代码示例。如果您正苦于以下问题:C# Orbit.AscendingNodeExists方法的具体用法?C# Orbit.AscendingNodeExists怎么用?C# Orbit.AscendingNodeExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orbit
的用法示例。
在下文中一共展示了Orbit.AscendingNodeExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeNodeImpl
public override ManeuverParameters MakeNodeImpl(Orbit o, double universalTime, MechJebModuleTargetController target)
{
double UT = timeSelector.ComputeManeuverTime(o, universalTime, target);
if (!target.NormalTargetExists)
{
throw new OperationException("must select a target to match planes with.");
}
else if (o.referenceBody != target.TargetOrbit.referenceBody)
{
throw new OperationException("can only match planes with an object in the same sphere of influence.");
}
else if (timeSelector.timeReference == TimeReference.REL_ASCENDING)
{
if (!o.AscendingNodeExists(target.TargetOrbit))
{
throw new OperationException("ascending node with target doesn't exist.");
}
}
else
{
if (!o.DescendingNodeExists(target.TargetOrbit))
{
throw new OperationException("descending node with target doesn't exist.");
}
}
Vector3d dV = (timeSelector.timeReference == TimeReference.REL_ASCENDING) ?
OrbitalManeuverCalculator.DeltaVAndTimeToMatchPlanesAscending(o, target.TargetOrbit, UT, out UT):
OrbitalManeuverCalculator.DeltaVAndTimeToMatchPlanesDescending(o, target.TargetOrbit, UT, out UT);
return new ManeuverParameters(dV, UT);
}
示例2: CheckPreconditions
bool CheckPreconditions(Orbit o, double UT)
{
errorMessage = "";
bool error = false;
string burnAltitude = MuUtils.ToSI(o.Radius(UT) - o.referenceBody.Radius) + "m";
switch (operation)
{
case Operation.CIRCULARIZE:
break;
case Operation.ELLIPTICIZE:
if (o.referenceBody.Radius + newPeA > o.Radius(UT))
{
error = true;
errorMessage = "new periapsis cannot be higher than the altitude of the burn (" + burnAltitude + ")";
}
else if (o.referenceBody.Radius + newApA < o.Radius(UT))
{
error = true;
errorMessage = "new apoapsis cannot be lower than the altitude of the burn (" + burnAltitude + ")";
}
else if (newPeA < -o.referenceBody.Radius)
{
error = true;
errorMessage = "new periapsis cannot be lower than minus the radius of " + o.referenceBody.theName + "(-" + MuUtils.ToSI(o.referenceBody.Radius, 3) + "m)";
}
break;
case Operation.PERIAPSIS:
if (o.referenceBody.Radius + newPeA > o.Radius(UT))
{
error = true;
errorMessage = "new periapsis cannot be higher than the altitude of the burn (" + burnAltitude + ")";
}
else if (newPeA < -o.referenceBody.Radius)
{
error = true;
errorMessage = "new periapsis cannot be lower than minus the radius of " + o.referenceBody.theName + "(-" + MuUtils.ToSI(o.referenceBody.Radius, 3) + "m)";
}
break;
case Operation.APOAPSIS:
if (o.referenceBody.Radius + newApA < o.Radius(UT))
{
error = true;
errorMessage = "new apoapsis cannot be lower than the altitude of the burn (" + burnAltitude + ")";
}
break;
case Operation.INCLINATION:
break;
case Operation.PLANE:
if (!core.target.NormalTargetExists)
{
error = true;
errorMessage = "must select a target to match planes with.";
}
else if (o.referenceBody != core.target.Orbit.referenceBody)
{
error = true;
errorMessage = "can only match planes with an object in the same sphere of influence.";
}
else if (timeReference == TimeReference.REL_ASCENDING)
{
if (!o.AscendingNodeExists(core.target.Orbit))
{
error = true;
errorMessage = "ascending node with target doesn't exist.";
}
}
else
{
if (!o.DescendingNodeExists(core.target.Orbit))
{
error = true;
errorMessage = "descending node with target doesn't exist.";
}
}
break;
case Operation.TRANSFER:
if (!core.target.NormalTargetExists)
{
error = true;
errorMessage = "must select a target for the Hohmann transfer.";
}
else if (o.referenceBody != core.target.Orbit.referenceBody)
{
error = true;
errorMessage = "target for Hohmann transfer must be in the same sphere of influence.";
}
else if (o.eccentricity > 1)
{
error = true;
errorMessage = "starting orbit for Hohmann transfer must not be hyperbolic.";
}
else if (core.target.Orbit.eccentricity > 1)
//.........这里部分代码省略.........
示例3: MakeNodeImpl
public override ManeuverParameters MakeNodeImpl(Orbit o, double universalTime, MechJebModuleTargetController target)
{
double UT = timeSelector.ComputeManeuverTime(o, universalTime, target);
if (!target.NormalTargetExists)
{
throw new OperationException("must select a target to match planes with.");
}
else if (o.referenceBody != target.TargetOrbit.referenceBody)
{
throw new OperationException("can only match planes with an object in the same sphere of influence.");
}
var anExists = o.AscendingNodeExists(target.TargetOrbit);
var dnExists = o.DescendingNodeExists(target.TargetOrbit);
double anTime = 0;
double dnTime = 0;
var anDeltaV = anExists ? OrbitalManeuverCalculator.DeltaVAndTimeToMatchPlanesAscending(o, target.TargetOrbit, UT, out anTime) : Vector3d.zero;
var dnDeltaV = anExists ? OrbitalManeuverCalculator.DeltaVAndTimeToMatchPlanesDescending(o, target.TargetOrbit, UT, out dnTime) : Vector3d.zero;
Vector3d dV;
if(timeSelector.timeReference == TimeReference.REL_ASCENDING)
{
if(!anExists)
{
throw new OperationException("ascending node with target doesn't exist.");
}
UT = anTime;
dV = anDeltaV;
}
else if(timeSelector.timeReference == TimeReference.REL_DESCENDING)
{
if(!dnExists)
{
throw new OperationException("descending node with target doesn't exist.");
}
UT = dnTime;
dV = dnDeltaV;
}
else if(timeSelector.timeReference == TimeReference.REL_NEAREST_AD)
{
if(!anExists && !dnExists)
{
throw new OperationException("neither ascending nor descending node with target exists.");
}
if(!dnExists || anTime <= dnTime)
{
UT = anTime;
dV = anDeltaV;
}
else
{
UT = dnTime;
dV = dnDeltaV;
}
}
else if(timeSelector.timeReference == TimeReference.REL_HIGHEST_AD)
{
if(!anExists && !dnExists)
{
throw new OperationException("neither ascending nor descending node with target exists.");
}
if(!dnExists || anDeltaV.magnitude <= dnDeltaV.magnitude)
{
UT = anTime;
dV = anDeltaV;
}
else
{
UT = dnTime;
dV = dnDeltaV;
}
}
else
{
throw new OperationException("wrong time reference.");
}
return new ManeuverParameters(dV, UT);
}