1use lox_bodies::RotationalElements;
10
11use crate::traits::{BodyFixed, QuasiInertial, ReferenceFrame};
12
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)]
14pub struct Icrf;
15
16impl ReferenceFrame for Icrf {
17 fn name(&self) -> String {
18 "International Celestial Reference Frame".to_string()
19 }
20
21 fn abbreviation(&self) -> String {
22 "ICRF".to_string()
23 }
24
25 fn is_rotating(&self) -> bool {
26 false
27 }
28}
29
30impl QuasiInertial for Icrf {}
31
32#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)]
33pub struct Cirf;
34
35impl ReferenceFrame for Cirf {
36 fn name(&self) -> String {
37 "Celestial Intermediate Reference Frame".to_string()
38 }
39
40 fn abbreviation(&self) -> String {
41 "CIRF".to_string()
42 }
43
44 fn is_rotating(&self) -> bool {
45 false
46 }
47}
48
49#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)]
50pub struct Tirf;
51
52impl ReferenceFrame for Tirf {
53 fn name(&self) -> String {
54 "Terrestrial Intermediate Reference Frame".to_string()
55 }
56
57 fn abbreviation(&self) -> String {
58 "TIRF".to_string()
59 }
60
61 fn is_rotating(&self) -> bool {
62 true
63 }
64}
65
66#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)]
67pub struct Itrf;
68
69impl ReferenceFrame for Itrf {
70 fn name(&self) -> String {
71 "International Terrestrial Reference Frame".to_string()
72 }
73
74 fn abbreviation(&self) -> String {
75 "ITRF".to_string()
76 }
77
78 fn is_rotating(&self) -> bool {
79 true
80 }
81}
82
83impl BodyFixed for Itrf {}
84
85#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)]
86pub struct Iau<T: RotationalElements>(pub T);
87
88impl<T: RotationalElements> BodyFixed for Iau<T> {}
89
90impl<T> ReferenceFrame for Iau<T>
91where
92 T: RotationalElements,
93{
94 fn name(&self) -> String {
95 let body = self.0.name();
96 match body {
97 "Sun" | "Moon" => format!("IAU Body-Fixed Reference Frame for the {body}"),
98 _ => format!("IAU Body-Fixed Reference Frame for {body}"),
99 }
100 }
101
102 fn abbreviation(&self) -> String {
103 let body = self.0.name().replace([' ', '-'], "_").to_uppercase();
104 format!("IAU_{body}")
105 }
106
107 fn is_rotating(&self) -> bool {
108 true
109 }
110}