44 return {
MJD(c.mjd), qtty::Degree(c.altitude_deg),
static_cast<CulminationKind>(c.kind)};
75 siderust_search_opts_t
to_c()
const {
85inline std::vector<Period>
periods_from_c(tempoch_period_mjd_t* ptr, uintptr_t count) {
86 std::vector<Period> result;
87 result.reserve(count);
88 for (uintptr_t i = 0; i < count; ++i) {
89 result.push_back(Period::from_c(ptr[i]));
91 siderust_periods_free(ptr, count);
95inline std::vector<CrossingEvent>
crossings_from_c(siderust_crossing_event_t* ptr, uintptr_t count) {
96 std::vector<CrossingEvent> result;
97 result.reserve(count);
98 for (uintptr_t i = 0; i < count; ++i) {
101 siderust_crossings_free(ptr, count);
105inline std::vector<CulminationEvent>
culminations_from_c(siderust_culmination_event_t* ptr, uintptr_t count) {
106 std::vector<CulminationEvent> result;
107 result.reserve(count);
108 for (uintptr_t i = 0; i < count; ++i) {
111 siderust_culminations_free(ptr, count);
130 return qtty::Radian(out);
139 tempoch_period_mjd_t* ptr =
nullptr;
142 obs.
to_c(), window.c_inner(), threshold.value(),
143 opts.to_c(), &ptr, &count),
144 "sun::above_threshold");
163 tempoch_period_mjd_t* ptr =
nullptr;
166 obs.
to_c(), window.c_inner(), threshold.value(),
167 opts.to_c(), &ptr, &count),
168 "sun::below_threshold");
187 siderust_crossing_event_t* ptr =
nullptr;
190 obs.
to_c(), window.c_inner(), threshold.value(),
191 opts.to_c(), &ptr, &count),
211 siderust_culmination_event_t* ptr =
nullptr;
214 obs.
to_c(), window.c_inner(),
215 opts.to_c(), &ptr, &count),
216 "sun::culminations");
234 qtty::Degree min_alt, qtty::Degree max_alt) {
235 siderust_altitude_query_t q = {obs.
to_c(), window.start().value(), window.end().value(),
236 min_alt.value(), max_alt.value()};
237 tempoch_period_mjd_t* ptr =
nullptr;
239 check_status(siderust_sun_altitude_periods(q, &ptr, &count),
240 "sun::altitude_periods");
249 qtty::Degree min_alt, qtty::Degree max_alt) {
250 siderust_altitude_query_t q = {obs.
to_c(), start.value(), end.value(),
251 min_alt.value(), max_alt.value()};
252 tempoch_period_mjd_t* ptr =
nullptr;
254 check_status(siderust_sun_altitude_periods(q, &ptr, &count),
255 "sun::altitude_periods");
273 "moon::altitude_at");
274 return qtty::Radian(out);
283 tempoch_period_mjd_t* ptr =
nullptr;
286 obs.
to_c(), window.c_inner(), threshold.value(),
287 opts.to_c(), &ptr, &count),
288 "moon::above_threshold");
307 tempoch_period_mjd_t* ptr =
nullptr;
310 obs.
to_c(), window.c_inner(), threshold.value(),
311 opts.to_c(), &ptr, &count),
312 "moon::below_threshold");
331 siderust_crossing_event_t* ptr =
nullptr;
334 obs.
to_c(), window.c_inner(), threshold.value(),
335 opts.to_c(), &ptr, &count),
355 siderust_culmination_event_t* ptr =
nullptr;
358 obs.
to_c(), window.c_inner(),
359 opts.to_c(), &ptr, &count),
360 "moon::culminations");
378 qtty::Degree min_alt, qtty::Degree max_alt) {
379 siderust_altitude_query_t q = {obs.
to_c(), window.start().value(), window.end().value(),
380 min_alt.value(), max_alt.value()};
381 tempoch_period_mjd_t* ptr =
nullptr;
383 check_status(siderust_moon_altitude_periods(q, &ptr, &count),
384 "moon::altitude_periods");
393 qtty::Degree min_alt, qtty::Degree max_alt) {
394 siderust_altitude_query_t q = {obs.
to_c(), start.value(), end.value(),
395 min_alt.value(), max_alt.value()};
396 tempoch_period_mjd_t* ptr =
nullptr;
398 check_status(siderust_moon_altitude_periods(q, &ptr, &count),
399 "moon::altitude_periods");
409namespace star_altitude {
418 "star_altitude::altitude_at");
419 return qtty::Radian(out);
428 tempoch_period_mjd_t* ptr =
nullptr;
431 s.
c_handle(), obs.
to_c(), window.c_inner(), threshold.value(),
432 opts.to_c(), &ptr, &count),
433 "star_altitude::above_threshold");
452 tempoch_period_mjd_t* ptr =
nullptr;
455 s.
c_handle(), obs.
to_c(), window.c_inner(), threshold.value(),
456 opts.to_c(), &ptr, &count),
457 "star_altitude::below_threshold");
476 siderust_crossing_event_t* ptr =
nullptr;
479 s.
c_handle(), obs.
to_c(), window.c_inner(), threshold.value(),
480 opts.to_c(), &ptr, &count),
481 "star_altitude::crossings");
500 siderust_culmination_event_t* ptr =
nullptr;
504 opts.to_c(), &ptr, &count),
505 "star_altitude::culminations");
524namespace icrs_altitude {
533 dir.
to_c(), obs.
to_c(), mjd.value(), &out),
534 "icrs_altitude::altitude_at");
535 return qtty::Radian(out);
553 tempoch_period_mjd_t* ptr =
nullptr;
556 dir.
to_c(), obs.
to_c(), window.c_inner(),
557 threshold.value(), opts.to_c(), &ptr, &count),
558 "icrs_altitude::above_threshold");
566 qtty::Degree ra, qtty::Degree dec,
584 tempoch_period_mjd_t* ptr =
nullptr;
587 dir.
to_c(), obs.
to_c(), window.c_inner(),
588 threshold.value(), opts.to_c(), &ptr, &count),
589 "icrs_altitude::below_threshold");
597 qtty::Degree ra, qtty::Degree dec,
RAII Star handle, Planet value type, and catalog helpers.
RAII handle to a Star (opaque Rust object).
const SiderustStar * c_handle() const
Access the raw C handle (for passing to altitude functions).
Coordinate module umbrella.
Error handling and utility base for the siderust C++ wrapper.
std::vector< CrossingEvent > crossings_from_c(siderust_crossing_event_t *ptr, uintptr_t count)
std::vector< Period > periods_from_c(tempoch_period_mjd_t *ptr, uintptr_t count)
std::vector< CulminationEvent > culminations_from_c(siderust_culmination_event_t *ptr, uintptr_t count)
std::vector< Period > below_threshold(const spherical::direction::ICRS &dir, const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find periods when a fixed ICRS direction is below a threshold.
qtty::Radian altitude_at(const spherical::direction::ICRS &dir, const Geodetic &obs, const MJD &mjd)
Compute altitude (radians) for a fixed ICRS direction.
std::vector< Period > above_threshold(const spherical::direction::ICRS &dir, const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find periods when a fixed ICRS direction is above a threshold.
std::vector< Period > altitude_periods(const Geodetic &obs, const Period &window, qtty::Degree min_alt, qtty::Degree max_alt)
Find periods when the Moon's altitude is within [min, max].
std::vector< CulminationEvent > culminations(const Geodetic &obs, const Period &window, const SearchOptions &opts={})
Find culmination events for the Moon.
std::vector< CrossingEvent > crossings(const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find threshold-crossing events for the Moon.
std::vector< Period > below_threshold(const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find periods when the Moon is below a threshold altitude.
std::vector< Period > above_threshold(const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find periods when the Moon is above a threshold altitude.
qtty::Radian altitude_at(const Geodetic &obs, const MJD &mjd)
Compute the Moon's altitude (radians) at a given MJD instant.
std::vector< Period > above_threshold(const Star &s, const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find periods when a star is above a threshold altitude.
qtty::Radian altitude_at(const Star &s, const Geodetic &obs, const MJD &mjd)
Compute a star's altitude (radians) at a given MJD instant.
std::vector< Period > below_threshold(const Star &s, const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find periods when a star is below a threshold altitude.
std::vector< CulminationEvent > culminations(const Star &s, const Geodetic &obs, const Period &window, const SearchOptions &opts={})
Find culmination events for a star.
std::vector< CrossingEvent > crossings(const Star &s, const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find threshold-crossing events for a star.
std::vector< CrossingEvent > crossings(const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find threshold-crossing events for the Sun.
std::vector< Period > altitude_periods(const Geodetic &obs, const Period &window, qtty::Degree min_alt, qtty::Degree max_alt)
Find periods when the Sun's altitude is within [min, max].
std::vector< Period > below_threshold(const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find periods when the Sun is below a threshold altitude.
qtty::Radian altitude_at(const Geodetic &obs, const MJD &mjd)
Compute the Sun's altitude (radians) at a given MJD instant.
std::vector< Period > above_threshold(const Geodetic &obs, const Period &window, qtty::Degree threshold, const SearchOptions &opts={})
Find periods when the Sun is above a threshold altitude.
std::vector< CulminationEvent > culminations(const Geodetic &obs, const Period &window, const SearchOptions &opts={})
Find culmination events for the Sun.
void check_status(siderust_status_t status, const char *operation)
A threshold-crossing event (rising or setting).
CrossingDirection direction
static CrossingEvent from_c(const siderust_crossing_event_t &c)
A culmination (local altitude extremum) event.
static CulminationEvent from_c(const siderust_culmination_event_t &c)
Geodetic position (WGS84 ellipsoid).
siderust_geodetic_t to_c() const
Convert to C FFI struct.
Options for altitude search algorithms.
siderust_search_opts_t to_c() const
double time_tolerance_days
SearchOptions & with_scan_step(double step)
Set a custom scan step.
SearchOptions & with_tolerance(double tol)
Set time tolerance.
A direction on the celestial sphere, compile-time tagged by frame.
siderust_spherical_dir_t to_c() const
Re-exports tempoch C++ types into the siderust namespace.