-
Notifications
You must be signed in to change notification settings - Fork 31
saturnmoons, jupitermoons - add Z-coord output #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,13 +22,15 @@ export const callisto = 3 | |
| const k = [17295, 21819, 27558, 36548] | ||
|
|
||
| /** | ||
| * XY used for returning coordinates of moons. | ||
| * XYZ used for returning coordinates of moons. | ||
| * @param {number} x - in units of Jupiter radii | ||
| * @param {number} y - in units of Jupiter radii | ||
| * @param {number} z - in units of Jupiter radii | ||
| */ | ||
| function XY (x, y) { | ||
| function XYZ (x, y, z) { | ||
| this.x = x | ||
| this.y = y | ||
| this.z = z | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -37,7 +39,7 @@ function XY (x, y) { | |
| * Returned coordinates are in units of Jupiter radii. | ||
| * | ||
| * @param {Number} jde - Julian ephemeris day | ||
| * @return {Array} x, y - coordinates of the 4 Satellites of jupiter | ||
| * @return {Array} x, y, z - coordinates of the 4 Satellites of jupiter | ||
| */ | ||
| export function positions (jde) { | ||
| const d = jde - base.J2000 | ||
|
|
@@ -83,9 +85,10 @@ export function positions (jde) { | |
| const r3 = 14.9883 - 0.0216 * cG | ||
| const r4 = 26.3627 - 0.1939 * cH | ||
| const sDE = Math.sin(DE) | ||
| const cDE = Math.cos(DE) | ||
| const xy = function (u, r) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 [su, cu] = base.sincos(u) | ||
| return new XY(r * su, -r * cu * sDE) | ||
| return new XYZ(r * su, -r * cu * sDE, -r * cu * cDE) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
thus We have The sign should be negative, based on the statements "... Finally the values appear quite close to the high-precision ones, from the |
||
| } | ||
| return [xy(u1 + c1, r1), xy(u2 + c2, r2), xy(u3 + c3, r3), xy(u4 + c4, r4)] | ||
| } | ||
|
|
@@ -101,7 +104,7 @@ export function positions (jde) { | |
| * @param {Planet} earth - VSOP87 Planet earth | ||
| * @param {Planet} jupiter - VSOP87 Planet jupiter | ||
| * @param {Array} [pos] - reference to array of positions (same as return value) | ||
| * @return {Array} x, y - coordinates of the 4 Satellites of jupiter | ||
| * @return {Array} x, y, z - coordinates of the 4 Satellites of jupiter | ||
| */ | ||
| export function e5 (jde, earth, jupiter, pos) { | ||
| pos = pos || new Array(4) | ||
|
|
@@ -481,7 +484,7 @@ export function e5 (jde, earth, jupiter, pos) { | |
| x += Math.abs(z) / k[i] * Math.sqrt(1 - d * d) | ||
| // perspective effect | ||
| const W = Δ / (Δ + z / 2095) | ||
| pos[i] = new XY(x * W, y * W) | ||
| pos[i] = new XYZ(x * W, y * W, z) | ||
| } | ||
| return pos | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated to the rest of the PR, of course. Just caught my eye. Somehow.