1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2026 Vallés Puig, Ramon
//! # Unified Altitude Computation & Event API
//!
//! ## Scientific scope
//!
//! Topocentric altitude *h(t)* of a celestial body as observed from a
//! geodetic site on Earth, evaluated on the canonical TT axis. The body's
//! apparent direction is taken from the underlying analytical or numerical
//! engine (VSOP87/ELP2000/JPL ephemerides for solar-system bodies; ICRS
//! catalogue position for stars), so the regime of validity is bounded by
//! that of the chosen engine. Atmospheric refraction is **not** applied
//! here; thresholds such as `−0.833°` must be supplied by the caller.
//!
//! Event detection (rise/set crossings, culminations, time inside an
//! altitude band) is computed by combining a coarse scan with bracketed
//! root finding, so the temporal accuracy is limited by the scan step and
//! by the chosen `time_tolerance`.
//!
//! ## Technical scope
//!
//! A clean, user‑friendly API for computing target altitude vs time and
//! finding events (crossings, culminations, altitude ranges) for **any**
//! celestial target.
//!
//! ## Module Structure
//!
//! - `types`, Core type definitions (events, queries, periods)
//! - `search`, Search options and configuration constants
//! - `compute`, Low-level altitude computation functions
//! - `events`, Event finding (crossings, culminations, ranges)
//! - `provider`, Trait-based dispatch for bodies
//!
//! ## Public Functions
//!
//! | Function | Purpose |
//! |----------|---------|
//! | [`crossings`] | Threshold crossings in a time window |
//! | [`culminations`] | All local maxima/minima of altitude |
//! | [`altitude_ranges`] | Intervals where altitude is within `[h_min, h_max]` |
//! | [`above_threshold`] | Intervals where altitude is above threshold |
//! | [`below_threshold`] | Intervals where altitude is below threshold |
//!
//! All inputs/outputs are typed with `qtty` (`Degrees`, `JulianDate`, etc.).
//!
//! ## Time Scale
//!
//! `ModifiedJulianDate` / `Period<ModifiedJulianDate>` values in this API are interpreted on
//! the TT axis. If your inputs are UTC timestamps, convert them with
//! `tempoch::Time::<tempoch::UTC>::from_chrono(...).to::<tempoch::TT>().into()`
//! into `ModifiedJulianDate` first.
//!
//! ## Trait-Based API
//!
//! The [`AltitudePeriodsProvider`] trait provides a unified interface for
//! computing altitude periods of any celestial body. Implementations exist
//! for [`Sun`](crate::bodies::solar_system::Sun),
//! [`Moon`](crate::bodies::solar_system::Moon),
//! [`Star`](crate::bodies::Star), and
//! [`direction::ICRS`](crate::coordinates::spherical::direction::ICRS).
//!
//! All event-finding functions are generic over `AltitudePeriodsProvider`,
//! so you can pass any supported body directly.
//!
//! ## Example
//!
//! ```rust
//! use siderust::calculus::altitude::{crossings, AltitudePeriodsProvider, SearchOpts};
//! use siderust::bodies::Sun;
//! use siderust::coordinates::centers::Geodetic;
//! use siderust::coordinates::frames::ECEF;
//! use siderust::time::{ModifiedJulianDate, Period};
//! use siderust::qtty::*;
//!
//! let site = Geodetic::<ECEF>::new(Degrees::new(0.0), Degrees::new(51.48), Meters::new(0.0));
//! let window = Period::new(
//! siderust::ModifiedJulianDate::new(60000.0),
//! siderust::ModifiedJulianDate::new(60001.0),
//! );
//!
//! // Pass any body that implements AltitudePeriodsProvider
//! let events = crossings(&Sun, &site, window, Degrees::new(0.0), SearchOpts::default());
//!
//! // Or use the trait methods directly
//! let alt_rad = Sun.altitude_at(&site, siderust::ModifiedJulianDate::new(60000.0));
//! ```
//!
//! ## References
//! None.
// ---------------------------------------------------------------------------
// Submodules
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// Re-exports: Types
// ---------------------------------------------------------------------------
pub use ;
// ---------------------------------------------------------------------------
// Re-exports: Search Options
// ---------------------------------------------------------------------------
pub use SearchOpts;
// ---------------------------------------------------------------------------
// Re-exports: Core Computation
// ---------------------------------------------------------------------------
// fixed_star_altitude_rad moved to stellar module
// ---------------------------------------------------------------------------
// Re-exports: Event Finding
// ---------------------------------------------------------------------------
pub use ;
// ---------------------------------------------------------------------------
// Re-exports: Trait & Provider Functions
// ---------------------------------------------------------------------------
pub use ;