Home Reference Source

Function

Static Public Summary
public

auToKm(au: *): *

public

binarySearch(data: Array, value: *, comparer: Function): number

Performs a standard binary search on an array of values returning the index of the found item or the twos complement negative of the closest value if the exact value isn't found. For example for array: [10, 20, 30]

  • Searching for a value of 20 would return an index of 1
  • Searching for a value of 12 would return a value of -2 (taking the two's complement back '~' give you 1)
public

decimalToSexagesimalDec(decimal: *, isObserverBelowEquator: boolean): undefined[]

public
public

deg(val: *): *

public

eclipticToEquatorial_Cartesian(x: *, y: *, z: *, tilt: *): undefined[]

public

equatorialToEcliptic_Cartesian(x: *, y: *, z: *, tilt: *): undefined[]

public
public

getFullTextureUrl(template: String, basePath: String): *

Returns the complete URL to a texture given a basepath and a template url.

public

getFullUrl(template: String, basePath: String): *

Returns the complete URL to a texture given a basepath and a template url.

public

Get Earth's obliquity and nutation at a given date.

public

Get Earth's obliquity at a given date.

public

getOrbitType(ephem: *): OrbitType

Get the type of orbit.

public

Get the number of units per AU.

public

getThreeJsTexture(template: *, basePath: *): *

public

hoursToDeg(val: *): *

public

interpolate(data: Array, xValue: Number, sampleRowMin: Number, sampleRowMax: Number, xIndex: Number, yIndex: Number): Number

Interpolates the given 2D array of data using a Lagrange Polynomial interpolation.

public

kmToAu(km: *): *

public

rad(val: *): *

public

rescale(args: ...*): *

public

rescaleArray(XYZ: *): undefined[]

public

rescaleNumber(x: *): *

public

rescalePos(pos: *): *

public

rescaleVector(vec: *): *

public

rescaleXYZ(X: *, Y: *, Z: *): undefined[]

public

setScaleFactor(val: *)

Set the number of units per AU.

public

sexagesimalToDecimalDec(decDeg: *, decMin: *, decSec: *, isObserverBelowEquator: boolean): *

public

sexagesimalToDecimalRa(raHour: *, raMin: *, raSec: *): *

public

sphericalToCartesian(ra: *, dec: *, dist: *): undefined[]

Static Public

public auToKm(au: *): * source

import {auToKm} from 'spacekit/src/Units.js'

Params:

NameTypeAttributeDescription
au *

Return:

*

public binarySearch(data: Array, value: *, comparer: Function): number source

import {binarySearch} from 'spacekit/src/util.js'

Performs a standard binary search on an array of values returning the index of the found item or the twos complement negative of the closest value if the exact value isn't found. For example for array: [10, 20, 30]

  • Searching for a value of 20 would return an index of 1
  • Searching for a value of 12 would return a value of -2 (taking the two's complement back '~' give you 1)

Params:

NameTypeAttributeDescription
data Array

an array of values of the type consistent with the comparer method

value *

the value to be searched for in the data array

comparer Function
  • optional

a function which takes two arguments: first of same type as data row and second as same time as value to compare. Default method is a numerical comparison

Return:

number

public decimalToSexagesimalDec(decimal: *, isObserverBelowEquator: boolean): undefined[] source

import {decimalToSexagesimalDec} from 'spacekit/src/Units.js'

Params:

NameTypeAttributeDescription
decimal *
isObserverBelowEquator boolean
  • optional
  • default: false

Return:

undefined[]

public decimalToSexagesimalRa(decimal: *): undefined[] source

import {decimalToSexagesimalRa} from 'spacekit/src/Units.js'

Params:

NameTypeAttributeDescription
decimal *

Return:

undefined[]

public deg(val: *): * source

import {deg} from 'spacekit/src/Units.js'

Params:

NameTypeAttributeDescription
val *

Return:

*

public eclipticToEquatorial_Cartesian(x: *, y: *, z: *, tilt: *): undefined[] source

import {eclipticToEquatorial_Cartesian} from 'spacekit/src/Coordinates.js'

Params:

NameTypeAttributeDescription
x *
y *
z *
tilt *

Return:

undefined[]

public equatorialToEcliptic_Cartesian(x: *, y: *, z: *, tilt: *): undefined[] source

import {equatorialToEcliptic_Cartesian} from 'spacekit/src/Coordinates.js'

See https://en.wikipedia.org/wiki/Ecliptic_coordinate_system#Converting_Cartesian_vector

Params:

NameTypeAttributeDescription
x *
y *
z *
tilt *

Return:

undefined[]

public getDefaultBasePath(): * source

import {getDefaultBasePath} from 'spacekit/src/util.js'

Return:

*

public getFullTextureUrl(template: String, basePath: String): * source

import {getFullTextureUrl} from 'spacekit/src/util.js'

Returns the complete URL to a texture given a basepath and a template url.

Params:

NameTypeAttributeDescription
template String

URL containing optional template parameters

basePath String

Base path for simulation data and assets.

Return:

*

Example:

getFullTextureUrl('{{assets}}/images/mysprite.png', '/path/to/assets')
=> '/path/to/assets/images/mysprite.png'

public getFullUrl(template: String, basePath: String): * source

import {getFullUrl} from 'spacekit/src/util.js'

Returns the complete URL to a texture given a basepath and a template url.

Params:

NameTypeAttributeDescription
template String

URL containing optional template parameters

basePath String

Base path

Return:

*

Example:

getFullUrl('{{assets}}/images/mysprite.png', '/path/to/assets')
=> '/path/to/assets/images/mysprite.png'

public getNutationAndObliquity(jd: Number): Object source

import {getNutationAndObliquity} from 'spacekit/src/Coordinates.js'

Get Earth's obliquity and nutation at a given date.

Params:

NameTypeAttributeDescription
jd Number

JD date

Return:

Object

Object with attributes "obliquity" and "nutation" provided in radians

public getObliquity(jd: Number): Number source

import {getObliquity} from 'spacekit/src/Coordinates.js'

Get Earth's obliquity at a given date.

Params:

NameTypeAttributeDescription
jd Number

JD date

Return:

Number

Obliquity in radians

public getOrbitType(ephem: *): OrbitType source

import {getOrbitType} from 'spacekit/src/Orbit.js'

Get the type of orbit. Returns one of OrbitType.PARABOLIC, HYPERBOLIC, ELLIPTICAL, or UNKNOWN.

Params:

NameTypeAttributeDescription
ephem *

Return:

OrbitType

Name of orbit type

public getScaleFactor(): * source

import {getScaleFactor} from 'spacekit/src/Scale.js'

Get the number of units per AU.

Return:

*

public getThreeJsTexture(template: *, basePath: *): * source

import {getThreeJsTexture} from 'spacekit/src/util.js'

Params:

NameTypeAttributeDescription
template *
basePath *

Return:

*

public hoursToDeg(val: *): * source

import {hoursToDeg} from 'spacekit/src/Units.js'

Params:

NameTypeAttributeDescription
val *

Return:

*

public interpolate(data: Array, xValue: Number, sampleRowMin: Number, sampleRowMax: Number, xIndex: Number, yIndex: Number): Number source

import {interpolate} from 'spacekit/src/Math.js'

Interpolates the given 2D array of data using a Lagrange Polynomial interpolation. User specifies first/last row versus giving a number of sample points and a starting index. For best performance number of points generally would be between 1 (linear) and 7

Params:

NameTypeAttributeDescription
data Array

array

xValue Number

value of x to evaluate for function y = f(x) represented by the data

sampleRowMin Number

first row of data to use for the interpolation

sampleRowMax Number

last row of data to use for the interpolation

xIndex Number

the column of data which represents the 'x' variable of y = f(x)

yIndex Number

the column of data which represents the 'y' curve data of y = f(x)

Return:

Number

the interpolated value of the function f(x) from the data

public kmToAu(km: *): * source

import {kmToAu} from 'spacekit/src/Units.js'

Params:

NameTypeAttributeDescription
km *

Return:

*

public rad(val: *): * source

import {rad} from 'spacekit/src/Units.js'

Params:

NameTypeAttributeDescription
val *

Return:

*

public rescale(args: ...*): * source

import {rescale} from 'spacekit/src/Scale.js'

Params:

NameTypeAttributeDescription
args ...*

Return:

*

public rescaleArray(XYZ: *): undefined[] source

import {rescaleArray} from 'spacekit/src/Scale.js'

Params:

NameTypeAttributeDescription
XYZ *

Return:

undefined[]

public rescaleNumber(x: *): * source

import {rescaleNumber} from 'spacekit/src/Scale.js'

Params:

NameTypeAttributeDescription
x *

Return:

*

public rescalePos(pos: *): * source

import {rescalePos} from 'spacekit/src/Scale.js'

Params:

NameTypeAttributeDescription
pos *

Return:

*

public rescaleVector(vec: *): * source

import {rescaleVector} from 'spacekit/src/Scale.js'

Params:

NameTypeAttributeDescription
vec *

Return:

*

public rescaleXYZ(X: *, Y: *, Z: *): undefined[] source

import {rescaleXYZ} from 'spacekit/src/Scale.js'

Params:

NameTypeAttributeDescription
X *
Y *
Z *

Return:

undefined[]

public setScaleFactor(val: *) source

import {setScaleFactor} from 'spacekit/src/Scale.js'

Set the number of units per AU.

Params:

NameTypeAttributeDescription
val *

public sexagesimalToDecimalDec(decDeg: *, decMin: *, decSec: *, isObserverBelowEquator: boolean): * source

import {sexagesimalToDecimalDec} from 'spacekit/src/Units.js'

Params:

NameTypeAttributeDescription
decDeg *
decMin *
decSec *
isObserverBelowEquator boolean
  • optional
  • default: false

Return:

*

public sexagesimalToDecimalRa(raHour: *, raMin: *, raSec: *): * source

import {sexagesimalToDecimalRa} from 'spacekit/src/Units.js'

Params:

NameTypeAttributeDescription
raHour *
raMin *
raSec *

Return:

*

public sphericalToCartesian(ra: *, dec: *, dist: *): undefined[] source

import {sphericalToCartesian} from 'spacekit/src/Coordinates.js'

Params:

NameTypeAttributeDescription
ra *
dec *
dist *

Return:

undefined[]