siderust-cpp 0.8.0
Header-only C++ wrapper for siderust
Loading...
Searching...
No Matches
subject.hpp File Reference

Unified Subject type — one value to represent any celestial entity. More...

#include "altitude.hpp"
#include "azimuth.hpp"
#include "bodies.hpp"
#include "body_target.hpp"
#include "coordinates.hpp"
#include "ffi_core.hpp"
#include "target.hpp"
#include "time.hpp"
#include <vector>
Include dependency graph for subject.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  siderust::Subject
 Unified, lightweight handle representing any celestial subject. More...

Namespaces

namespace  siderust

Enumerations

enum class  siderust::SubjectKind : int32_t { siderust::Body = SIDERUST_SUBJECT_KIND_T_BODY , siderust::Star = SIDERUST_SUBJECT_KIND_T_STAR , siderust::Icrs = SIDERUST_SUBJECT_KIND_T_ICRS , siderust::GenericTarget = SIDERUST_SUBJECT_KIND_T_GENERIC_TARGET }
 Discriminant for the active field in a Subject. More...

Functions

qtty::Radian siderust::altitude_at (const Subject &subj, const Geodetic &obs, const Time< TT, MJD > &mjd)
 Altitude at an instant (radians) for any subject.
std::vector< Period< TT, MJD > > siderust::above_threshold (const Subject &subj, const Geodetic &obs, const Period< TT, MJD > &window, qtty::Degree threshold, const SearchOptions &opts={})
 Periods when a subject is above a threshold altitude.
std::vector< Period< TT, MJD > > siderust::below_threshold (const Subject &subj, const Geodetic &obs, const Period< TT, MJD > &window, qtty::Degree threshold, const SearchOptions &opts={})
 Periods when a subject is below a threshold altitude.
std::vector< CrossingEvent > siderust::crossings (const Subject &subj, const Geodetic &obs, const Period< TT, MJD > &window, qtty::Degree threshold, const SearchOptions &opts={})
 Threshold-crossing events for a subject.
std::vector< CulminationEvent > siderust::culminations (const Subject &subj, const Geodetic &obs, const Period< TT, MJD > &window, const SearchOptions &opts={})
 Culmination (local extrema) events for a subject.
std::vector< Period< TT, MJD > > siderust::altitude_ranges (const Subject &subj, const Geodetic &obs, const Period< TT, MJD > &window, qtty::Degree min_alt, qtty::Degree max_alt, const SearchOptions &opts={})
 Periods when a subject's altitude is within [min, max].
qtty::Degree siderust::azimuth_at (const Subject &subj, const Geodetic &obs, const Time< TT, MJD > &mjd)
 Azimuth at an instant (degrees, N-clockwise) for any subject.
std::vector< AzimuthCrossingEvent > siderust::azimuth_crossings (const Subject &subj, const Geodetic &obs, const Period< TT, MJD > &window, qtty::Degree bearing, const SearchOptions &opts={})
 Azimuth bearing-crossing events for a subject.
std::vector< AzimuthExtremum > siderust::azimuth_extrema (const Subject &subj, const Geodetic &obs, const Period< TT, MJD > &window, const SearchOptions &opts={})
 Azimuth extrema (northernmost / southernmost) for a subject.
std::vector< Period< TT, MJD > > siderust::in_azimuth_range (const Subject &subj, const Geodetic &obs, const Period< TT, MJD > &window, qtty::Degree min_deg, qtty::Degree max_deg, const SearchOptions &opts={})
 Periods when a subject's azimuth is within [min_deg, max_deg].

Detailed Description

Unified Subject type — one value to represent any celestial entity.

Subject is a lightweight tagged value (akin to std::variant) that wraps the FFI siderust_subject_t struct. It can carry:

Kind Data
Body siderust::Body discriminant
Star borrows an existing siderust::Star
Icrs inline spherical::Direction<frames::ICRS>
Target borrows an existing DirectionTarget<…>

All unified functions (altitude_at, above_threshold, …) accept a Subject so the caller no longer needs separate sun::, moon::, body::, star::, icrs::, and target-specific calls.

Lifetime: when constructing from Star or DirectionTarget, the Subject borrows the handle — the original object must outlive it.

Example

using namespace siderust;
// From a solar-system body
qtty::Degree alt = altitude_at(sun, obs, now);
// From a catalog star
Star vega = Star::catalog("VEGA");
auto periods = above_threshold(s, obs, window, qtty::Degree(10));
// From an ICRS direction
qtty::Degree(279.23), qtty::Degree(38.78)));
RAII handle to a Star (opaque Rust object).
Definition bodies.hpp:176
static Star catalog(const std::string &name)
Look up a star from the built-in catalog.
Definition bodies.hpp:216
Unified, lightweight handle representing any celestial subject.
Definition subject.hpp:82
static Subject body(Body b)
Create a subject for a solar-system body.
Definition subject.hpp:87
static Subject star(const siderust::Star &star)
Create a subject borrowing a Star handle.
Definition subject.hpp:98
static Subject icrs(const spherical::Direction< frames::ICRS > &dir)
Create a subject for an inline ICRS direction.
Definition subject.hpp:111
qtty::Radian altitude_at(const Subject &subj, const Geodetic &obs, const Time< TT, MJD > &mjd)
Altitude at an instant (radians) for any subject.
Definition subject.hpp:148
std::vector< Period< TT, MJD > > above_threshold(const Subject &subj, const Geodetic &obs, const Period< TT, MJD > &window, qtty::Degree threshold, const SearchOptions &opts={})
Periods when a subject is above a threshold altitude.
Definition subject.hpp:159
A direction on the celestial sphere, compile-time tagged by frame.
Definition spherical.hpp:50

Definition in file subject.hpp.