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
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2026 Vallés Puig, Ramon
//! # Coordinate-type conversions for [`CoordinateWithPM`]
//!
//! ## Scientific scope
//!
//! Astrometric pipelines frequently need to express the same catalog position
//! in different reference frames or reference centers: e.g. transforming from
//! a heliocentric J2000 ecliptic catalog position to a geocentric equatorial
//! of-date position for comparison with an observation. This module provides
//! blanket [`From`] implementations so those transformations compose
//! transparently with the `CoordinateWithPM<T>` container, preserving the
//! epoch and proper-motion model across the conversion.
//!
//! ## Technical scope
//!
//! Two blanket impls are provided:
//!
//! - `From<&CoordinateWithPM<cartesian::Position<C1,F1,U>>>`
//! `for CoordinateWithPM<cartesian::Position<C2,F2,U>>` — chains a frame
//! transform and a center transform, both evaluated at the stored epoch.
//!
//! - `From<&CoordinateWithPM<spherical::Position<C1,F1,U>>>`
//! `for CoordinateWithPM<spherical::Position<C2,F2,U>>` — converts to
//! Cartesian, applies both transforms, then converts back to spherical.
//!
//! Both impls delegate to the [`Transform`](crate::coordinates::transform::Transform)
//! trait and are gated on the same bounds, so the compiler statically checks
//! that the requested center/frame combination has a valid transform path.
//!
//! ## References
//!
//! - IAU SOFA Library, function `iauPmpx` (proper-motion and parallax).
//! - Seidelmann, P. K. (1992). *Explanatory Supplement to the Astronomical
//! Almanac*, §3.3. University Science Books.
use CoordinateWithPM;
use crate;
use crateLengthUnit;
/// Blanket implementation to allow chaining two consecutive `Transform` operations.
///
/// This implementation allows converting a `Target` in Cartesian coordinates from one
/// reference center and frame (`C1`, `F1`) to another (`C2`, `F2`) by applying two
/// transformations:
/// 1. Frame transformation (within the same center)
/// 2. Center transformation (within the new frame)
/// Blanket implementation for transforming `Target` in spherical coordinates,
/// involving frame and center changes. Internally uses Cartesian conversions.
///
/// The transformation follows these steps:
/// 1. Convert spherical coordinates to Cartesian.
/// 2. Apply frame transformation.
/// 3. Apply center transformation.
/// 4. Convert back to spherical coordinates.