Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,114 changes: 1,887 additions & 1,227 deletions build/spacekit.cjs.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/spacekit.cjs.js.map

Large diffs are not rendered by default.

3,114 changes: 1,887 additions & 1,227 deletions build/spacekit.esm.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/spacekit.esm.js.map

Large diffs are not rendered by default.

3,114 changes: 1,887 additions & 1,227 deletions build/spacekit.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/spacekit.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/typescript/Camera.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as THREE from 'three';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
import type { Coordinate3d } from './Coordinates';
import type { SimulationContext } from './Simulation';
import type { SpaceObject } from './SpaceObject';
Expand Down
10 changes: 3 additions & 7 deletions build/typescript/Camera.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
Expand All @@ -24,7 +20,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
exports.__esModule = true;
var THREE = __importStar(require("three"));
var OrbitControls_1 = require("three/examples/jsm/controls/OrbitControls");
var OrbitControls_js_1 = require("three/examples/jsm/controls/OrbitControls.js");
var Scale_1 = require("./Scale");
/**
* A wrapper for Three.js camera and controls.
Expand All @@ -48,7 +44,7 @@ var Camera = /** @class */ (function () {
// See https://discourse.threejs.org/t/camera-zoom-to-fit-object/936/6
// TODO(ian): Access this better
var renderer = this.context.simulation.getRenderer();
var controls = new OrbitControls_1.OrbitControls(this.camera, renderer.domElement);
var controls = new OrbitControls_js_1.OrbitControls(this.camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.05;
controls.enablePan = true;
Expand Down
4 changes: 2 additions & 2 deletions build/typescript/Ephem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ export declare class Ephem {
* @param {Number} initialValues.epoch Epoch in JD
* @param {Number} initialValues.period Period in days
* @param {Number} initialValues.ma Mean anomaly
* @param {Number} initialValues.n Mean motion
* @param {Number} initialValues.n Mean motion, deg or rad per day (instead of per second)
* @param {Number} initialValues.L Mean longitude
* @param {Number} initialValues.om Longitude of Ascending Node
* @param {Number} initialValues.w Argument of Perihelion
* @param {Number} initialValues.wBar Longitude of Perihelion
* @param {GM} initialValues.GM Standard gravitational parameter in km^3/s^2.
* @param {GM} initialValues.GM Standard gravitational parameter in m^3/s^2 (instead of km^3/s^2).
* Defaults to GM.SUN. @see {GM}
* @param {'deg'|'rad'} units The unit of angles in the list of initial values.
*/
Expand Down
13 changes: 7 additions & 6 deletions build/typescript/Ephem.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ var Ephem = /** @class */ (function () {
* @param {Number} initialValues.epoch Epoch in JD
* @param {Number} initialValues.period Period in days
* @param {Number} initialValues.ma Mean anomaly
* @param {Number} initialValues.n Mean motion
* @param {Number} initialValues.n Mean motion, deg or rad per day (instead of per second)
* @param {Number} initialValues.L Mean longitude
* @param {Number} initialValues.om Longitude of Ascending Node
* @param {Number} initialValues.w Argument of Perihelion
* @param {Number} initialValues.wBar Longitude of Perihelion
* @param {GM} initialValues.GM Standard gravitational parameter in km^3/s^2.
* @param {GM} initialValues.GM Standard gravitational parameter in m^3/s^2 (instead of km^3/s^2).
* Defaults to GM.SUN. @see {GM}
* @param {'deg'|'rad'} units The unit of angles in the list of initial values.
*/
Expand All @@ -101,7 +101,7 @@ var Ephem = /** @class */ (function () {
this.attrs.GM = exports.GM.SUN;
}
this.fill();
if (this.get('e') > 0.9 && typeof this.getUnsafe('tp') === 'undefined') {
if (this.get('e') >= 0.999 && typeof this.getUnsafe('tp') === 'undefined') {
console.warn('You must specify "tp" (time of perihelion) for highly eccentric orbits');
}
this.locked = locked;
Expand All @@ -118,7 +118,7 @@ var Ephem = /** @class */ (function () {
throw new Error('Attempted to modify locked (immutable) Ephem object');
}
if (!EPHEM_VALID_ATTRS.has(attr)) {
console.warn("Invalid ephem attr: ".concat(attr));
console.warn("Invalid ephem attr: " + attr);
return false;
}
// Store everything in radians.
Expand Down Expand Up @@ -161,7 +161,7 @@ var Ephem = /** @class */ (function () {
var retVal = this.getUnsafe(attr, units);
if (typeof retVal === 'undefined') {
console.info(this.attrs);
throw new Error("Attempted to get ephemeris value '".concat(attr, "' but it was undefined"));
throw new Error("Attempted to get ephemeris value '" + attr + "' but it was undefined");
}
return retVal;
};
Expand Down Expand Up @@ -266,7 +266,8 @@ var Ephem = /** @class */ (function () {
i: this.getUnsafe('i'),
om: this.getUnsafe('om'),
ma: this.getUnsafe('ma'),
w: this.getUnsafe('w')
w: this.getUnsafe('w'),
period: this.getUnsafe('period')
}, 'rad');
};
return Ephem;
Expand Down
34 changes: 21 additions & 13 deletions build/typescript/EphemPresets.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ exports.EphemPresets = {
i: 7.003891682749818,
om: 4.830774804443502e1,
w: 2.917940253442659e1,
ma: 2.56190975209273e2
ma: 2.56190975209273e2,
period: 87.969257
}, 'deg', true /* locked */),
VENUS: new Ephem_1.Ephem({
epoch: 2458426.5,
Expand All @@ -34,7 +35,8 @@ exports.EphemPresets = {
i: 3.394567787211735,
om: 7.662534150657346e1,
w: 5.474567447560867e1,
ma: 2.756687596099721e2
ma: 2.756687596099721e2,
period: 224.70079922
}, 'deg', true /* locked */),
EARTH: new Ephem_1.Ephem({
// Taken from https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html
Expand All @@ -54,11 +56,11 @@ exports.EphemPresets = {
i: -0.00001531,
om: 0.0,
wBar: 102.93768193,
L: 100.46457166
L: 100.46457166,
period: 365.256363004
}, 'deg', true /* locked */),
MOON: new Ephem_1.Ephem({
// https://nssdc.gsfc.nasa.gov/planetary/factsheet/moonfact.html
GM: 0.3986e6,
GM: Ephem_1.GM.EARTH_MOON,
// Geocentric
// https://ssd.jpl.nasa.gov/horizons.cgi#results
epoch: 2458621.5,
Expand All @@ -67,7 +69,8 @@ exports.EphemPresets = {
i: 5.102060246928811,
om: 1.085916732144811e2,
w: 6.180561793729225e1,
ma: 5.053270083636792e1
ma: 5.053270083636792e1,
period: 27.321582
}, 'deg', true /* locked */),
MARS: new Ephem_1.Ephem({
epoch: 2458426.5,
Expand All @@ -76,7 +79,8 @@ exports.EphemPresets = {
i: 1.848141099825311,
om: 4.950420572080223e1,
w: 2.866965847685386e2,
ma: 2.538237617924876e1
ma: 2.538237617924876e1,
period: 686.98
}, 'deg', true /* locked */),
JUPITER: new Ephem_1.Ephem({
epoch: 2458426.5,
Expand All @@ -85,7 +89,8 @@ exports.EphemPresets = {
i: 1.303560894624275,
om: 1.005203828847816e2,
w: 2.73736301845404e2,
ma: 2.31939544389401e2
ma: 2.31939544389401e2,
period: 4332.589
}, 'deg', true /* locked */),
SATURN: new Ephem_1.Ephem({
epoch: 2458426.5,
Expand All @@ -94,7 +99,8 @@ exports.EphemPresets = {
i: 2.482782449972317,
om: 1.136154964073247e2,
w: 3.394422648650336e2,
ma: 1.870970898012944e2
ma: 1.870970898012944e2,
period: 10755.698
}, 'deg', true /* locked */),
URANUS: new Ephem_1.Ephem({
epoch: 2458426.5,
Expand All @@ -103,7 +109,8 @@ exports.EphemPresets = {
i: 7.697511134483724e-1,
om: 7.414239045667875e1,
w: 9.942704504702185e1,
ma: 2.202603033874267e2
ma: 2.202603033874267e2,
period: 30685.4
}, 'deg', true /* locked */),
NEPTUNE: new Ephem_1.Ephem({
epoch: 2458426.5,
Expand All @@ -112,7 +119,8 @@ exports.EphemPresets = {
i: 1.774569249829094,
om: 1.318695882492132e2,
w: 2.586226409499831e2,
ma: 3.152804988924479e2
ma: 3.152804988924479e2,
period: 60189
}, 'deg', true /* locked */),
PLUTO: new Ephem_1.Ephem({
epoch: 2454000.5,
Expand Down Expand Up @@ -168,7 +176,7 @@ var NaturalSatellites = /** @class */ (function () {
*/
break;
default:
console.warn("Ephemeris type not yet implemented: ".concat(ephemType));
console.warn("Ephemeris type not yet implemented: " + ephemType);
return;
}
var ephemGM;
Expand All @@ -183,7 +191,7 @@ var NaturalSatellites = /** @class */ (function () {
ephemGM = Ephem_1.GM[moon.Planet.toUpperCase()];
}
if (!ephemGM) {
console.error("Could not look up GM for ".concat(moon.Planet));
console.error("Could not look up GM for " + moon.Planet);
}
var ephem = new Ephem_1.Ephem({
GM: ephemGM,
Expand Down
14 changes: 11 additions & 3 deletions build/typescript/EphemerisTable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ declare type DistanceUnits = 'au' | 'km';
declare type TimeUnits = 'day' | 'sec';
interface EphemerisTableData {
data: number[][];
ephemerisType: EphemType;
ephemerisType?: EphemType;
distanceUnits: DistanceUnits;
timeUnits: TimeUnits;
interpolationType: InterpolationType;
interpolationOrder: number;
interpolationType?: InterpolationType;
interpolationOrder?: number;
}
/**
* This class encapsulates the data and necessary methods for operating with look up ephemeris data.
Expand All @@ -38,6 +38,14 @@ export declare class EphemerisTable {
* @param {Number} ephemerisData.interpolationOrder the order of the interpolator to use (defaults to 5)
*/
constructor(ephemerisData: EphemerisTableData);
/**
* Returns the first Julian date in the ephemeris table.
*/
getStartJd(): number;
/**
* Returns the last Julian date in the ephemeris table.
*/
getStopJd(): number;
/**
* Calculates the interpolated position for the given requested date. If the requested date is before the first
* point it returns the first point. If the requested date is after the last point it returns the last point.
Expand Down
28 changes: 18 additions & 10 deletions build/typescript/EphemerisTable.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
Expand Down Expand Up @@ -81,32 +77,32 @@ var EphemerisTable = /** @class */ (function () {
this.data = JSON.parse(JSON.stringify(ephemerisData.data));
if (ephemerisData.distanceUnits) {
if (!DISTANCE_UNITS.has(ephemerisData.distanceUnits)) {
throw new Error("Unknown distance units: ".concat(ephemerisData.distanceUnits));
throw new Error("Unknown distance units: " + ephemerisData.distanceUnits);
}
this.units.distance = ephemerisData.distanceUnits;
}
if (ephemerisData.timeUnits) {
if (!TIME_UNITS.has(ephemerisData.timeUnits)) {
throw new Error("Unknown time units: ".concat(ephemerisData.timeUnits));
throw new Error("Unknown time units: " + ephemerisData.timeUnits);
}
this.units.time = ephemerisData.timeUnits;
}
if (ephemerisData.ephemerisType) {
if (!EPHEM_TYPES.has(ephemerisData.ephemerisType)) {
throw new Error("Unknown ephemeris type: ".concat(ephemerisData.ephemerisType));
throw new Error("Unknown ephemeris type: " + ephemerisData.ephemerisType);
}
this.ephemType = ephemerisData.ephemerisType;
}
if (ephemerisData.interpolationType) {
if (!INTERPOLATION_TYPES.has(ephemerisData.interpolationType)) {
throw new Error("Unknown interpolation type: ".concat(ephemerisData.interpolationType));
throw new Error("Unknown interpolation type: " + ephemerisData.interpolationType);
}
this.interpolationType = ephemerisData.interpolationType;
}
if (ephemerisData.interpolationOrder !== undefined) {
if (ephemerisData.interpolationOrder < 1 ||
ephemerisData.interpolationOrder > MAX_INTERPOLATION_ORDER) {
throw new Error("Interpolation order must be >0 and <".concat(MAX_INTERPOLATION_ORDER, ": ").concat(ephemerisData.interpolationOrder));
throw new Error("Interpolation order must be >0 and <" + MAX_INTERPOLATION_ORDER + ": " + ephemerisData.interpolationOrder);
}
this.interpolationOrder = ephemerisData.interpolationOrder;
}
Expand All @@ -124,6 +120,18 @@ var EphemerisTable = /** @class */ (function () {
});
}
}
/**
* Returns the first Julian date in the ephemeris table.
*/
EphemerisTable.prototype.getStartJd = function () {
return this.data[0][0];
};
/**
* Returns the last Julian date in the ephemeris table.
*/
EphemerisTable.prototype.getStopJd = function () {
return this.data[this.data.length - 1][0];
};
/**
* Calculates the interpolated position for the given requested date. If the requested date is before the first
* point it returns the first point. If the requested date is after the last point it returns the last point.
Expand Down
28 changes: 26 additions & 2 deletions build/typescript/KeplerParticles.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as THREE from 'three';
import { Coordinate3d } from './Coordinates';
import type { Ephem } from './Ephem';
import type { Simulation } from './Simulation';
import { Simulation, SimulationObject } from "./Simulation";
interface BaseKeplerParticleOptions {
color?: number;
textureUrl?: string;
Expand All @@ -20,7 +20,7 @@ declare type KeplerParticleOptions = BaseKeplerParticleOptions & {
* Primarily used by Simulation to render all non-static objects.
* @see Simulation
*/
export declare class KeplerParticles {
export declare class KeplerParticles implements SimulationObject {
static instanceCount: number;
private id;
private options;
Expand Down Expand Up @@ -60,6 +60,26 @@ export declare class KeplerParticles {
* @param offset
*/
hideParticle(offset: number): void;
/**
* Shows a previously hidden particle.
* @param offset
*/
showParticle(offset: number): void;
isParticleVisible(offset: number): boolean;
/**
* Shows a previously hidden particle.
* @param is_visible
* @param offset
*/
setParticleVisibility(is_visible: boolean, offset: number): void;
/**
* Is at least one particle visible?
*/
isVisible(): boolean;
/**
* Hide or show all particles globally using the parent object visible property.
*/
setVisibility(value: boolean): void;
/**
* Changes the size of the particle at the given offset to the given size. Setting the size to 0 hides the particle.
* @param {Number} size The new size of this particle
Expand Down Expand Up @@ -93,5 +113,9 @@ export declare class KeplerParticles {
* @return {String} Unique id
*/
getId(): string;
/**
* Free all GPU resources
*/
removalCleanup(): void;
}
export {};
Loading