Commit Graph

21 Commits

Author SHA1 Message Date
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
fda8426972 Another attempt to build altazsearch.cpp on Mac OS. 2023-06-18 17:44:02 -04:00
Don Cross
890fcf8d3e Fix build problem for altazsearch.cpp on Mac.
The following build error occurred in Mac OS:

Compiling altazsearch.cpp
clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]

Added options to explicitly perform mixed C/C++ programming.
2023-06-18 17:05:07 -04:00
Don Cross
33de407723 Added C++ demo for alt/az window search.
See the following discussion for context:

https://github.com/cosinekitty/astronomy/discussions/308

Added a demo program that shows how to search for when
a body enters a window defined in terms of an observer's
horizontal frame of reference, given a range of altitudes
and a range of azimuths.
2023-06-18 16:14:52 -04:00
Don Cross
86fde0d5cd C demo: Calculate true solar time from the Sun's hour angle. 2023-02-12 12:03:43 -05:00
Don Cross
956ad5fa2d Added demo program: ecliptic_vector.c
This program demonstrates converting equatorial
vectors to ecliptic vectors using a rotation matrix.
2022-05-20 20:17:09 -04:00
Don Cross
efc59ae6fc Refactored demo tests.
I refactored the unit tests for all the demo programs
to follow a different pattern that makes it simpler
to add more demo tests in the future.

The main thing is that correct output and generated
output are now in separate directories `correct` and `test`.
I have moved the test scripts from `test/test` to `./demotest`
in all the langauge demo directories.

This makes it simpler to clean up any stale generated
files before each test run by `rm -f test/*.txt`.

I stumbled across this while making the Java demo tests,
and it was a better solution, so now all the other languages
are consistent with the Java demo tests.

In the C demo tests, I also decided to compile all the
binary executables into a subdirectory `bin` that can
be cleaned out before each run, to make sure there are
no stale executables from an earlier run.
2022-04-30 21:01:11 -04:00
Don Cross
37084a156d C Earth gravity calculation.
Implemented the C function Astronomy_ObserverGravity.
It implements the WGS 84 Ellipsoidal Gravity Formula,
yielding the effective observed gravitational acceleration
at a location on or above the Earth's surface.
Wrote a demo program that also serves as a unit test.
I verified a few of the calculations, so the file
demo/c/test/gravity_correct.txt also serves as correct
unit test output.
2021-07-19 14:23:27 -04:00
Don Cross
2eec19fc23 Implemented C version of demo 'triangulate'.
Just like the Python version, this program calculates
the best-fit intersection point for two lines of sight
as seen by two observers. It demonstrates converting
back and forth between geographic coordinates and
geocentric vectors.
2021-06-22 10:50:47 -04:00
Don Cross
9287fedec1 Added demo galactic.c for converting GAL to HOR.
This demo program converts galactic coordinates to
local altitude an azimuth for a given geographic
location and time.
2021-06-14 11:36:14 -04:00
Don Cross
fcd6ec4d05 Starting to work on support for camera orientation in the C version.
Added C function Astronomy_Pivot to transform a rotation matrix
by rotating it around one of its coordinate axes by a given angle.

Added C function Astronomy_IdentityMatrix that just returns
an identity matrix that can be used as the starting point in
a series of transforms.

C function Astronomy_Equator now also returns the topocentric
equatorial location in the form of a cartesian vector.
This is in a new member of the astro_equatorial_t struct
called 'vec'.

The unit test in ctest.c "Rotation_Pivot()" could be improved
with more and better tests.

Created a demo program camera.c that illustrates using
Astronomy_Pivot() to help calculate the tilt of the sunlit
side of the Moon, as seen by a camera pointing right at it.
The resulting tilt angle is not yet verified.
I need to have some confirmation that it is correct before
porting to the other languages.
2021-03-22 22:30:04 -04:00
Don Cross
b779a6aeca Added linux_riseset.c, a variation of riseset.c.
This new demo shows how to calculate rise and set times
of the Sun and Moon in local time, using Linux functions.
It also sorts the events in chronological order.
2020-09-08 21:40:05 -04:00
Don Cross
d9e2ea5816 Added C version of lunar eclipse demo.
Also added better comments to Python version.
2020-05-17 13:02:18 -04:00
Don Cross
c008dcdff6 Finished C demo program horizon.c.
This program demonstrates converting ecliptic coordinates
to horizontal coordinates at a given time for a given observer.
It searches for the two locations on the horizon where the
ecliptic plane intersects it.
2019-12-12 12:35:00 -05:00
Don Cross
743394b6d7 Added C example: culminate. 2019-06-18 21:00:57 -04:00
Don Cross
ab642feb21 Added C example: calculating seasons. 2019-06-16 20:39:40 -04:00
Don Cross
3558f43d48 Added C example: rise and set times for Sun and Moon. 2019-06-14 21:50:26 -04:00
Don Cross
d476465b6d Actually test moonphase.js and moonphase.c. Test after generating code. 2019-06-13 21:38:27 -04:00
Don Cross
19c81b4897 Build example program positions.c in Linux. 2019-06-11 20:51:02 -04:00
Don Cross
9ed995e462 Added C function Astronomy_CurrentTime(). Added C moon phase demo. 2019-05-25 21:18:24 -04:00