本文整理汇总了C#中Orbit.GetUTforTrueAnomaly方法的典型用法代码示例。如果您正苦于以下问题:C# Orbit.GetUTforTrueAnomaly方法的具体用法?C# Orbit.GetUTforTrueAnomaly怎么用?C# Orbit.GetUTforTrueAnomaly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orbit
的用法示例。
在下文中一共展示了Orbit.GetUTforTrueAnomaly方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawOrbit
private static void DrawOrbit(Orbit o, CelestialBody referenceBody, Matrix4x4 screenTransform, int numSegments)
{
if (!o.activePatch) {
return;
}
double startTA;
double endTA;
double now = Planetarium.GetUniversalTime();
if (o.patchEndTransition != Orbit.PatchTransitionType.FINAL) {
startTA = o.TrueAnomalyAtUT(o.StartUT);
endTA = o.TrueAnomalyAtUT(o.EndUT);
if (endTA < startTA) {
endTA += 2.0 * Math.PI;
}
} else {
startTA = o.GetUTforTrueAnomaly(0.0, now);
endTA = startTA + 2.0 * Math.PI;
}
double dTheta = (endTA - startTA) / (double)numSegments;
double theta = startTA;
double timeAtTA = o.GetUTforTrueAnomaly(theta, now);
Vector3 lastVertex = screenTransform.MultiplyPoint3x4(o.getRelativePositionFromTrueAnomaly(theta).xzy + (o.referenceBody.getTruePositionAtUT(timeAtTA)) - (referenceBody.getTruePositionAtUT(timeAtTA)));
for (int i = 0; i < numSegments; ++i) {
GL.Vertex3(lastVertex.x, lastVertex.y, 0.0f);
theta += dTheta;
timeAtTA = o.GetUTforTrueAnomaly(theta, now);
Vector3 newVertex = screenTransform.MultiplyPoint3x4(o.getRelativePositionFromTrueAnomaly(theta).xzy + (o.referenceBody.getTruePositionAtUT(timeAtTA)) - (referenceBody.getTruePositionAtUT(timeAtTA)));
GL.Vertex3(newVertex.x, newVertex.y, 0.0f);
lastVertex = newVertex;
}
}
示例2: ReallyDrawOrbit
// Fallback method: The orbit should be valid, but it's not showing as
// active. I've encountered this when targeting a vessel or planet.
private static void ReallyDrawOrbit(Orbit o, CelestialBody referenceBody, Matrix4x4 screenTransform, int numSegments)
{
if (o.eccentricity >= 1.0) {
Debug.Log("JSIOrbitDisplay.ReallyDrawOrbit(): I can't draw an orbit with e >= 1.0");
return;
}
double dTheta = 2.0 * Math.PI / (double)numSegments;
double theta = 0.0;
double now = Planetarium.GetUniversalTime();
double timeAtTA = o.GetUTforTrueAnomaly(theta, now);
Vector3 lastVertex = screenTransform.MultiplyPoint3x4(o.getRelativePositionFromTrueAnomaly(theta).xzy + (o.referenceBody.getTruePositionAtUT(timeAtTA)) - (referenceBody.getTruePositionAtUT(timeAtTA)));
for (int i = 0; i < numSegments; ++i) {
GL.Vertex3(lastVertex.x, lastVertex.y, 0.0f);
theta += dTheta;
timeAtTA = o.GetUTforTrueAnomaly(theta, now);
Vector3 newVertex = screenTransform.MultiplyPoint3x4(o.getRelativePositionFromTrueAnomaly(theta).xzy + (o.referenceBody.getTruePositionAtUT(timeAtTA)) - (referenceBody.getTruePositionAtUT(timeAtTA)));
GL.Vertex3(newVertex.x, newVertex.y, 0.0f);
lastVertex = newVertex;
}
}
示例3: getEquatorialDNUT
/// <summary>
/// Gets the UT for the equatorial DN.
/// </summary>
/// <returns>The equatorial DN UT.</returns>
/// <param name="o">The Orbit to calculate the UT from.</param>
public static double getEquatorialDNUT(Orbit o)
{
//TODO: Add safeguards for bad UTs, may need to be refactored to NodeManager
Vector3d DNVector = QuaternionD.AngleAxis(NodeTools.Angle360(o.LAN + 180), Planetarium.Zup.Z) * Planetarium.Zup.X;
return o.GetUTforTrueAnomaly(o.GetTrueAnomalyOfZupVector(DNVector), 2);
}
示例4: getTargetDNUT
/// <summary>
/// Gets the UT for the descending node in reference to the target orbit.
/// </summary>
/// <returns>The UT for the descending node in reference to the target orbit.</returns>
/// <param name="a">The orbit to find the UT on.</param>
/// <param name="b">The target orbit.</param>
public static double getTargetDNUT(Orbit a, Orbit b)
{
//TODO: Add safeguards for bad UTs, may need to be refactored to NodeManager
Vector3d DNVector = Vector3d.Cross(a.GetOrbitNormal(), b.h).normalized;
return a.GetUTforTrueAnomaly(a.GetTrueAnomalyOfZupVector(DNVector), 2);
}
示例5: getEquatorialANUT
/// <summary>
/// Gets the UT for the equatorial AN.
/// </summary>
/// <returns>The equatorial AN UT.</returns>
/// <param name="o">The Orbit to calculate the UT from.</param>
public static double getEquatorialANUT(Orbit o)
{
//TODO: Add safeguards for bad UTs, may need to be refactored to NodeManager
return o.GetUTforTrueAnomaly(o.GetTrueAnomalyOfZupVector(o.GetANVector()), 2);
}