I can’t find any example about this function, and apparently Simon1994PlanetaryPositions returns wrong position for Sun and Moon.
My sandcastle.
Gray and Yellow: Simon1994 pointing (wrong)
Red and Orange: suncalc and mooncalc pointing (right)
Cesium does put the Moon and the Sun in the right positions… but WHERE does it store them and how can I access them?
And how can I access lookAtMoon()? viewer.scene.lookAtMoon() does not work.
I found that rather than using lookAtMoon, I can just reuse its algorithm (but I am still curious about how to access any function which I can find in the source code):
var specificTime = Cesium.JulianDate.fromDate(new Date(Date.UTC(2024, 7, 31, 4, 0, 0))); // Define custom time
viewer.clock.currentTime = specificTime; // apply to view
const icrfToFixed = new Cesium.Matrix3(); // Setup Matrix to convert from ICRF reference to Fixed reference
Cesium.Transforms.computeTemeToPseudoFixedMatrix(specificTime, icrfToFixed); /// Use time to setup the conversion matrix
var moonPos = Cesium.Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(specificTime); // Use time to calculate Moon position in ICRF reference
Cesium.Matrix3.multiplyByVector(icrfToFixed, moonPos, moonPos); //Convert moon position from ICRF to Fixed reference
Alternative syntax:
var specificTime = Cesium.JulianDate.fromDate(new Date(Date.UTC(2024, 7, 31, 4, 0, 0))); // Define custom time
viewer.clock.currentTime = specificTime; // apply to view
var icrfToFixed = new Cesium.Transforms.computeTemeToPseudoFixedMatrix(specificTime); /// Use time to make the conversion
var moonPos = Cesium.Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(specificTime); // Use time to calculate Moon position in ICRF reference
var fixedPos = new Cesium.Matrix3.multiplyByVector(icrfToFixed, moonPos,new Cesium.Cartesian3()); //Convert moon position from ICRF to Fixed reference
Sandcastle: link