ootk
Version:
Orbital Object Toolkit including Multiple Propagators, Initial Orbit Determination, and Maneuver Calculations.
46 lines • 2.03 kB
JavaScript
/**
* @author @thkruz Theodore Kruczek
* @license AGPL-3.0-or-later
* @copyright (c) 2025 Kruczek Labs LLC
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
import { Vector3D, Matrix } from '../main.js';
export const radecToPosition = (ra, dec, r) => {
const ca = Math.cos(ra);
const sa = Math.sin(ra);
const cd = Math.cos(dec);
const sd = Math.sin(dec);
return new Vector3D(r * cd * ca, r * cd * sa, r * sd);
};
export const radecToVelocity = (ra, dec, r, raDot, decDot, rDot) => {
const ca = Math.cos(ra);
const sa = Math.sin(ra);
const cd = Math.cos(dec);
const sd = Math.sin(dec);
return new Vector3D(rDot * cd * ca - r * sd * ca * decDot - r * cd * sa * raDot, rDot * cd * sa - r * sd * sa * decDot + r * cd * ca * raDot, rDot * sd + r * cd * decDot);
};
export const normalizeAngle = (a, b) => {
const x = a - b;
return Math.atan2(Math.sin(x), Math.cos(x));
};
export const observationDerivative = (xh, xl, step, isAngle = false) => (isAngle ? normalizeAngle(xh, xl) : xh - xl) / step;
export const observationNoiseFromSigmas = (sigmas) => {
const n = sigmas.length;
const result = Array.from({ length: n }, () => Array(n).fill(0.0));
for (let i = 0; i < n; i++) {
const s = sigmas[i];
result[i][i] = 1 / (s * s);
}
return new Matrix(result);
};
//# sourceMappingURL=ObservationUtils.js.map