Skip to content

Commit

Permalink
feat: ✨ add toJ2000 method to sensor class
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Jan 21, 2024
1 parent ab40e2b commit ff410bd
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/objects/Sensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@

import { PassType } from '../enums/PassType';
import { SensorParams } from '../interfaces/SensorParams';
import { Degrees, Kilometers, Lookangle, RaeVec3, SpaceObjectType } from '../types/types';
import { Degrees, Kilometers, KilometersPerSecond, Lookangle, RaeVec3, SpaceObjectType } from '../types/types';
import { GroundObject } from './GroundObject';
import { Satellite } from './Satellite';
import { calcGmst, lla2eci, J2000, Vector3D, EpochUTC } from '../main';

export class Sensor extends GroundObject {
minRng: Kilometers;
Expand Down Expand Up @@ -184,6 +185,17 @@ export class Sensor extends GroundObject {
return this.maxRng <= 6000;
}

toJ2000(date: Date = new Date()): J2000 {
const gmst = calcGmst(date).gmst;
const position = lla2eci(this.llaRad(), gmst);

return new J2000(
EpochUTC.fromDateTime(date),
new Vector3D(position.x, position.y, position.z),
new Vector3D(0 as KilometersPerSecond, 0 as KilometersPerSecond, 0 as KilometersPerSecond),
);
}

/**
* Returns the pass type based on the current and previous visibility states.
* @param isInView - Indicates if the object is currently in view.
Expand Down

0 comments on commit ff410bd

Please sign in to comment.