saturnmoons, jupitermoons - add Z-coord output#40
Conversation
Add the `Z`-coordinate to the computed positions of the moons, so that transits, eclipses, occultations, and shadow transits can be more easily computed. At this moment we do not know of any published "official" Z-values to check against, so we use whatever values would satisfy the test at the moment and hard-code them into the test files.
dobriai
left a comment
There was a problem hiding this comment.
OK, this is all I can think of for now. Let know what next!
| * Result in seconds of time. | ||
| * @param {Number} dist - distance in to earth in AU | ||
| * @returns {Number} time for light to travel a given distance in seconds | ||
| * @returns {Number} time for light to travel a given distance in days |
There was a problem hiding this comment.
This is unrelated to the rest of the PR, of course. Just caught my eye. Somehow.
| const r4 = 26.3627 - 0.1939 * cH | ||
| const sDE = Math.sin(DE) | ||
| const cDE = Math.cos(DE) | ||
| const xy = function (u, r) { |
There was a problem hiding this comment.
This local function could also be renamed, but I decided to minimize the diffs, to make the PR easier to review. Cleanup could be done later. Or now, if you prefer.
| const xy = function (u, r) { | ||
| const [su, cu] = base.sincos(u) | ||
| return new XY(r * su, -r * cu * sDE) | ||
| return new XYZ(r * su, -r * cu * sDE, -r * cu * cDE) |
There was a problem hiding this comment.
Z does not come entirely "for free" here. This is what I think that it should be based on the X and Y formulas on p.303, namely:
X = r * sin(u), Y = -r * cos(u) * sin(D_e)
thus Z = -r * cos(u) * cos(D_e).
We have X^2 + Y^2 + Z^2 = r^2, which is good.
The sign should be negative, based on the statements "...Z is negative if the satellite is closer to Earth...", on pp.313 and 333.
Finally the values appear quite close to the high-precision ones, from the e5 calculations, which gives me the greatest comfort.
|
@dobriai Many thanks. |
Add the
Z-coordinate to the computed positions of the moons, so that transits, eclipses, occultations, and shadow transits can be more easily computed.At this moment we do not know of any published "official" Z-values to check against, so we use whatever values would satisfy the test at the moment and hard-code them into the test files.