34 lines
921 B
JavaScript
34 lines
921 B
JavaScript
/*!
|
|
* satellite-js v5.0.0
|
|
* (c) 2013 Shashwat Kandadai and UCSC
|
|
* https://github.com/shashwatak/satellite-js
|
|
* License: MIT
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports["default"] = dopplerFactor;
|
|
function dopplerFactor(location, position, velocity) {
|
|
var mfactor = 7.292115E-5;
|
|
var c = 299792.458; // Speed of light in km/s
|
|
|
|
var range = {
|
|
x: position.x - location.x,
|
|
y: position.y - location.y,
|
|
z: position.z - location.z
|
|
};
|
|
range.w = Math.sqrt(Math.pow(range.x, 2) + Math.pow(range.y, 2) + Math.pow(range.z, 2));
|
|
var rangeVel = {
|
|
x: velocity.x + mfactor * location.y,
|
|
y: velocity.y - mfactor * location.x,
|
|
z: velocity.z
|
|
};
|
|
function sign(value) {
|
|
return value >= 0 ? 1 : -1;
|
|
}
|
|
var rangeRate = (range.x * rangeVel.x + range.y * rangeVel.y + range.z * rangeVel.z) / range.w;
|
|
return 1 + rangeRate / c * sign(rangeRate);
|
|
} |