Commit Graph

2238 Commits

Author SHA1 Message Date
Don Cross
e487fa651f Go: added function InverseRotation. 2023-10-26 10:51:19 -04:00
Don Cross
af53f189e8 Go: added function IdentityMatrix. 2023-10-26 10:37:13 -04:00
Don Cross
ba62eea34f Go: added bodyState type and exportState function. 2023-10-26 10:32:15 -04:00
Don Cross
66e40d825f Go: added user-defined stars
Internal type: starDef
Internal array variable: starTable
Functions:

    getStar
    userDefinedStar
    DefineStar
2023-10-26 10:25:16 -04:00
Don Cross
a9179ed22a Go: added nutation, state vector, and rotation matrix functions.
Added the following functions to Go:

    nutationRot
    nutation
    nutationPosVel
    RotateState
    CombineRotation
    RotationEqdEqj
2023-10-25 17:26:30 -04:00
Don Cross
c850481306 Go: added calcShadow and vector dot product. 2023-10-25 16:44:39 -04:00
Don Cross
e393349b4e Go: SiderealTime
Fixed a bug in the Earth Tilt function etilt.
Implemented the SiderealTime function.
2023-10-08 15:38:51 -04:00
Don Cross
774b636dac Go: iau2000b, etilt, era.
More low-level functions necessary to calculating Earth orientation.
iau2000b calculates nutation angles.
etilt calculates overall axial tilt of the Earth.
era calculates the Earth Rotation Angle.
2023-10-08 09:56:42 -04:00
Don Cross
6cc0b8cfb0 Go: Atmosphere function 2023-10-07 20:27:00 -04:00
Don Cross
2393bb327e Go: GeoMoon calculates the Moon's geocentric position. 2023-10-07 15:05:12 -04:00
Don Cross
1b53dd60ac Go: added more functions
I'm working toward implementing the GeoMoon function.
I added the following, which are all required to get to that point.

meanObliq
eclOblToEquVec
eclToEquVec
precessionRot
precession
RotateVector
2023-10-06 21:12:44 -04:00
Don Cross
9a500abe2a Go: added functions DaysFromCalendar, TimeFromCalendar. Also added more documentation. 2023-10-06 20:32:34 -04:00
Don Cross
ad1969b80c Corrected mistake in function dependencies: missing CalcEvent. 2023-10-06 16:24:35 -04:00
Don Cross
e38e7d5e25 Go: added function CalendarFromDays.
Added the function CalendarFromDays, which converts a UT value to
a calendar date and time.

Added script `rungo` which is a shortcut for compiling and testing
changes to the Go source code template.
2023-10-06 14:01:05 -04:00
Don Cross
d9cb9d6ed2 Go: added some vector and angle functions.
Added functions:
    DegreesFromRadians
    RadiansFromDegrees
    AngleBetween
    StateVector.Position
    StateVector.Velocity

Changed existing functions to pass structs by value,
just like we do in the C code. This is a safety feature
to signal value semantics and a contract not to mutate the
argument state.

Run Go tests with the -v option to log more info about what's happening.
2023-10-05 21:28:11 -04:00
Don Cross
4941fbb5de Go: generate constellation tables. 2023-10-04 22:02:00 -04:00
Don Cross
5560102463 Improved contributor source editing experience by improved code generator markers.
I suddenly realized today that I could eliminate lots of red wavy
lines in the source editor when working on generate/template/astronomy.*
files, by tweaking the $ASTRO_... tokens to look like comments.
For some reason, I didn't think of doing this before now.
I was motivated by the Go language support, where the tokens were
breaking `go fmt`.
2023-10-04 20:58:56 -04:00
Don Cross
92dd08e4c4 Add Go to the front-page table of supported languages.
Added SVG logo for Go.
Added a table entry for Go examples, source, and documentation.
Sorted the language list in alphabetical order: moved Python last.
2023-10-04 19:44:18 -04:00
Don Cross
033d23f3cb Windows: correct CRLF line endings in golang README.md. 2023-10-04 17:18:42 -04:00
Don Cross
0df81a7ff6 Specify explicit paths for gomarkdoc.
I need gomarkdoc to generate identical output whether
I run it locally or in GitHub Actions, to verify that the
build process is working correctly. Hopefully these options
will do the trick.
2023-10-04 16:27:31 -04:00
Don Cross
adfed93417 Attempting to install Go with environment variables in GitHub Actions. 2023-10-04 15:40:49 -04:00
Don Cross
21001da8c1 Use gomarkdoc to generate Markdown documentation for the Go source. 2023-10-04 15:05:20 -04:00
Don Cross
cebe749c2a Go: reworking documentation comments in Go Doc format.
Following the standard comment format for documentation
comments in Go:

https://go.dev/doc/comment

Later we will figure out how to generate online documentation
from these comments.
2023-10-04 12:48:54 -04:00
Don Cross
b9c5bcbda2 Go: implemented AddDays function. 2023-10-03 21:49:12 -04:00
Don Cross
aed52531f0 Created a spreadsheet of function dependencies for planning Go implementation. 2023-10-03 17:22:17 -04:00
Don Cross
46a3ed4a9b Merge branch 'master' into golang 2023-10-03 14:15:39 -04:00
Don Cross
520a532531 Test Python demos in Windows also.
Before now, the Python demos were tested in Linux and Mac.
Now they are tested in the Windows environment also.
This will be helpful for any contributors who may wish
to use Windows as a development platform for the Python
version of Astronomy Engine.
2023-10-03 13:41:05 -04:00
Don Cross
871c26abde Enforce strict type checking in all Python demo programs.
Use mypy to check all Python demo programs.
Updated the demos to pass type checking.
There were a couple of small mistakes found, so this was worth the effort.
2023-10-03 11:49:04 -04:00
Don Cross
bbaf5bf544 Added Python demo: solar_eclipse.py
This demo calculates the next 10 solar eclipses that are
visible from a given location on the Earth, after a given date.
2023-10-03 11:17:32 -04:00
Don Cross
c7095c5038 Added Python demo ecliptic_of_date.
The demo program ecliptic_of_date.py shows how to
calculate the true ecliptic of date (ECT) angular coordinates
of the Sun, Moon, and planets for an observer somewhere on the Earth.
It calculates the equatorial of date (EQD) coordinates, then uses
a rotation matrix to convert the vector to ECT, then converts
the vector to spherical coordinates: latitude, longitude, and distance.
2023-10-02 16:36:56 -04:00
Don Cross
9756c1ebe0 Go: use standard naming conventions, remove "status" fields.
In Go, all symbols should use PascalCase or camelCase.
Go programmers dislike ALL_UPPER_CASE_WITH_UNDERSCORES.
Use PascalCase for exported/public symbols, camelCase for internal/private symbols.

In general, we should follow the Go Style Guide:
https://google.github.io/styleguide/go/index

I recommend we more closely follow the implementation of the C# code
than the C code for figuring out how to name things.
The C# version of Astronomy Engine is a better reference because
Go allows quasi-object-oriented syntax and uses a similar preferred naming style.

We will use idiomatic error reporting and handling, as described here:
https://go.dev/blog/error-handling-and-go
I removed the "status" fields from all the structs, and deleted
the enumerated type astroStatus. I will add a custom error type later,
and report human-readable error messages as is preferred by Go programmers.
2023-10-01 11:44:23 -04:00
Don Cross
6262375510 Define *.go as ending with LF characters. 2023-10-01 08:02:04 -04:00
Don Cross
42e6be60a8 I learned that Go source is always supposed to have CR line endings, even on Windows. 2023-09-30 22:04:54 -04:00
Don Cross
53f8ae3e45 Fixed typo in filename in makedoc.bat 2023-09-30 21:22:47 -04:00
Don Cross
b41a940ece I had a build failure in Windows due to LF/CRLF in Go source.
I'm not sure this is going to fix the error, because I'm not
sure how 'go fmt' works. I'm hoping that if I fix the newlines
in the generated code, then format it, under Windows it will
end up exactly like what git does to normalize the line endings
when we clone the repo.
2023-09-30 19:49:30 -04:00
Don Cross
d6565550ac Add unit test framework for Go. 2023-09-30 19:15:17 -04:00
Don Cross
a3ee98f870 Merge branch 'master' into golang 2023-09-30 16:08:58 -04:00
Don Cross
4c5e66ab33 Merge branch 'danny_golang' into golang 2023-09-30 15:52:44 -04:00
Don Cross
968770e960 Use golang's source formatter to ensure our code is tidy. 2023-09-30 15:52:24 -04:00
Don Cross
17af457d9d Go: add go.mod, and update code generator.
Rework astronomy.go as a module named "astronomy".
Provide a go.mod to define the module.
Add Go as a known programming language to the code generator.
2023-09-30 15:34:05 -04:00
danny
a7d5f79dad add astro_time_t and test TerrestrialTime 2023-09-30 00:35:16 +03:30
Don Cross
3cf4065126 Minor C code style suggestion from cppcheck. 2023-09-21 17:42:53 -04:00
Don Cross
9975edc81b Updated star database to HYG v 3.6.1. 2023-09-21 15:41:03 -04:00
Don Cross
f4405e390c Updated star database to HYG v 3.5.1.
This change affects internal unit testing only.
It does not affect developers who use Astronomy Engine.
Upgraded the HYG database used for verification of
constellation calculations to v 3.5.1.

See conversation at:
https://github.com/astronexus/HYG-Database/issues/21
2023-09-19 15:08:49 -04:00
Don Cross
054985606e Revert "Use _FORTIFY_SOURCE=3 to improve C/C++ code verification."
This reverts commit a7e747c100.
This broke the GitHub Actions automated tests, because they
are using gcc 11 (which does not support level 3 fortification),
and they already predefine another fortification level.

I realize this would also hinder other contributors who
are not using gcc 12. At least I tried it once on my own
system and didn't find any problems, which is nice.
2023-09-11 15:02:14 -04:00
Don Cross
a7e747c100 Use _FORTIFY_SOURCE=3 to improve C/C++ code verification. 2023-09-11 14:48:44 -04:00
Don Cross
056076b85a Merge pull request #316 from KJ7LNW/master
Support microsecond time resolution
2023-08-28 15:20:08 -04:00
Don Cross
82b531d210 Merge branch 'master' into master 2023-08-28 15:19:25 -04:00
Don Cross
4c1c31cf56 Merge branch 'microsecond' 2023-08-28 15:12:44 -04:00
Don Cross
c247250df7 C Windows: use GetSystemTimePreciseAsFileTime.
It turns out that GetSystemTimeAsFileTime only returns
time with millisecond resolution.
In order to get microsecond resolution in Astronomy_CurrentTime(),
I had to switch to GetSystemTimePreciseAsFileTime for Windows.

Example output from unit test:

C Test_AstroTime: PASS - realtime increment = 3.143e-07 seconds after 1 iterations.
2023-08-28 14:32:43 -04:00