Home Reference Source
import {Orbit} from 'spacekit/src/Orbit.js'
public class | source

Orbit

A class that builds a visual representation of a Kepler orbit.

Example:

const orbit = new Spacekit.Orbit({
  ephem: new Spacekit.Ephem({...}),
  options: {
    color: 0xFFFFFF,
    eclipticLineColor: 0xCCCCCC,
  },
});

Constructor Summary

Public Constructor
public

constructor(ephem: Ephem | EphemerisTable, options: Object)

Method Summary

Public Methods
public

Get the color of this orbit.

public

getLinesToEcliptic(): THREE.Geometry

A geometry containing line segments that run between the orbit ellipse and the ecliptic plane of the solar system.

public

getOrbitShape(jd: *, forceCompute: *): THREE.Line

Calculates, caches, and returns the orbit state for this orbit around this time

public

Get heliocentric position of object at a given JD.

public

getPositionAtTimeElliptical(jd: *, debug: *): *

public

getPositionAtTimeHyperbolic(jd: *, debug: *): *

public

getPositionAtTimeNearParabolic(jd: *, debug: *): *

public

getPositionAtTimeParabolic(jd: *, debug: *): *

public

getPositionAtTimeTable(jd: *, debug: *): *

public

Get the visibility of this orbit.

public

setHexColor(hexVal: Number)

public

Change the visibility of this orbit.

public

Returns whether the requested epoch is within the current orbit's definition

public

Given true anomaly and heliocentric distance, returns the scaled heliocentric coordinates (X, Y, Z)

Public Constructors

public constructor(ephem: Ephem | EphemerisTable, options: Object) source

Params:

NameTypeAttributeDescription
ephem Ephem | EphemerisTable

The ephemerides that define this orbit.

options Object
options.color Object

The color of the orbital ellipse.

options.orbitPathSettings Object

settings for the path

options.orbitPathSettings.leadDurationYears Object

orbit path lead time in years

options.orbitPathSettings.trailDurationYears Object

orbit path trail time in years

options.orbitPathSettings.numberSamplePoints Object

number of points to use when drawing the orbit line Only applicable for non-elliptical and ephemeris table orbits.

options.eclipticLineColor Object

The color of lines drawn perpendicular to the ecliptic in order to illustrate depth (defaults to 0x333333).

Public Methods

public getHexColor(): Number source

Get the color of this orbit.

Return:

Number

The hexadecimal color of the orbital ellipse.

public getLinesToEcliptic(): THREE.Geometry source

A geometry containing line segments that run between the orbit ellipse and the ecliptic plane of the solar system. This is a useful visual effect that makes it easy to tell when an orbit goes below or above the ecliptic plane.

Return:

THREE.Geometry

A geometry with many line segments.

public getOrbitShape(jd: *, forceCompute: *): THREE.Line source

Calculates, caches, and returns the orbit state for this orbit around this time

Params:

NameTypeAttributeDescription
jd *

center time of the orbit (only used for ephemeris table ephemeris)

forceCompute *

forces the recomputing of the orbit on this call

Return:

THREE.Line

public getPositionAtTime(jd: Number, debug: boolean): Array<Number> source

Get heliocentric position of object at a given JD.

Params:

NameTypeAttributeDescription
jd Number

Date value in JD.

debug boolean

Set true for debug output.

Return:

Array<Number>

[X, Y, Z] coordinates

public getPositionAtTimeElliptical(jd: *, debug: *): * source

Params:

NameTypeAttributeDescription
jd *
debug *

Return:

*

public getPositionAtTimeHyperbolic(jd: *, debug: *): * source

Params:

NameTypeAttributeDescription
jd *
debug *

Return:

*

public getPositionAtTimeNearParabolic(jd: *, debug: *): * source

Params:

NameTypeAttributeDescription
jd *
debug *

Return:

*

public getPositionAtTimeParabolic(jd: *, debug: *): * source

Params:

NameTypeAttributeDescription
jd *
debug *

Return:

*

public getPositionAtTimeTable(jd: *, debug: *): * source

Params:

NameTypeAttributeDescription
jd *
debug *

Return:

*

public getVisibility(): boolean source

Get the visibility of this orbit.

Return:

boolean

Whether the orbital ellipse is visible. Note that although the ellipse may not be visible, it is still present in the underlying Scene and Simultation.

public setHexColor(hexVal: Number) source

Params:

NameTypeAttributeDescription
hexVal Number

The hexadecimal color of the orbital ellipse.

public setVisibility(val: boolean) source

Change the visibility of this orbit.

Params:

NameTypeAttributeDescription
val boolean

Whether to show the orbital ellipse.

public timeInRenderedOrbitSpan(jd: *): boolean | boolean source

Returns whether the requested epoch is within the current orbit's definition

Params:

NameTypeAttributeDescription
jd *

Return:

boolean | boolean

true if it is within the orbit span, false if not

public vectorToHeliocentric(v: Number, r: Number): Array<Number> source

Given true anomaly and heliocentric distance, returns the scaled heliocentric coordinates (X, Y, Z)

Params:

NameTypeAttributeDescription
v Number

True anomaly

r Number

Heliocentric distance

Return:

Array<Number>

Heliocentric coordinates