Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.0.1 #12

Merged
merged 3 commits into from
Jan 16, 2024
Merged
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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v1.0.0](https://github.com/thkruz/ootk-core/compare/v1.0.0-5...v1.0.0)
#### [v1.0.1](https://github.com/thkruz/ootk-core/compare/v1.0.0...v1.0.1)



- refactor: :label: add more typing for Seconds in Epoch calculations [`0419a86`](https://github.com/thkruz/ootk-core/commit/0419a86e4eaa8e29f2281bbee3b3b01f559ec7f4)
- refactor: :label: improve type support in Vector3D [`e3d3e3a`](https://github.com/thkruz/ootk-core/commit/e3d3e3a1abcd3fcb2832b1cce4d0e40e41db2d35)

### [v1.0.0](https://github.com/thkruz/ootk-core/compare/v1.0.0-5...v1.0.0)

> 15 January 2024


- refactor: :recycle: standardize rng az el syntax [`59f7f53`](https://github.com/thkruz/ootk-core/commit/59f7f53c497d75bda2bf049c20e67d5191d586d7)
- build: :memo: add auto changelog [`8abc50c`](https://github.com/thkruz/ootk-core/commit/8abc50cd4eb4b437cbea0ccaad9df5853257c386)
- docs: :memo: update examples [`f27b230`](https://github.com/thkruz/ootk-core/commit/f27b230dfa0fb7440a81859b4057ab8d21b97ed6)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ootk-core",
"version": "1.0.0",
"version": "1.0.1",
"type": "module",
"module": "dist/main.js",
"description": "Orbital Object Toolkit. A modern typed replacement for satellite.js including SGP4 propagation, TLE parsing, Sun and Moon calculations, and more.",
Expand Down
3 changes: 2 additions & 1 deletion src/body/Sun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
RAD2DEG,
RaDec,
Radians,
Seconds,
SunTime,
TAU,
Vector3D,
Expand Down Expand Up @@ -522,7 +523,7 @@ export class Sun {
const distance = Sun.position(epoch).magnitude();
const dSec = distance / cKmPerSec;

return Sun.position(epoch.roll(-dSec));
return Sun.position(epoch.roll(-dSec as Seconds));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/coordinate/Tle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export class Tle {
}
const days = parseFloat(epochStr.substring(2, 14)) - 1;

return EpochUTC.fromDateTimeString(`${year}-01-01T00:00:00.000Z`).roll(days * secondsPerDay);
return EpochUTC.fromDateTimeString(`${year}-01-01T00:00:00.000Z`).roll(days * secondsPerDay as Seconds);
}

/**
Expand Down
20 changes: 10 additions & 10 deletions src/operations/Vector3D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* SOFTWARE.
*/

import { Kilometers, Radians, linearDistance } from '../main';
import { Radians, linearDistance } from '../main';
import { Matrix } from './Matrix';
import { Vector } from './Vector';

Expand Down Expand Up @@ -125,36 +125,36 @@ export class Vector3D<T extends number = number> {
}

// / Return a copy of this [Vector3D] scaled by [n];
scale(n: number): Vector3D {
return new Vector3D(this.x * n, this.y * n, this.z * n);
scale(n: number): Vector3D<T> {
return new Vector3D<T>(this.x * n as T, this.y * n as T, this.z * n as T);
}

// / Return a copy of this [Vector3D] with the elements negated.
negate(): Vector3D<Kilometers> {
return this.scale(-1) as Vector3D<Kilometers>;
negate(): Vector3D<T> {
return this.scale(-1);
}

/**
* Return the Euclidean distance between this and another Vector3D.
* @param v The other Vector3D.
* @returns The distance between this and the other Vector3D.
*/
distance(v: Vector3D): number {
distance(v: Vector3D<T>): T {
return linearDistance(this, v);
}

/**
* Convert this to a unit Vector3D.
* @returns A unit Vector3D.
*/
normalize(): Vector3D {
normalize(): Vector3D<T> {
const m = this.magnitude();

if (m === 0) {
return Vector3D.origin;
return Vector3D.origin as Vector3D<T>;
}

return new Vector3D(this.x / m, this.y / m, this.z / m);
return new Vector3D<T>(this.x / m as T, this.y / m as T, this.z / m as T);
}

// Calculate the dot product of this and another [Vector3D].
Expand Down Expand Up @@ -259,7 +259,7 @@ export class Vector3D<T extends number = number> {
}

// / Return the unit vector that bisects this and another [Vector3D].
bisect(v: Vector3D): Vector3D {
bisect(v: Vector3D<T>): Vector3D<T> {
return this.scale(v.magnitude()).add(v.scale(this.magnitude())).normalize();
}

Expand Down
7 changes: 4 additions & 3 deletions src/time/EpochGPS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* SOFTWARE.
*/

import { Seconds } from '../main';
import { DataHandler } from '../data/DataHandler';
import { secondsPerWeek } from '../utils/constants';
import type { EpochUTC } from './EpochUTC';
Expand All @@ -41,7 +42,7 @@
throw new Error('GPS seconds must be within a week.');
}

// TODO: #9 Set EpochGPS.reference statically without circular dependency.

Check warning on line 45 in src/time/EpochGPS.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO: #9 Set EpochGPS.reference...'
EpochGPS.reference = reference;
}

Expand All @@ -49,7 +50,7 @@
static reference: EpochUTC;

// / GPS leap second difference from TAI/UTC offsets.
static offset = 19;
static offset = 19 as Seconds;

// / Get GPS week accounting for 10-bit rollover.
get week10Bit(): number {
Expand All @@ -67,9 +68,9 @@

// / Convert this to a UTC epoch.
toUTC(): EpochUTC {
const init = EpochGPS.reference.roll(this.week * secondsPerWeek + this.seconds);
const init = EpochGPS.reference.roll((this.week * secondsPerWeek + this.seconds) as Seconds);
const ls = DataHandler.getInstance().getLeapSeconds(init.toJulianDate());

return init.roll(-(ls - EpochGPS.offset));
return init.roll(-(ls - EpochGPS.offset) as Seconds);
}
}
9 changes: 5 additions & 4 deletions src/time/EpochUTC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* SOFTWARE.
*/

import { Seconds } from '../main';
import { DEG2RAD, MS_PER_DAY, RAD2DEG, secondsPerWeek, TAU } from '../utils/constants';
import { evalPoly } from '../utils/functions';
import { DataHandler } from './../data/DataHandler';
Expand Down Expand Up @@ -67,11 +68,11 @@ export class EpochUTC extends Epoch {
return new EpochUTC(new Date(dts).getTime() / 1000);
}

static fromJ2000TTSeconds(seconds: number): EpochUTC {
static fromJ2000TTSeconds(seconds: Seconds): EpochUTC {
const tInit = new EpochUTC(seconds + 946728000);
const ls = DataHandler.getInstance().getLeapSeconds(tInit.toJulianDate());

return tInit.roll(-32.184 - ls);
return tInit.roll(-32.184 - ls as Seconds);
}

static fromDefinitiveString(definitiveString: string): EpochUTC {
Expand All @@ -87,7 +88,7 @@ export class EpochUTC extends Epoch {
return new EpochUTC(dts / 1000);
}

roll(seconds: number): EpochUTC {
roll(seconds: Seconds): EpochUTC {
return new EpochUTC(this.posix + seconds);
}

Expand Down Expand Up @@ -121,7 +122,7 @@ export class EpochUTC extends Epoch {
toGPS(): EpochGPS {
const referenceTime = EpochUTC.fromDateTimeString('1980-01-06T00:00:00.000Z');
const ls = DataHandler.getInstance().getLeapSeconds(this.toJulianDate());
const delta = this.roll(ls - EpochGPS.offset).difference(referenceTime);
const delta = this.roll(ls - EpochGPS.offset as Seconds).difference(referenceTime);
const week = delta / secondsPerWeek;
const weekFloor = Math.floor(week);
const seconds = (week - weekFloor) * secondsPerWeek;
Expand Down
3 changes: 0 additions & 3 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"module": "es6",
"lib": ["esnext"],
"declaration": true,
// "noImplicitAny": true,
// "removeComments": true,
"baseUrl": ".",
"allowJs": true,
"experimentalDecorators": true,
Expand All @@ -17,7 +15,6 @@
"listFiles": true,
"newLine": "LF",
"skipLibCheck": true,
// "noEmitOnError": true,
"types": ["jest", "node"],
"moduleResolution": "Node",
"esModuleInterop": true
Expand Down
2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@
},
"include": ["./src/**/*.ts", "./test/**/*.ts"],
"filesGlob": ["./src/**/*.ts", "./test/**/*.ts"],
"ignorePatterns": ["./src/sgp4/asc/**/*.ts"],
"exclude": ["./src/sgp4/asc/assembly/index.ts"]
}