Difference between revisions of "API:Orbit"
From Kerbal Space Program Wiki
Rocketdocker (talk | contribs) ({{Orphan}}) |
|||
(14 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{Orphan}} | |
{{PropertiesStart}} | {{PropertiesStart}} | ||
{{Property | {{Property | ||
Line 5: | Line 5: | ||
|name=ApA | |name=ApA | ||
|hasget=1 | |hasget=1 | ||
− | |desc= | + | |desc=Apoapsis altitude, distance from the apoapsis to the surface of the reference body. |
}} | }} | ||
{{Property | {{Property | ||
Line 11: | Line 11: | ||
|name=ApR | |name=ApR | ||
|hasget=1 | |hasget=1 | ||
+ | |desc=Apoapsis radius, distance from the apoapsis to the center of the reference body. | ||
}} | }} | ||
{{Property | {{Property | ||
Line 16: | Line 17: | ||
|name=PeA | |name=PeA | ||
|hasget=1 | |hasget=1 | ||
− | |desc= | + | |desc=Periapsis altitude, distance from the periapsis to the surface of the reference body. |
}} | }} | ||
{{Property|type=double | {{Property|type=double | ||
|name=PeR | |name=PeR | ||
|hasget=1 | |hasget=1 | ||
+ | |desc=Periapsis radius, distance from the periapsis to the center of the reference body. | ||
}} | }} | ||
{{Property | {{Property | ||
Line 26: | Line 28: | ||
|name=semiLatusRectum | |name=semiLatusRectum | ||
|hasget=1 | |hasget=1 | ||
+ | |desc=Semi-latus rectum, half the length of the chord parallel to the directrix through one of the orbit's foci. | ||
}} | }} | ||
{{Property | {{Property | ||
Line 31: | Line 34: | ||
|name=semiMinorAxis | |name=semiMinorAxis | ||
|hasget=1 | |hasget=1 | ||
+ | |desc=Semi-minor axis, half the length of the shorter axis through the center of the orbit. | ||
}} | }} | ||
{{PropertiesEnd}} | {{PropertiesEnd}} | ||
Line 42: | Line 46: | ||
|type=double | |type=double | ||
|name=altitude | |name=altitude | ||
+ | |desc=Height above the surface of the reference body, including liquid bodies. | ||
}} | }} | ||
{{Field | {{Field | ||
Line 50: | Line 55: | ||
|type=double | |type=double | ||
|name=argumentOfPeriapsis | |name=argumentOfPeriapsis | ||
+ | |desc=[[w:Argument of periapsis|Argument of periapsis]] (degrees) | ||
}} | }} | ||
{{Field | {{Field | ||
|type=double | |type=double | ||
|name=ClAppr | |name=ClAppr | ||
+ | |desc=Presumably the distance to the target at closest approach agnostic of encounters, in meters). | ||
}} | }} | ||
Line 59: | Line 66: | ||
|type=double | |type=double | ||
|name=ClEctr1 | |name=ClEctr1 | ||
+ | |desc= presumably as distance to target during the next closest encounter, in meters. | ||
}} | }} | ||
Line 64: | Line 72: | ||
|type=double | |type=double | ||
|name=ClEctr2 | |name=ClEctr2 | ||
+ | |desc=Second closest encounter, as an unknown quantity (presumably distance to target, in meters). | ||
}} | }} | ||
Line 69: | Line 78: | ||
|type=CelestialBody | |type=CelestialBody | ||
|name=closestEncounterBody | |name=closestEncounterBody | ||
+ | |desc=The next celestial body to be encountered. | ||
}} | }} | ||
Line 74: | Line 84: | ||
|type=EncounterSolutionLevel | |type=EncounterSolutionLevel | ||
|name=closestEncounterLevel | |name=closestEncounterLevel | ||
+ | |desc=The type of the next closest encounter, constrained to the values enumerated in EncounterSolutionLevel. | ||
}} | }} | ||
Line 79: | Line 90: | ||
|type=Orbit | |type=Orbit | ||
|name=closestEncounterPath | |name=closestEncounterPath | ||
+ | |desc=The Orbit around the next celestial body to be encountered. | ||
}} | }} | ||
Line 84: | Line 96: | ||
|type=double | |type=double | ||
|name=closestTgtApprUT | |name=closestTgtApprUT | ||
+ | |desc=The time of the next closest approach, in Universal Time. | ||
}} | }} | ||
Line 89: | Line 102: | ||
|type=double | |type=double | ||
|name=crAppr | |name=crAppr | ||
+ | |desc=Unknown type of approach type, presumably distance in meters. | ||
}} | }} | ||
Line 129: | Line 143: | ||
|type=double | |type=double | ||
|name=eccentricAnomaly | |name=eccentricAnomaly | ||
+ | |desc=The eccentric anomaly of the orbit, corresponding to the angle between the periapsis and the current projected position on a circle of radius equal to the semimajor axis. | ||
}} | }} | ||
Line 134: | Line 149: | ||
|type=double | |type=double | ||
|name=eccentricity | |name=eccentricity | ||
+ | |desc=The eccentricity of the orbit, describing the deviation of the orbit from a perfect circle, from 0 to 1 exclusive for elliptical and 1 to infinity exclusive for hyperbolic (0 being circular and 1 being parabolic) | ||
}} | }} | ||
Line 139: | Line 155: | ||
|type=Vector3d | |type=Vector3d | ||
|name=eccVec | |name=eccVec | ||
+ | |desc=The eccentricity vector of the orbit, whose magnitude is the eccentricity. | ||
}} | }} | ||
Line 149: | Line 166: | ||
|type=double | |type=double | ||
|name=epoch | |name=epoch | ||
+ | |desc=The reference time of the orbit, presumably in Universal Time. | ||
}} | }} | ||
Line 174: | Line 192: | ||
|type=Vector3d | |type=Vector3d | ||
|name=h | |name=h | ||
+ | |desc=The specific relative angular momentum vector of the orbit in meters squared per second, being specifically relative to the celestial body around which the orbit exists. | ||
}} | }} | ||
Line 179: | Line 198: | ||
|type=double | |type=double | ||
|name=inclination | |name=inclination | ||
+ | |desc=The inclination of the orbit above the reference plane (degrees) | ||
}} | }} | ||
Line 184: | Line 204: | ||
|type=double | |type=double | ||
|name=LAN | |name=LAN | ||
+ | |desc=[[w:Longitude of the ascending node|Longitude of the ascending node]] (degrees) | ||
}} | }} | ||
Line 194: | Line 215: | ||
|type=double | |type=double | ||
|name=meanAnomaly | |name=meanAnomaly | ||
+ | |desc=Current [[w:Mean Anomaly|mean anomaly]] (radians, not an angle) | ||
}} | }} | ||
Line 199: | Line 221: | ||
|type=double | |type=double | ||
|name=meanAnomalyAtEpoch | |name=meanAnomalyAtEpoch | ||
+ | |desc=[[w:Mean Anomaly|Mean anomaly]] at epoch (radians, not an angle) | ||
}} | }} | ||
Line 225: | Line 248: | ||
|type=double | |type=double | ||
|name=orbitalSpeed | |name=orbitalSpeed | ||
+ | |desc=The current orbital speed(m/s). Use Orbit.vel.magnitude to get the actual orbital speed instead. | ||
}} | }} | ||
Line 265: | Line 289: | ||
|type=CelestialBody | |type=CelestialBody | ||
|name=referenceBody | |name=referenceBody | ||
+ | |desc=CelestialBody around which you are orbiting. | ||
}} | }} | ||
Line 305: | Line 330: | ||
|type=double | |type=double | ||
|name=timeToAp | |name=timeToAp | ||
− | |desc=Time in | + | |desc=Time in seconds before reach the apoapsis. |
}} | }} | ||
Line 311: | Line 336: | ||
|type=double | |type=double | ||
|name=timeToPe | |name=timeToPe | ||
− | |desc=Time in | + | |desc=Time in seconds before reach the periapsis. |
}} | }} | ||
Line 357: | Line 382: | ||
|type=Vector3d | |type=Vector3d | ||
|name=vel | |name=vel | ||
+ | |desc=Actual orbital velocity (orbital speed). | ||
}} | }} | ||
{{FieldsEnd}} | {{FieldsEnd}} | ||
Line 371: | Line 397: | ||
|name=Orbit | |name=Orbit | ||
|args={{arg|double|inc}},{{arg|double|e}},{{arg|double|sma}},{{arg|double|lan}},{{arg|double|w}},{{arg|double|mEp}},{{arg|double|t}},{{arg|CelestialBody|body}} | |args={{arg|double|inc}},{{arg|double|e}},{{arg|double|sma}},{{arg|double|lan}},{{arg|double|w}},{{arg|double|mEp}},{{arg|double|t}},{{arg|CelestialBody|body}} | ||
+ | |desc="inc" is probably inclination, "e" is probably eccentricity, "sma" is probably semi-major axis, "lan" is probably longitude of the ascending node, "w" is probably the argument of periapsis (omega), and mEp is probably a mean anomaly at some time, like epoch, and t is probably current time, See https://en.wikipedia.org/wiki/Orbital_elements | ||
}} | }} | ||
Line 731: | Line 758: | ||
} | } | ||
== Tips == | == Tips == | ||
− | -Use '''[[API:FlightGlobals|FlightGlobals]].[[API:FlightGlobals|ActiveVessel]].orbit.ApA''' to get the actual Apoapsis of the vessel controlled by the player. | + | -Use '''[[API:FlightGlobals|FlightGlobals]].[[API:FlightGlobals|ActiveVessel]].orbit.ApA''' to get the actual Apoapsis of the vessel controlled by the player.<br /> |
+ | -Use '''[[API:FlightGlobals|FlightGlobals]].[[API:FlightGlobals|ActiveVessel]].orbit.vel.magnitude''' to get the actual orbital speed in m/s of the vessel controlled by the player. | ||
[[Category:Community API Documentation]] | [[Category:Community API Documentation]] |
Latest revision as of 17:32, 22 January 2020
Contents
Properties
The following are public properties available in Orbit.
Signature | Description |
---|---|
double ApA { get; } | Apoapsis altitude, distance from the apoapsis to the surface of the reference body. |
double ApR { get; } | Apoapsis radius, distance from the apoapsis to the center of the reference body. |
double PeA { get; } | Periapsis altitude, distance from the periapsis to the surface of the reference body. |
double PeR { get; } | Periapsis radius, distance from the periapsis to the center of the reference body. |
double semiLatusRectum { get; } | Semi-latus rectum, half the length of the chord parallel to the directrix through one of the orbit's foci. |
double semiMinorAxis { get; } | Semi-minor axis, half the length of the shorter axis through the center of the orbit. |
Fields
The following is a list of publically-accessible fields in Orbit. This includes protected items, which can be accessed by subclasses.
Signature | Description |
---|---|
bool activePatch | ? |
double altitude | Height above the surface of the reference body, including liquid bodies. |
Vector3d an | ? |
double argumentOfPeriapsis | Argument of periapsis (degrees) |
double ClAppr | Presumably the distance to the target at closest approach agnostic of encounters, in meters). |
double ClEctr1 | presumably as distance to target during the next closest encounter, in meters. |
double ClEctr2 | Second closest encounter, as an unknown quantity (presumably distance to target, in meters). |
CelestialBody closestEncounterBody | The next celestial body to be encountered. |
EncounterSolutionLevel closestEncounterLevel | The type of the next closest encounter, constrained to the values enumerated in EncounterSolutionLevel. |
Orbit closestEncounterPath | The Orbit around the next celestial body to be encountered. |
double closestTgtApprUT | The time of the next closest approach, in Universal Time. |
double crAppr | Unknown type of approach type, presumably distance in meters. |
bool debug_returnFullEllipseTrajectory | ? |
Vector3 debugAN | ? |
Vector3 debugEccVec | ? |
Vector3 debugH | ? |
Vector3 debugPos | ? |
Vector3 debugVel | ? |
double E | ? |
double eccentricAnomaly | The eccentric anomaly of the orbit, corresponding to the angle between the periapsis and the current projected position on a circle of radius equal to the semimajor axis. |
double eccentricity | The eccentricity of the orbit, describing the deviation of the orbit from a perfect circle, from 0 to 1 exclusive for elliptical and 1 to infinity exclusive for hyperbolic (0 being circular and 1 being parabolic) |
Vector3d eccVec | The eccentricity vector of the orbit, whose magnitude is the eccentricity. |
double EndUT | ? |
double epoch | The reference time of the orbit, presumably in Universal Time. |
double FEVp | ? |
double FEVs | ? |
double fromE | ? |
double fromV | ? |
Vector3d h | The specific relative angular momentum vector of the orbit in meters squared per second, being specifically relative to the celestial body around which the orbit exists. |
double inclination | The inclination of the orbit above the reference plane (degrees) |
double LAN | Longitude of the ascending node (degrees) |
double mag | ? |
double meanAnomaly | Current mean anomaly (radians, not an angle) |
double meanAnomalyAtEpoch | Mean anomaly at epoch (radians, not an angle) |
double nearestTT | Obsolete, Use VesselType or CelestialBodyType instead. |
double ObT | ? |
double ObTAtEpoch | ? |
double orbitalEnergy | ? |
double orbitalSpeed | The current orbital speed(m/s). Use Orbit.vel.magnitude to get the actual orbital speed instead. |
double orbitalPercent | ? |
PatchTransitionType patchEndTransition | ? |
PatchTransitionType patchStartTransition | ? |
double period | ? |
Vector3d pos | ? |
Orbit previousPatch | ? |
double radius | ? |
CelestialBody referenceBody | CelestialBody around which you are orbiting. |
double sampleInterval | ? |
Vector3d secondaryPosAtTransition1 | ? |
Vector3d secondaryPosAtTransition2 | ? |
double semiMajorAxis | ? |
double SEVp | ? |
double SEVs | ? |
double StartUT | ? |
double timeToAp | Time in seconds before reach the apoapsis. |
double timeToPe | Time in seconds before reach the periapsis. |
double timeToTransition1 | ? |
double timeToTransition2 | ? |
double toE | ? |
double toV | ? |
double trueAnomaly | ? |
double UTappr | ? |
double UTsoi | ? |
double V | ? |
Vector3d vel | Actual orbital velocity (orbital speed). |
Methods
The following are methods included in Orbit.
Signature | Description |
---|---|
static Orbit() | ? |
public Orbit(double inc,double e,double sma,double lan,double w,double mEp,double t,CelestialBody body) | "inc" is probably inclination, "e" is probably eccentricity, "sma" is probably semi-major axis, "lan" is probably longitude of the ascending node, "w" is probably the argument of periapsis (omega), and mEp is probably a mean anomaly at some time, like epoch, and t is probably current time, See https://en.wikipedia.org/wiki/Orbital_elements |
void DrawOrbit() | ? |
static void FindClosestPoints(Orbit p,Orbit s,ref double CD,ref double CCD ,ref double FFp,ref double FFs,ref double SFp,ref double SFs ,double epsilon,int maxIterations,ref int iterationCount) | ? |
Vector3d GetANVector() | ? |
double GetDTforTrueAnomaly(double tA,double wrapAfterSeconds) | ? |
double GetEccentricAnomaly(double tA) | ? |
Vector3d GetEccVector() | ? |
Vector3d GetFrameVel() | ? |
Vector3d GetFrameVelAtUT(double UT) | ? |
double GetMeanAnomaly(double E,double tA) | ? |
double getObTAtMeanAnomaly(double M) | ? |
double getObtAtUT(double UT) | ? |
double getOrbitalSpeedAt(double time) | ? |
double getOrbitalSpeedAtDistance(double d) | ? |
double getOrbitalSpeedAtPos(Vector3d pos) | ? |
double getOrbitalSpeedAtRelativePos(Vector3d relPos) | ? |
Vector3d getOrbitalVelocityAtObT(double ObT) | ? |
Vector3d getOrbitalVelocityAtUT(double UT) | ? |
Vector3d GetOrbitNormal()() | ? |
Trajectory GetPatchTrajectory(int sampleCount) | ? |
Vector3d getPositionAtT(double T) | ? |
Vector3d getPositionAtUT(double UT) | ? |
Vector3d getPositionFromEccAnomaly(double E) | ? |
Vector3d getPositionFromMeanAnomaly(double M) | ? |
Vector3d getPositionFromTrueAnomaly(double tA) | ? |
Vector3d getRelativePositionAtT(double T) | ?
|
Vector3d getRelativePositionAtUT(double UT) | ?
|
Vector3d getRelativePositionFromEccAnomaly(double E) | ?
|
Vector3d getRelativePositionFromMeanAnomaly(double m) | ?
|
Vector3d getRelativePositionFromTrueAnomaly(double tA) | ?
|
Vector3d GetRelativeVel() | ?
|
Vector3d GetRotFrameVel(CelestialBody refBody) | ?
|
double getTrueAnomaly(double E) | ?
|
double GetTrueAnomalyOfZupVector(Vector3d vector) | ? |
Vector3d getTruePositionAtUT(double UT) | ? |
double GetUTforTrueAnomaly(double tA,double wrapAfterSeconds) | ? |
Vector3d GetVel() | ? |
Vector3d GetWorldSpaceVel() | ? |
static bool PeApIntersects(Orbit primary,Orbit secondary,double threshold) | ? |
double RadiusAtTrueAnomaly(double tA) | ? |
static double SolveClosestApproach(Orbit p,Orbit s,ref double UT,double dT,double threshold,double MinUT,double MaxUT,double epsilon,int maxIterations,ref int iterationCount) | ? |
static double SolveClosestBSP(ref double Fp,ref double Fs,double Ir,double dF,Orbit p,orbit s,double epsilon,int maxIterations,ref int iterationCount) | ? |
double solveEccentricAnomaly(double M,double ecc,double maxError,int maxIterations) | ? |
static bool SolveSOI_BSP(Orbit p,Orbit s,ref double UT,double dT,double Rsoi,double MinUT,double MaxUT,double epsilon,int maxIterations,ref int iterationCount) | ? |
double TrueAnomalyAtRadius(double R) | ? |
double TrueAnomalyAtT(double T) | ? |
double TrueAnomalyAtUT(double UT) | ? |
void UpdateFromOrbitAtUT(Orbit orbit,double UT,CelestialBody toBody) | ? |
void UpdateFromStateVectors(Vector3d pos,Vector3d vel,CelestialBody refBody,double UT) | ? |
void UpdateFromUT(double UT) | ? |
Enumerations
public enum EncounterSolutionLevel {
- NONE,
- ESCAPE,
- ORBIT_INTERSECT,
- SOI_INTERSECT_2,
- SOI_INTERSECT_1
}
public enum ObjectType {
- VESSEL,
- SPACE_DEBRIS,
- CELESTIAL_BODIES,
- UNKOWN_MISC,
- KERBAL
}
public enum PatchTransitionType{
- INITIAL,
- FINAL,
- ENCOUNTER,
- ESCAPE,
- MANEUVER
}
Tips
-Use FlightGlobals.ActiveVessel.orbit.ApA to get the actual Apoapsis of the vessel controlled by the player.
-Use FlightGlobals.ActiveVessel.orbit.vel.magnitude to get the actual orbital speed in m/s of the vessel controlled by the player.