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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//! # Reference Frames Module
//!
//! This module defines the concept of a *reference frame* for coordinate systems.
//! A reference frame specifies the orientation of the axes used to describe positions in space.
//!
//! ## Overview
//!
//! The [`ReferenceFrame`] trait provides a common interface for all reference frame types.
//! Each frame is represented as a zero-sized struct and implements the trait to provide
//! its canonical name.
//!
//! ## Domain-Agnostic Design
//!
//! This module provides **only** the trait infrastructure. Concrete frame types
//! (e.g., astronomical frames, geographic frames, robotic frames) should be defined
//! in domain-specific crates that depend on `affn`.
//!
//! ## Creating Custom Frames
//!
//! Use the derive macro for convenient definitions:
//!
//! ```rust
//! use affn::frames::ReferenceFrame;
//!
//! #[derive(Debug, Copy, Clone)]
//! pub struct MyFrame;
//!
//! impl ReferenceFrame for MyFrame {
//! fn frame_name() -> &'static str {
//! "MyFrame"
//! }
//! }
//! assert_eq!(MyFrame::frame_name(), "MyFrame");
//! ```
/// A trait for defining a reference frame (orientation).
///
/// Reference frames define the orientation of coordinate axes. Different frames
/// represent different ways of orienting a coordinate system (e.g., aligned with
/// an equator, an orbital plane, a horizon, etc.).
///
/// # Implementing
///
/// Implement this trait for zero-sized marker types that represent different frames:
///
/// ```rust
/// use affn::frames::ReferenceFrame;
///
/// #[derive(Debug, Copy, Clone)]
/// pub struct MyFrame;
///
/// impl ReferenceFrame for MyFrame {
/// fn frame_name() -> &'static str {
/// "MyFrame"
/// }
/// }
/// ```
// =============================================================================
// Spherical Coordinate Naming Convention
// =============================================================================
/// Provides frame-specific names for spherical coordinate components.
///
/// This trait is used by serde implementations to serialize/deserialize
/// spherical coordinates with astronomically-appropriate field names.
///
/// # Default Implementation
///
/// The default implementation uses generic mathematical names:
/// - Polar angle: `"polar"`
/// - Azimuthal angle: `"azimuth"`
///
/// # Frame-Specific Names
///
/// Implement this trait on your frame types to use domain-specific names:
///
/// | Frame | Polar Name | Azimuth Name |
/// |---------------|------------|--------------|
/// | Equatorial | `"dec"` | `"ra"` |
/// | ICRS | `"dec"` | `"ra"` |
/// | Ecliptic | `"lat"` | `"lon"` |
/// | Horizontal | `"alt"` | `"az"` |
/// | Geographic | `"lat"` | `"lon"` |
/// | Galactic | `"b"` | `"l"` |
/// | Supergalactic | `"sgb"` | `"sgl"` |
///
/// # Example
///
/// ```rust
/// use affn::frames::{ReferenceFrame, SphericalNaming};
///
/// #[derive(Debug, Copy, Clone)]
/// struct EclipticMeanJ2000;
///
/// impl ReferenceFrame for EclipticMeanJ2000 {
/// fn frame_name() -> &'static str { "EclipticMeanJ2000" }
/// }
///
/// impl SphericalNaming for EclipticMeanJ2000 {
/// fn polar_name() -> &'static str { "lat" }
/// fn azimuth_name() -> &'static str { "lon" }
/// }
/// ```
///
/// Types that don't implement this trait can use the default names via the
/// [`DefaultSphericalNaming`] helper.
/// Helper type that provides default spherical naming (polar/azimuth).
///
/// Use this when you need spherical naming for a frame that doesn't implement
/// `SphericalNaming` directly.
;
// =============================================================================
// Feature-gated astronomical frames
// =============================================================================
pub use *;