Commit Graph

2245 Commits

Author SHA1 Message Date
Don Cross
6876aee963 Working on Test_RotRoundTrip, a unit test to exercise all orientation transforms.
The idea in this test will be to verify that all the transitive
sequences of rotations produce consistent results.
Currently, I verify that the supported translations produce
an identity matrix when composed with their inverses.
2019-12-09 15:34:14 -05:00
Don Cross
4c368f3d75 C: Implemented Astronomy_Rotation_EQJ_HOR. 2019-12-09 14:45:04 -05:00
Don Cross
cdcdfe7762 Fixed bug in Astronomy_CombineRotation. Implemented Astronomy_Rotation_HOR_EQJ.
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.
2019-12-09 12:47:43 -05:00
Don Cross
0aa80dbf6f C: Implemented Astronomy_Rotation_HOR_EQD. 2019-12-09 11:18:15 -05:00
Don Cross
4399e72334 Added Astronomy_HorizonFromVector, Astronomy_Rotation_EQD_HOR.
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.
2019-12-09 11:06:02 -05:00
Don Cross
212c60b633 C: Implemented Astronomy_Rotation_EQD_EQJ. 2019-12-08 20:41:01 -05:00
Don Cross
78da9a9879 Added C rotation test to the Windows version of the unit test. 2019-12-08 20:30:38 -05:00
Don Cross
e6b4b75ac0 Added extra sanity checks for rotation matrices.
All rotation matrices must have unit vectors for all rows and columns.
2019-12-08 20:04:25 -05:00
Don Cross
cd545033ae C: Added Astronomy_Rotation_EQJ_EQD(). 2019-12-08 19:48:43 -05:00
Don Cross
bf7e958152 C: Implemented Astronomy_Rotation_ECL_EQJ.
This function returns the rotation matrix for
converting ecliptic J2000 coordinates to equatorial J2000.
2019-12-08 16:44:43 -05:00
Don Cross
dd39803180 C: Implemented Astronomy_Rotation_EQJ_ECL.
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().
2019-12-08 15:49:29 -05:00
Don Cross
f493707e6d C: Implemented Astronomy_RotateVector.
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.
2019-12-08 15:13:55 -05:00
Don Cross
65e3e931c9 C: Implemented Astronomy_SphereFromVector.
Implemented C function that converts cartesian vector to spherical coordinates.
2019-12-08 14:17:23 -05:00
Don Cross
bca3f808ae C: Added Astronomy_VectorFromSphere, astro_spherical_t.
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.
2019-12-08 13:48:27 -05:00
Don Cross
63ae582893 ctest: Added unit test for Astronomy_InverseRotation. 2019-12-08 11:43:42 -05:00
Don Cross
59c442a1ce ctest: Factored out function for verifying that two matrices are equal. 2019-12-08 11:38:11 -05:00
Don Cross
ae0946bd47 Implemented C versions of Astronomy_CombineRotation, Astronomy_InverseRotation.
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.
2019-12-08 11:26:59 -05:00
Don Cross
0aeb875ec5 C#: Implemented SearchPeakMagnitude. 2019-12-01 11:41:48 -05:00
Don Cross
fb251cf263 C#: Added unit test for Saturn illumination. 2019-12-01 10:50:26 -05:00
Don Cross
efd1629e9a C#: Implemented Illumination(). Not fully tested yet.
The unit test exercises Illumination() except for Saturn.
Will implement that next.
2019-12-01 10:27:40 -05:00
Don Cross
5ca590b176 Script to help me verify that functions exist in all languages. 2019-11-30 15:03:41 -05:00
Don Cross
df12a2c8c8 C#: Added SearchLunarApsis, NextLunarApsis. 2019-11-27 22:13:52 -05:00
Don Cross
943db81ca3 C lunar apsis test was not verifying apsis.kind.
This was a gap in the test coverage that would have allowed
the C version of Astronomy_SearchLunarApsis() or
Astronomy_NextLunarApsis() to return an invalid 'kind' field.
2019-11-27 20:50:19 -05:00
Don Cross
655b9bca46 C#: Implemented functions Elongation and SearchMaxElongation. 2019-11-06 18:50:06 -05:00
Don Cross
915f1007c3 C# - Added TestPlanetLongitudes tests. 2019-11-06 14:21:48 -05:00
Don Cross
e4c14816aa Merge branch 'csharp' of github.com:cosinekitty/astronomy into csharp 2019-11-05 22:25:16 -05:00
Don Cross
af106481f6 C#: Implemented SearchRelativeLongitude. 2019-11-05 22:12:21 -05:00
Don Cross
8a2957f441 Diff C# output against C output in Windows. 2019-11-05 19:44:40 -05:00
Don Cross
162f3c5683 C#: Added SearchHourAngle and SearchRiseSet. 2019-11-03 15:33:30 -05:00
Don Cross
fd0bc0f48a Ported MoonTest from C to C#. 2019-10-31 20:28:20 -04:00
Don Cross
d9f447a7a4 C#: Added moon phase/quarter search functions. 2019-10-30 22:14:54 -04:00
Don Cross
d4d8063f6f C#: verified seasons finder. 2019-10-29 21:38:47 -04:00
Don Cross
a449818c13 C#: work in progress : starting to implement search functions. 2019-10-29 20:41:56 -04:00
Don Cross
ced78fd910 Starting to work on C# SeasonTest. Parses input file. 2019-10-29 12:23:43 -04:00
Don Cross
b085c9b489 Validated that C# and C test output are identical within tolerance. 2019-10-29 12:01:57 -04:00
Don Cross
904037a126 C#: Implemented geocentric moon calculation. Passes unit tests. 2019-10-28 15:37:46 -04:00
Don Cross
5acf8230cd C#: Fixed bugs and validated Horizon().
Fixed bug in C# version nutation().
Need to write observer location to C# output file.
Now Horizon output verifies.
2019-10-28 13:47:46 -04:00
Don Cross
c92ac89986 C#: Added Horizon function. Fixed a couple of things in the C code. 2019-10-28 10:25:40 -04:00
Don Cross
9955fbd3f9 Implemented most of Equator(), GeoVector() functions.
Still need to implement moon calculations and associated code.
Reworked AstroVector as a struct instead of a class, to reduce
memory allocation overhead.
2019-10-27 21:02:00 -04:00
Don Cross
aae37b25e0 C#: Verified calculation of heliocentric vectors. 2019-10-25 17:20:50 -04:00
Don Cross
0bbbd06177 C#: Implemented Chebyshev calculations for Pluto. 2019-10-25 16:00:52 -04:00
Don Cross
b49973bec3 C# code generator adds whitespace for proper code indenting. 2019-10-25 15:09:45 -04:00
Don Cross
4173c88e63 C#: implemented VSOP code generator and CalcVsop function. Not yet tested. 2019-10-25 14:06:19 -04:00
Don Cross
c88c73437b C#: Adding more data structures and documentation. 2019-10-25 13:11:49 -04:00
Don Cross
8f3c348613 Added dotnet/csharp unit tests to Windows build. 2019-10-24 22:44:24 -04:00
Don Cross
eabbd4b628 Added stub documentation of all C# public symbols.
This is just to get build errors to go away.
Will have to come back and flesh out all of the documentation
once I start working on the C# documentation generator.
2019-10-24 22:36:18 -04:00
Don Cross
e7ae0288c1 C# work in progress - broken build checked in on purpose.
I'm checking in a broken build on purpose in this topic branch
so that I can move the work over to my Windows machine and use
Visual Studio to help with formatting XML comments.
2019-10-24 22:00:35 -04:00
Don Cross
2b1abb399a Implemented C# time functions and added unit tests for them. 2019-10-24 14:17:08 -04:00
Don Cross
6bbafac9d9 Removed trailing whitespace from ctest.c. 2019-10-24 14:11:38 -04:00
Don Cross
2846481d1b Starting to define class AstroTime. 2019-10-10 15:52:28 -04:00