Skip to content

Commit

Permalink
refactor: ♻️ standardize eci and rae methods
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Jan 13, 2024
1 parent b1515cb commit 5581a18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/objects/Star.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ export class Star extends BaseObject {
this.vmag = info.vmag;
}

getEci(lla: LlaVec3 = { lat: <Degrees>180, lon: <Degrees>0, alt: <Kilometers>0 }, date: Date = this.time): EciVec3 {
const rae = this.getRae(lla, date);
eci(lla: LlaVec3 = { lat: <Degrees>180, lon: <Degrees>0, alt: <Kilometers>0 }, date: Date = this.time): EciVec3 {
const rae = this.rae(lla, date);
const { gmst } = Star.calculateTimeVariables_(date);

// Arbitrary distance to enable using ECI coordinates
return ecf2eci(rae2ecf(rae, { lat: <Degrees>0, lon: <Degrees>0, alt: <Kilometers>0 }), gmst);
}

getRae(
rae(
lla: LlaVec3<Degrees, Kilometers> = { lat: <Degrees>180, lon: <Degrees>0, alt: <Kilometers>0 },
date: Date = this.time,
): RaeVec3 {
Expand Down
7 changes: 3 additions & 4 deletions test/objects/star.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* @since 3.0.0
*/

import { Degrees, Kilometers, Radians } from '../../lib/index';
import { Star } from '../../lib/objects';
import { Degrees, Kilometers, Radians, Star } from '../../lib/index';

describe('Basic Star functionality', () => {
const star = new Star({
Expand All @@ -15,7 +14,7 @@ describe('Basic Star functionality', () => {
});

it('should be able to get rae coordinates', () => {
const rae = star.getRae(
const rae = star.rae(
{
lat: <Degrees>0,
lon: <Degrees>0,
Expand All @@ -30,7 +29,7 @@ describe('Basic Star functionality', () => {
});

it('should be able to get ECI coordinates', () => {
const eci = star.getEci(
const eci = star.eci(
{
lat: <Degrees>0,
lon: <Degrees>0,
Expand Down

0 comments on commit 5581a18

Please sign in to comment.