Instead of using decimal hours/degrees rounded to 4 decimal places,
I went back to the original constel.c and modified it to represent
both RA and DEC in degrees, and to round all values to the nearest
quarter arcminute. This seems closer to the original intent of the
constellation boundaries.
I'm using the HYG star database v3 from:
https://github.com/astronexus/HYG-Database
I compare the star constellations it reports against
what I calculate from the star RA/DEC it lists.
When I try this against all stars in the database, I
find 25 disagreements about which constellation contains
the star. Another person found 3 disagreements. See:
https://github.com/astronexus/HYG-Database/issues/21
For now, I'm testing only the stars brighter than mag 4.890,
which eliminates all the disagreements, and still gets me
over 1000 test cases.
Also, now I'm verifying ephemeris file and star database
checksums whether or not they have just been downloaded.
The idea is to catch corruption or unexpected changes
each time I run the unit test.
This unit test only exercises 8 different points.
I want to add a more thorough unit test soon, before
moving on to implementing the constellation finder in
the other supported programming languages.
Can now calculate the heliocentric Solar System Barycenter (SSB)
and Earth/Moon Barycenter (EMB).
Changes made in C, C#, JavaScript and Python:
Added new body codes SSB, EMB.
Added support for calculating both in HelioVector functions.
Verified that all calculations match NOVAS.
Verified that all calculations match each other across languages.
Adjust VSOP models for planets to bring their prediction errors beneath
0.1 degrees of a total orbit.
ctest no longer runs tests when no command line arguments are given.
That was annoying because I kept running it by accident.
Include an extra 4 terms in the radial component of the VSOP
model for Neptune. The code automatically picks the 4 terms
that maximize the time derivative's highest possible contribution.
Because of Sun/SSB wobble, can't use slope solver to find
Neptune apsides. Added special case logic to find them
using more of a brute force algorithm.
Unit tests now pass, but require very loose tolerances
for the outer planets.
I will have to adjust the model generator to create
more accurate heliocentric distance models for the VSOP
planets, and more accurate Chebyshev polynomials for Pluto.
This will be a judgment call to balance accuracy versus code size.
Use planet apsis test data generated by generate.c to verify
Astronomy Engine calculations. Currently this fails for Neptune
as expected. Will fix that in a future commit.
Implemented a more efficient function Astronomy_HelioDistance
for calculating heliocentric distances of the planets
Mercury through Neptune: use VSOP distance formula only.
For Moon and Pluto, fall back to calculating heliocentric
vector and then finding the length of that vector.
More work on new functions for converting orientation systems.
Changed a few classes to structs for memory allocation efficiency.
Moved stuff around in astronomy.cs so the Astronomy class comes
last. This is helpful when I want to add new functions, so I
don't have to search for the end of the class.
Currently I ignore any errors when checking the C# documentation,
because there are broken links for the rotation functions I
haven't started adding yet. I will turn that error check back on
once I finish those functions.
Instead of having the same calculations duplicated in both
nutation() and nutation_rot(), I reworked nutation() in terms of
nutation_rot(). Use nutation_rot() to calculate the rotation matrix,
then multiply that matrix by the input vector to produce the output vector.
The gcc-6 compiler in travis-ci has changed its behavior.
It is warning that 'fmid' local variable in Search() may
be used uninitialized. I believe it is safe but I'm adding
an initialization to fmid to make the warning go away.
I need a way to undo a refraction correction:
given a post-refraction altitude, find the unrefracted
altitude that leads to it. Starting to write the code.
Not finished yet.
These are the final 4 rotation functions to complete every
possible coordinate transform.
Finished unit tests of verifying that all triangular
cycles of transitive rotation are consistent.
Astronomy_CombineRotation was multiplying matrices correctly,
but it was doing it in the backwards order from what I need.
I forgot that to rotate a vector V by a matrix M, you multiply M*V,
with the matrix on the left.
Likewise, to rotate a matrix A by another matrix B, you need B*A, not A*B.
This explains why I was seeing larger than expected errors combining
nutation and precession: nutation is a very tiny shift in orientation,
so the errors were small but noticeable. Tightened the error thresholds
in the unit test code.
Astronomy_Rotation_HOR_EQJ converts from horizontal of-date coordinates
to equatorial J2000 coordinates. Here I could no longer ignore the
errors caused by having backwards matrix multiplication, leading
to discovering the problem in Astronomy_CombineRotation.
Astronomy_HorizonFromVector is a specialized variant of
Astronomy_SphereFromVector that flips the orientation of the
azimuth angle to the more traditional clockwise-from-north
direction used in navigation and cartography.
It also allows the same optional refraction correction as
Astronomy_Horizon.
Astronomy_Rotation_EQD_HOR converts a equatorial-of-date vector
to a horizontal vector. The horizontal vector has the following
components:
x = North
y = West
z = Zenith
Removed trailing whitespace in generate.c.
This function returns the constant rotation matrix that converts
equatorial J2000 coordinates to ecliptic J2000 coordinates.
Verified that it is exactly consistent with existing Ecliptic().
Astronomy_RotateVector translates a vector in one orientation
to another orientation, as specified by a rotation matrix.
I will use this to implement all the coordinate transforms
among EQJ, EQD, ECL, HOR.
Added new data type astro_spherical_t that represents generic spherical coordinates.
Implemented Astronomy_VectorFromSphere to convert spherical coordinates
to Cartesian coordinates. Included unit test to verify it is working as expected.
Beginning to implement functions for converting among the
following four orientation systems:
- EQJ: equatorial J2000
- EQD: equatorial of date
- ECL: ecliptic J2000
- HOR: horizontal
Starting with some basic functions for manipulating rotation matrices.
Astronomy_CombineRotation multiplies two rotation matrices to obtain
a third that combines their effects in order. I will use these for
combining a precession matrix and a nutation matrix, to obtain a
rotation matrix that can convert between EQJ and EQD.
Astronomy_InverseRotation will allow converting in either direction
between two orientations.