本文整理汇总了C#中CelestialBody.getTruePositionAtUT方法的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody.getTruePositionAtUT方法的具体用法?C# CelestialBody.getTruePositionAtUT怎么用?C# CelestialBody.getTruePositionAtUT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CelestialBody
的用法示例。
在下文中一共展示了CelestialBody.getTruePositionAtUT方法的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: 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);
}
}
示例3: 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;
}
}
示例4: DrawNextAp
private void DrawNextAp(Orbit o, CelestialBody referenceBody, double referenceTime, Color iconColor, Matrix4x4 screenTransform)
{
if (o.eccentricity >= 1.0) {
// Early return: There is no apoapsis on a hyperbolic orbit
return;
}
double nextApTime = o.NextApoapsisTime(referenceTime);
if (nextApTime < o.EndUT || (o.patchEndTransition == Orbit.PatchTransitionType.FINAL)) {
Vector3d relativePosition = o.SwappedRelativePositionAtUT(nextApTime) + o.referenceBody.getTruePositionAtUT(nextApTime) - referenceBody.getTruePositionAtUT(nextApTime);
var transformedPosition = screenTransform.MultiplyPoint3x4(relativePosition);
DrawIcon(transformedPosition.x, transformedPosition.y, VesselType.Unknown, iconColor, MapIcons.OtherIcon.AP);
}
}
示例5: UpdateFromOrbitAtUT
public void UpdateFromOrbitAtUT(Orbit orbit, double UT, CelestialBody toBody)
{
pos = (orbit.getTruePositionAtUT(UT) - toBody.getTruePositionAtUT(UT)).xzy;
vel = orbit.getOrbitalVelocityAtUT(UT) + orbit.referenceBody.GetFrameVelAtUT(UT) - toBody.GetFrameVelAtUT(UT);
UpdateFromStateVectors(pos, vel, toBody, UT);
}