Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ jobs:
distro: ${{ matrix.distro }}
install: |
apt-get update -q -y
apt-get install -q -y make gcc gfortran
run: make test
apt-get install -q -y make gcc g++ gfortran
run: |
export ENABLE_CPP=1
make test

test-macos:
name: Test on MacOS
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

## [Unreleased]

Upcoming maintenance release, possibly around 1 August 2026.
Upcoming feature release, possibly around 1 August 2026.

### Added

- #316: Spherical offset positions along a grat circle in specified direction and distance, based on the __astropy__
`offset_by()` function. Added `novas_offset_by()`, `novas_equ_offset_by()` functions; and `Equatorial::offset()`,
`Ecliptic::offset()`, `Galactic::offset()`, and `Horizontal::offset()` methods. (thanks to aleberti)

- #318: New functions to check for effective equality of data structures, within typical tolerances of the library.
The functions are in `cmp.c`, and have names `novas_equals_[...]()`.

- #318: `CatalogEntry`, `OrbitalSystem`, `Orbital`, `Source`, `Observer`, and `Frame` now have `equals()` methods
as well as overridden `==` and `!=` operators, thanks to the new C99 comparison functions.

### Changed

- #317: Avoid `memcmp()` in testing structs for equality, using new comparison functions instead.

- #318: `Vector::equals()` to use the new `novas_equals_vector()` for consitent implementation between the C99 and
C++ APIs.

- Improved CMake installation of examples (no unintended files, C++ examples only if `ENABLE_CPP` option is used).

- Adjust C++ testing precision on tests that can trip up, depending on the platform.
Expand All @@ -32,6 +43,7 @@ Upcoming maintenance release, possibly around 1 August 2026.
- `examples/Makefile` to work standalone, without `config.mk`.

- Fix wrong argument types in error traces of `Source` and `Ecliptic` (found by CodeQL).



## [1.6.0] - 2026-04-27
Expand Down
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ endif
SOURCES = target.c observer.c earth.c equator.c system.c transform.c cio.c \
orbital.c spectral.c grav.c nutation.c timescale.c frames.c place.c \
calendar.c refract.c naif.c parse.c util.c planets.c itrf.c \
ephemeris.c solsys3.c solsys-ephem.c moon.c
ephemeris.c solsys3.c solsys-ephem.c moon.c cmp.c

# Generate a list of object (obj/*.o) files from the input sources
OBJECTS := $(addprefix $(OBJ)/,$(subst .c,.o,$(SOURCES)))
Expand Down
40 changes: 39 additions & 1 deletion include/novas.h
Original file line number Diff line number Diff line change
Expand Up @@ -3384,7 +3384,7 @@ int novas_icrs_to_sys(const double *in, double jd_tdb, enum novas_accuracy accur
int novas_sys_to_icrs(enum novas_reference_system sys, const double *in, double jd_tdb, enum novas_accuracy accuracy, double *out);


// ---------------------- Added in 1.6.0 -------------------------
// ---------------------- Added in 1.7.0 -------------------------

// in util.c
/// @c_util
Expand All @@ -3393,6 +3393,44 @@ int novas_offset_by(double lon, double lat, double direction, double distance, d
/// @c_util
int novas_equ_offset_by(double ra, double dec, double direction, double distance, double *restrict out_ra, double *restrict out_dec);

// in cmp.c
/// @c_util
int novas_equals_vector(const double *a, const double *b, double tol);

/// @c_time
int novas_equals_timespec(const novas_timespec *a, const novas_timespec *b);

/// @c_observer
int novas_equals_on_surface(const on_surface *a, const on_surface *b);

/// @c_observer
int novas_equals_near_earth(const in_space *a, const in_space *b);

/// @c_observer
int novas_equals_ssb_posvel(const in_space *a, const in_space *b);

/// @c_observer
int novas_equals_observer(const observer *a, const observer *b);

/// @c_source
int novas_equals_cat_entry(const cat_entry *a, const cat_entry *b);

/// @c_source
int novas_equals_orbsys(const novas_orbital_system *a, const novas_orbital_system *b);

/// @c_source
int novas_equals_orbital(const novas_orbital *a, const novas_orbital *b);

/// @c_source
int novas_equals_object(const object *a, const object *b);

/// @c_apparent
int novas_equals_sky_pos(const sky_pos *a, const sky_pos *b);

int novas_equals_planet_bundle(const novas_planet_bundle *a, const novas_planet_bundle *b);

/// @c_frame
int novas_equals_frame(const novas_frame *a, const novas_frame *b);

// <================= END of SuperNOVAS API =====================>

Expand Down
40 changes: 39 additions & 1 deletion include/supernovas.h
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,12 @@ class Observer : public Validating {

virtual bool is_geocentric() const;

virtual bool equals(const Observer& other) const;

bool operator==(const Observer& other) const;

bool operator!=(const Observer& other) const;

/// @ingroup frame
Frame frame_at(const Time& time, enum novas_accuracy accuracy = NOVAS_FULL_ACCURACY) const;

Expand Down Expand Up @@ -1547,6 +1553,8 @@ class GeodeticObserver : public Observer {

bool is_geodetic() const override;

bool equals(const Observer& other) const override;

Site site() const;

Velocity itrs_velocity() const;
Expand Down Expand Up @@ -1932,6 +1940,12 @@ class Frame : public Validating {

Frame& operator=(const Frame& frame);

bool equals(const Frame& other) const;

bool operator==(const Frame& other) const;

bool operator!=(const Frame& other) const;

const novas_frame* _novas_frame() const;

enum novas_accuracy accuracy() const;
Expand Down Expand Up @@ -1997,6 +2011,12 @@ class Source : public Validating {

enum novas_object_type type() const;

bool equals(const Source& other) const;

bool operator==(const Source &other) const;

bool operator!=(const Source &other) const;

/// @ingroup apparent
Apparent apparent_in(const Frame &frame) const;

Expand Down Expand Up @@ -2054,7 +2074,7 @@ class Source : public Validating {
class CatalogEntry : public Validating {
private:
cat_entry _entry = {}; ///< stored catalog entry
Equinox _sys; ///< stored catalog system
Equinox _sys; ///< stored catalog system

void validate(const char *loc);

Expand All @@ -2069,6 +2089,12 @@ class CatalogEntry : public Validating {

const cat_entry* _cat_entry() const;

bool equals(const CatalogEntry& other) const;

bool operator==(const CatalogEntry& other) const;

bool operator!=(const CatalogEntry& other) const;

const Equinox& system() const;

std::string name() const;
Expand Down Expand Up @@ -2291,6 +2317,12 @@ class OrbitalSystem : public Validating {
public:
const novas_orbital_system * _novas_orbital_system() const;

bool equals(const OrbitalSystem& other) const;

bool operator==(const OrbitalSystem& other) const;

bool operator!=(const OrbitalSystem& other) const;

Planet center() const;

Angle obliquity() const;
Expand Down Expand Up @@ -2361,6 +2393,12 @@ class Orbital : public Validating {
static Orbital from_mean_motion(const OrbitalSystem& system, const Time& ref_time, const Coordinate& semi_major, const Angle& mean_anomaly,
double rad_per_s);

bool equals(const Orbital& other) const;

bool operator==(const Orbital& other) const;

bool operator!=(const Orbital& other) const;

const novas_orbital * _novas_orbital() const;

OrbitalSystem system() const;
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ set(SUPERNOVAS_CORE_SOURCES
solsys3.c
solsys-ephem.c
moon.c
cmp.c
)


Expand Down
Loading
Loading