SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
Loading...
Searching...
No Matches
cmp.c File Reference

Functions

int novas_equals_cat_entry (const cat_entry *a, const cat_entry *b)
 Checks if two catalog entries define the same parameters, within the typical tolerances associated to these.
int novas_equals_frame (const novas_frame *a, const novas_frame *b)
 Checks if two observing frames are essentially the same, within typical tolerances.
int novas_equals_near_earth (const in_space *a, const in_space *b)
 Checks if two near-Earth locations and motions match within 1 mm and 1 mm/s, respectively.
int novas_equals_object (const object *a, const object *b)
 Checks if two astronomical targets are the same within typical tolerances.
int novas_equals_observer (const observer *a, const observer *b)
 Checks if two observers are essentially the same within the tolerances associated to their defining components.
int novas_equals_on_surface (const on_surface *a, const on_surface *b)
 Checks if two geodetic locations, and the weather parameters defined for them, match.
int novas_equals_orbital (const novas_orbital *a, const novas_orbital *b)
 Checks if two Keplerian orbitals match, within typical tolerances.
int novas_equals_orbsys (const novas_orbital_system *a, const novas_orbital_system *b)
 Checks if two orbital systems match within typical tolerances.
int novas_equals_planet_bundle (const novas_planet_bundle *a, const novas_planet_bundle *b)
 Checks if two bundles containing Solar-system baricentric planet positions and velocities are effectively the same.
int novas_equals_sky_pos (const sky_pos *a, const sky_pos *b)
 Checks if two apparent positions on the observer's sky are the same within typical tolerances.
int novas_equals_ssb_posvel (const in_space *a, const in_space *b)
 Checks if two Solar-system locations and motions match within 1 m and ~1 mm/s, respectively.
int novas_equals_timespec (const novas_timespec *a, const novas_timespec *b)
 Checks if two time specifications are the same within 10-7 days (~100 μs).
int novas_equals_vector (const double *a, const double *b, double tol)
 Checks if two 3D vectors are effectively the same, within the specified absolute tolerance.

Detailed Description

Date
Created on May 8, 2026
Author
Attila Kovacs
Since
1.7

Set of functions to check for effective equality between SuperNOVAS data sturctures within typical tolerances.

Function Documentation

◆ novas_equals_cat_entry()

int novas_equals_cat_entry ( const cat_entry * a,
const cat_entry * b )

Checks if two catalog entries define the same parameters, within the typical tolerances associated to these.

For two catalog entries to be equals, they must have matching

  • names (case sensitive)
  • catalog IDs (case sensitive)
  • numerical IDs
  • coordinates within 1 μas.
  • proper motions to within 1 μas / century.
  • parallaxes to within 1 ppm of their geometric mean.
  • radial velocities to withing 1 mm/s.

NOTES:

  • Two NULL (undefined) catalog entries are considered not equal.
  • A catalog entry structure may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aone of the catalog entries
banother catalog entry
Returns
TRUE (1) if the two catalog entries define the same sidereal source effectively, or else FALSE (0).
Since
1.7
Author
Attila Kovacs
See also
novas_equals_object()

References novas_cat_entry::catalog, novas_cat_entry::dec, novas_cat_entry::parallax, novas_cat_entry::promodec, novas_cat_entry::promora, novas_cat_entry::ra, novas_cat_entry::radialvelocity, SIZE_OF_CAT_NAME, SIZE_OF_OBJ_NAME, novas_cat_entry::starname, and novas_cat_entry::starnumber.

Referenced by supernovas::CatalogEntry::equals(), and novas_equals_object().

◆ novas_equals_frame()

int novas_equals_frame ( const novas_frame * a,
const novas_frame * b )

Checks if two observing frames are essentially the same, within typical tolerances.

Two frames are considered equal, if they are both:

  • initialized,
  • represent the same accuracy,
  • for the same observer,
  • at the same time,
  • same polar offsets (for geodetic observers or if defined),
  • and contain the same planetary ephemeris data

all within the typical tolerances associated to these. For non-geodetic observers two frames are considered equal also if both have all NAN (undefined) polar offsets – since polar offsets are not generally required for non-geodetic observing frames.

NOTES:

  • this function does not check the calculated fields of the observing frames, which are assumed to have been left untouched after the called to novas_make_frame(). If the user modifies the calculated fields, they may need additional checks to ensure 'equality' accordingly.
  • Two NULL (undefined) observing frames are considered not equal.
  • An observing frame may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aan observing frame
banother observing frame
Returns
TRUE (1) if the two observing frames are effectively the same, given the tolerances, or else false.
Since
1.7
Author
Attila Kovacs

References novas_frame::accuracy, novas_frame::dx, novas_frame::dy, novas_equals_observer(), novas_equals_planet_bundle(), novas_equals_timespec(), novas_frame::observer, novas_frame::planets, and novas_frame::time.

Referenced by supernovas::Frame::equals().

◆ novas_equals_near_earth()

int novas_equals_near_earth ( const in_space * a,
const in_space * b )

Checks if two near-Earth locations and motions match within 1 mm and 1 mm/s, respectively.

Such near-Earth data structures are used by airborne observers or observers in Earth orbit.

NOTES:

  • Two NULL (undefined) structures are considered not equal.
  • A near-Earth position/velocity structure may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aone near-Earth position/velocity data structure
banother near-Earth position/velocity data structure
Returns
TRUE (1) if the two near-Earth positions and velocities match within 1 mm and 1 mm/s, respectively.
Since
1.7
Author
Attila Kovacs
See also
novas_equals_ssb_posvel(), novas_equals_observer()

References novas_equals_vector(), novas_in_space::sc_pos, and novas_in_space::sc_vel.

Referenced by novas_equals_observer().

◆ novas_equals_object()

int novas_equals_object ( const object * a,
const object * b )

Checks if two astronomical targets are the same within typical tolerances.

Two targets are considered equals only if their types, names (case sensitive), numerical IDs, and defining parameters match within typical tolerances.

NOTES:

  • Two NULL (undefined) objects are considered not equal.
  • An astronomical target structure may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aan astronomical target
banother astronomical target
Returns
TRUE (1) if the two targets are effectively the same, within tolerances, or else FALSE (0).
Since
1.7
Author
Attila Kovacs

References novas_object::name, NOVAS_CATALOG_OBJECT, NOVAS_EPHEM_OBJECT, novas_equals_cat_entry(), novas_equals_orbital(), NOVAS_ORBITAL_OBJECT, NOVAS_PLANET, novas_object::number, novas_object::orbit, SIZE_OF_OBJ_NAME, novas_object::star, and novas_object::type.

Referenced by supernovas::Source::equals().

◆ novas_equals_observer()

int novas_equals_observer ( const observer * a,
const observer * b )

Checks if two observers are essentially the same within the tolerances associated to their defining components.

NOTES:

  • Two NULL (undefined) observers are considered not equal.
  • An observer structure may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aan observer data structure
banother observer data structure
Returns
TRUE (1) if the two data structures describe effectively the same observer location, within the typical tolerances associated to them, or else FALSE (0).
Since
1.7
Author
Attila Kovacs

References novas_observer::near_earth, NOVAS_AIRBORNE_OBSERVER, novas_equals_near_earth(), novas_equals_on_surface(), novas_equals_ssb_posvel(), NOVAS_OBSERVER_AT_GEOCENTER, NOVAS_OBSERVER_IN_EARTH_ORBIT, NOVAS_OBSERVER_ON_EARTH, NOVAS_SOLAR_SYSTEM_OBSERVER, novas_observer::on_surf, and novas_observer::where.

Referenced by supernovas::Observer::equals(), and novas_equals_frame().

◆ novas_equals_on_surface()

int novas_equals_on_surface ( const on_surface * a,
const on_surface * b )

Checks if two geodetic locations, and the weather parameters defined for them, match.

For two on_surface structures to be equal, they must have matching:

  • longitude and latitude angles to within 1 μas.
  • altitudes within 1 mm.
  • temperatures within 1 mK.
  • pressures within 1 μbar
  • humidities within 0.001 %

NOTES:

  • Two NULL (undefined) structures are considered not equal.
  • A geodetic location + local weather structure may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aone geodetic location (with weather)
banother geodetic location (with weather)
Returns
TRUE (1) if the two locations and their weather parameters match within the described tolerances, or else FALSE (0).
Since
1.7
Author
Attila Kovacs
See also
novas_equals_observer()

References novas_on_surface::height, novas_on_surface::humidity, novas_on_surface::latitude, novas_on_surface::longitude, novas_on_surface::pressure, and novas_on_surface::temperature.

Referenced by novas_equals_observer().

◆ novas_equals_orbital()

int novas_equals_orbital ( const novas_orbital * a,
const novas_orbital * b )

Checks if two Keplerian orbitals match, within typical tolerances.

For two orbitals to be considered equal, they must have matching orbital systems, have the same reference dates to within ~10 ms (see novas_time_equals()), and:

  • angular parameters must match to within 1 μas.
  • semi-major axis must match to within 1 m.
  • eccentricity must match to within 10-12 time the geometric mean of the two semi-major axes.
  • mean motion must match to within 1 μas / cy.
  • apsis and node periods must match to within ~10 ms (see novas_time_equals())

NOTES:

  • Two NULL (undefined) orbitals are considered not equal.
  • Sn orbital elements structure may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aone set of Keplerian orbital parameters
banother set of Keplerian orbital parameters
Returns
TRUE (1) if the two Keplerian orbitals are effectively the same, within tolerances, or else FALSE (0).
Since
1.7
Author
Attila Kovacs
See also
novas_equals_object()

References novas_orbital::a, novas_orbital::apsis_period, novas_orbital::e, novas_orbital::i, novas_orbital::jd_tdb, novas_orbital::M0, novas_orbital::n, novas_orbital::node_period, NOVAS_AU, novas_equals_orbsys(), novas_orbital::Omega, novas_orbital::omega, and novas_orbital::system.

Referenced by supernovas::Orbital::equals(), and novas_equals_object().

◆ novas_equals_orbsys()

int novas_equals_orbsys ( const novas_orbital_system * a,
const novas_orbital_system * b )

Checks if two orbital systems match within typical tolerances.

Two orbital system are considered equal, if they are defined with respect to the same reference plane, around the same major planet (or Solar-system position), and have the obliquity and ascending node (if obliquity is non-zero) to within 1 μas.

NOTES:

  • Two NULL (undefined) orbital systems are considered not equal.
  • An orbital system structure may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aone of the orbital systems
banother orbital system
Returns
TRUE (1) if the two systems are effectively the same, within tolerances, or else FALSE (0).
Since
1.7
Author
Attila Kovacs
See also
novas_equals_orbital(), novas_equals_object()

References novas_orbital_system::center, novas_orbital_system::obl, novas_orbital_system::Omega, novas_orbital_system::plane, and novas_orbital_system::type.

Referenced by supernovas::OrbitalSystem::equals(), and novas_equals_orbital().

◆ novas_equals_planet_bundle()

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

Checks if two bundles containing Solar-system baricentric planet positions and velocities are effectively the same.

The two bundles are considered equals if:

  • they contain data for the same set of planets.
  • the planets with data have positions matching within 1 m.
  • the planets with data have velocities matching within 1 mm/s.

NOTES:

  • Two NULL (undefined) planet bundles are considered not equal.
  • A planet bundle may not equal itself if it contains NAN or infinite components for the planets they are supposed to have data for, since NAN != NAN and INFINITE != INFINITE.
Parameters
aa planet position / velocity bundle
banother planet position / velocity bundle
Returns
TRUE (1) if the two bundles are essentially the same within tolerances, or else FALSE (0).
Since
1.7
Author
Attila Kovacs

References novas_planet_bundle::mask, NOVAS_AU, novas_equals_vector(), NOVAS_PLANETS, novas_planet_bundle::pos, and novas_planet_bundle::vel.

Referenced by novas_equals_frame().

◆ novas_equals_sky_pos()

int novas_equals_sky_pos ( const sky_pos * a,
const sky_pos * b )

Checks if two apparent positions on the observer's sky are the same within typical tolerances.

Two sky positions are considered to be equal if their:

  • coordinates match within 1 μas,
  • distances match within 1 ppm.
  • radial velocities match within 1 mm/s.
  • unit vectors match to 10-12 (~1 μas).

NOTES:

  • Two NULL (undefined) sky positions are considered not equal.
  • A sky position may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aa position on the observer's sky
banother sky position
Returns
TRUE (1) if the two positions are essentially the same within typical tolerances, or else FALSE (0).
Since
1.7
Author
Attila Kovacs

References novas_sky_pos::dec, novas_sky_pos::dis, novas_equals_vector(), novas_sky_pos::r_hat, novas_sky_pos::ra, and novas_sky_pos::rv.

◆ novas_equals_ssb_posvel()

int novas_equals_ssb_posvel ( const in_space * a,
const in_space * b )

Checks if two Solar-system locations and motions match within 1 m and ~1 mm/s, respectively.

Such near-Earth data structures are used by observers defined relative to the Solar-System Barycenter (SSB).

NOTES:

  • Two NULL (undefined) structures are considered not equal.
  • A Solar-system position / velocity structure may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aone Solar-system position/velocity data structure
banother Solar-system position/velocity data structure
Returns
TRUE (1) if the two SSB positions and velocities match within 1 m and ~1 mm/s, respectively.
Since
1.7
Author
Attila Kovacs
See also
novas_equals_near_earth(), novas_equals_observer()

References NOVAS_AU, novas_equals_vector(), novas_in_space::sc_pos, and novas_in_space::sc_vel.

Referenced by novas_equals_observer().

◆ novas_equals_timespec()

int novas_equals_timespec ( const novas_timespec * a,
const novas_timespec * b )

Checks if two time specifications are the same within 10-7 days (~100 μs).

NOTES:

  • Two NULL (undefined) time specifications are considered not equal.
  • A time specification may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aone of the time specs
bthe other time spec
Returns
TRUE (1) if the two time specifications match to within 100 μs, or else FALSE (0).
Since
1.7
Author
Attila Kovacs

References novas_timespec::dut1, novas_timespec::fjd_tt, novas_timespec::ijd_tt, novas_timespec::tt2tdb, and novas_timespec::ut1_to_tt.

Referenced by novas_equals_frame().

◆ novas_equals_vector()

int novas_equals_vector ( const double * a,
const double * b,
double tol )

Checks if two 3D vectors are effectively the same, within the specified absolute tolerance.

Two vectors are equal if the distance between them is less than or equal to the magnitude of the specified tolerance.

NOTES:

  • Two NULL (undefined) vectors are considered not equal.
  • A vector may not equal itself if it contains NAN or infinite components, since NAN != NAN and INFINITE != INFINITE.
Parameters
aone of the vectors
bthe other vector
tolabsolute tolerance (sign is ignored).
Returns
TRUE (1) if all the two vectors match within the specified tolerance, or else FALSE (0)
Since
1.7
Author
Attila Kovacs

Referenced by supernovas::Vector::equals(), novas_equals_near_earth(), novas_equals_planet_bundle(), novas_equals_sky_pos(), and novas_equals_ssb_posvel().