Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | 150x 149x 150x 1x 1x 1x 90x 90x 90x 90x 90x 90x 90x 90x 90x 90x 90x 1x 90x 90x 90x 90x 90x 90x 90x 90x 90x 90x 1x 1x 1x 90x 90x 90x 90x 90x 90x 90x 90x | import Cartesian3 from "./Cartesian3.js";
import defined from "./defined.js";
import Iau2000Orientation from "./Iau2000Orientation.js";
import JulianDate from "./JulianDate.js";
import CesiumMath from "./Math.js";
import Matrix3 from "./Matrix3.js";
import Quaternion from "./Quaternion.js";
/**
* The Axes representing the orientation of a Globe as represented by the data
* from the IAU/IAG Working Group reports on rotational elements.
* @alias IauOrientationAxes
* @constructor
*
* @param {IauOrientationAxes.ComputeFunction} [computeFunction] The function that computes the {@link IauOrientationParameters} given a {@link JulianDate}.
*
* @see Iau2000Orientation
*
* @private
*/
function IauOrientationAxes(computeFunction) {
if (!defined(computeFunction) || typeof computeFunction !== "function") {
computeFunction = Iau2000Orientation.ComputeMoon;
}
this._computeFunction = computeFunction;
}
const xAxisScratch = new Cartesian3();
const yAxisScratch = new Cartesian3();
const zAxisScratch = new Cartesian3();
function computeRotationMatrix(alpha, delta, result) {
const xAxis = xAxisScratch;
xAxis.x = Math.cos(alpha + CesiumMath.PI_OVER_TWO);
xAxis.y = Math.sin(alpha + CesiumMath.PI_OVER_TWO);
xAxis.z = 0.0;
const cosDec = Math.cos(delta);
const zAxis = zAxisScratch;
zAxis.x = cosDec * Math.cos(alpha);
zAxis.y = cosDec * Math.sin(alpha);
zAxis.z = Math.sin(delta);
const yAxis = Cartesian3.cross(zAxis, xAxis, yAxisScratch);
if (!defined(result)) {
result = new Matrix3();
}
result[0] = xAxis.x;
result[1] = yAxis.x;
result[2] = zAxis.x;
result[3] = xAxis.y;
result[4] = yAxis.y;
result[5] = zAxis.y;
result[6] = xAxis.z;
result[7] = yAxis.z;
result[8] = zAxis.z;
return result;
}
const rotMtxScratch = new Matrix3();
const quatScratch = new Quaternion();
/**
* Computes a rotation from ICRF to a Globe's Fixed axes.
*
* @param {JulianDate} date The date to evaluate the matrix.
* @param {Matrix3} result The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new instance of the rotation from ICRF to Fixed.
*/
IauOrientationAxes.prototype.evaluate = function (date, result) {
Iif (!defined(date)) {
date = JulianDate.now();
}
const alphaDeltaW = this._computeFunction(date);
const precMtx = computeRotationMatrix(
alphaDeltaW.rightAscension,
alphaDeltaW.declination,
result,
);
const rot = CesiumMath.zeroToTwoPi(alphaDeltaW.rotation);
const quat = Quaternion.fromAxisAngle(Cartesian3.UNIT_Z, rot, quatScratch);
const rotMtx = Matrix3.fromQuaternion(
Quaternion.conjugate(quat, quat),
rotMtxScratch,
);
const cbi2cbf = Matrix3.multiply(rotMtx, precMtx, precMtx);
return cbi2cbf;
};
/**
* A function that computes the {@link IauOrientationParameters} for a {@link JulianDate}.
* @callback IauOrientationAxes.ComputeFunction
* @param {JulianDate} date The date to evaluate the parameters.
* @returns {IauOrientationParameters} The orientation parameters.
* @private
*/
export default IauOrientationAxes;
|