Javastro / jsofa

Java translation of IAU SOFA library
Other
18 stars 4 forks source link

possible jauPlan94 array indexes inversion #2

Closed zdomjus60 closed 7 years ago

zdomjus60 commented 7 years ago

Hi @pahjbo thank you fou your excellent translation work. Using the function mentioned in title, I had a crash error until I found that maybe the javadoc has an incorrect indexing of the pv array. In your javadoc documentation: Parameters: date1 - double TDB date part A (Note 1) date2 - double TDB date part B (Note 1) np - int planet (1=Mercury, 2=Venus, 3=EMB, 4=Mars, 5=Jupiter, 6=Saturn, 7=Uranus, 8=Neptune) Returned (argument): pv - double[3][2] (returned) planet p,v (heliocentric, J2000.0, AU,AU/d)

The original SOFA documentation says:

Given: date1 double TDB date part A (Note 1) date2 double TDB date part B (Note 1) np int planet (1=Mercury, 2=Venus, 3=EMB, 4=Mars, 5=Jupiter, 6=Saturn, 7=Uranus, 8=Neptune) Returned (argument): pv double[2][3] planet p,v (heliocentric, J2000.0, au,au/d) Returned (function value): int status: -1 = illegal NP (outside 1-8) 0 = OK +1 = warning: year outside 1000-3000 ** +2 = warning: failed to converge

Can you please check it? Thank you

pahjbo commented 7 years ago

you are correct that the documentation is incorrect (but the code is OK) as for Java the double[2][3] is the necessary declaration of two 3-vectors. I will fix the documentation in the repository, but will not create a new release, as this is a relatively minor issue that can wait until the next (functionality enhancing) release.