unit_conversions/
angle.rs

1// <auto-generated>
2// This code was generated by the UnitCodeGenerator tool
3//
4// Changes to this file will be lost if the code is regenerated
5// </auto-generated>
6
7//! # Angle based converters
8
9/// Degrees conversion functions
10pub mod degrees {
11	/// Converts the supplied Degrees value to Radians
12	/// # Arguments
13	/// * `value` - The Degrees input value
14	pub fn to_radians(value: f64) -> f64 {
15		return value * std::f64::consts::PI/180.0;
16	}
17	/// Converts the supplied Degrees value to Gradians
18	/// # Arguments
19	/// * `value` - The Degrees input value
20	pub fn to_gradians(value: f64) -> f64 {
21		return value * 200.0/180.0;
22	}
23	/// Converts the supplied Degrees value to Milliradians
24	/// # Arguments
25	/// * `value` - The Degrees input value
26	pub fn to_milliradians(value: f64) -> f64 {
27		return value * (1000.0 * std::f64::consts::PI)/180.0;
28	}
29	/// Converts the supplied Degrees value to Minute Of Arc
30	/// # Arguments
31	/// * `value` - The Degrees input value
32	pub fn to_minute_of_arc(value: f64) -> f64 {
33		return value * 60.0;
34	}
35	/// Converts the supplied Degrees value to Seconds Of Arc
36	/// # Arguments
37	/// * `value` - The Degrees input value
38	pub fn to_seconds_of_arc(value: f64) -> f64 {
39		return value * 3600.0;
40	}
41}
42/// Gradians conversion functions
43pub mod gradians {
44	/// Converts the supplied Gradians value to Degrees
45	/// # Arguments
46	/// * `value` - The Gradians input value
47	pub fn to_degrees(value: f64) -> f64 {
48		return value * 180.0/200.0;
49	}
50	/// Converts the supplied Gradians value to Radians
51	/// # Arguments
52	/// * `value` - The Gradians input value
53	pub fn to_radians(value: f64) -> f64 {
54		return value * std::f64::consts::PI/200.0;
55	}
56	/// Converts the supplied Gradians value to Milliradians
57	/// # Arguments
58	/// * `value` - The Gradians input value
59	pub fn to_milliradians(value: f64) -> f64 {
60		return value * (1000.0*std::f64::consts::PI)/200.0;
61	}
62	/// Converts the supplied Gradians value to Minute Of Arc
63	/// # Arguments
64	/// * `value` - The Gradians input value
65	pub fn to_minute_of_arc(value: f64) -> f64 {
66		return value * 54.0;
67	}
68	/// Converts the supplied Gradians value to Seconds Of Arc
69	/// # Arguments
70	/// * `value` - The Gradians input value
71	pub fn to_seconds_of_arc(value: f64) -> f64 {
72		return value * 3240.0;
73	}
74}
75/// Milliradians conversion functions
76pub mod milliradians {
77	/// Converts the supplied Milliradians value to Degrees
78	/// # Arguments
79	/// * `value` - The Milliradians input value
80	pub fn to_degrees(value: f64) -> f64 {
81		return value * 180.0/(1000.0 * std::f64::consts::PI);
82	}
83	/// Converts the supplied Milliradians value to Radians
84	/// # Arguments
85	/// * `value` - The Milliradians input value
86	pub fn to_radians(value: f64) -> f64 {
87		return value / 1000.0;
88	}
89	/// Converts the supplied Milliradians value to Gradians
90	/// # Arguments
91	/// * `value` - The Milliradians input value
92	pub fn to_gradians(value: f64) -> f64 {
93		return value * 200.0/(1000.0 * std::f64::consts::PI);
94	}
95	/// Converts the supplied Milliradians value to Minute Of Arc
96	/// # Arguments
97	/// * `value` - The Milliradians input value
98	pub fn to_minute_of_arc(value: f64) -> f64 {
99		return value * (60.0 * 180.0)/(1000.0 * std::f64::consts::PI);
100	}
101	/// Converts the supplied Milliradians value to Seconds Of Arc
102	/// # Arguments
103	/// * `value` - The Milliradians input value
104	pub fn to_seconds_of_arc(value: f64) -> f64 {
105		return value * (3600.0 * 180.0)/(1000.0 * std::f64::consts::PI);
106	}
107}
108/// Minute Of Arc conversion functions
109pub mod minute_of_arc {
110	/// Converts the supplied Minute Of Arc value to Degrees
111	/// # Arguments
112	/// * `value` - The Minute Of Arc input value
113	pub fn to_degrees(value: f64) -> f64 {
114		return value / 60.0;
115	}
116	/// Converts the supplied Minute Of Arc value to Radians
117	/// # Arguments
118	/// * `value` - The Minute Of Arc input value
119	pub fn to_radians(value: f64) -> f64 {
120		return value * std::f64::consts::PI/(60.0 * 180.0);
121	}
122	/// Converts the supplied Minute Of Arc value to Gradians
123	/// # Arguments
124	/// * `value` - The Minute Of Arc input value
125	pub fn to_gradians(value: f64) -> f64 {
126		return value / 54.0;
127	}
128	/// Converts the supplied Minute Of Arc value to Milliradians
129	/// # Arguments
130	/// * `value` - The Minute Of Arc input value
131	pub fn to_milliradians(value: f64) -> f64 {
132		return value * (1000.0 * std::f64::consts::PI) / (60.0 * 180.0);
133	}
134	/// Converts the supplied Minute Of Arc value to Seconds Of Arc
135	/// # Arguments
136	/// * `value` - The Minute Of Arc input value
137	pub fn to_seconds_of_arc(value: f64) -> f64 {
138		return value * 60.0;
139	}
140}
141/// Radians conversion functions
142pub mod radians {
143	/// Converts the supplied Radians value to Degrees
144	/// # Arguments
145	/// * `value` - The Radians input value
146	pub fn to_degrees(value: f64) -> f64 {
147		return value * 180.0/std::f64::consts::PI;
148	}
149	/// Converts the supplied Radians value to Gradians
150	/// # Arguments
151	/// * `value` - The Radians input value
152	pub fn to_gradians(value: f64) -> f64 {
153		return value * 200.0/std::f64::consts::PI;
154	}
155	/// Converts the supplied Radians value to Milliradians
156	/// # Arguments
157	/// * `value` - The Radians input value
158	pub fn to_milliradians(value: f64) -> f64 {
159		return value * 1000.0;
160	}
161	/// Converts the supplied Radians value to Minute Of Arc
162	/// # Arguments
163	/// * `value` - The Radians input value
164	pub fn to_minute_of_arc(value: f64) -> f64 {
165		return value * (60.0 * 180.0)/std::f64::consts::PI;
166	}
167	/// Converts the supplied Radians value to Seconds Of Arc
168	/// # Arguments
169	/// * `value` - The Radians input value
170	pub fn to_seconds_of_arc(value: f64) -> f64 {
171		return value * (3600.0 * 180.0)/std::f64::consts::PI;
172	}
173}
174/// Seconds Of Arc conversion functions
175pub mod seconds_of_arc {
176	/// Converts the supplied Seconds Of Arc value to Degrees
177	/// # Arguments
178	/// * `value` - The Seconds Of Arc input value
179	pub fn to_degrees(value: f64) -> f64 {
180		return value / 3600.0;
181	}
182	/// Converts the supplied Seconds Of Arc value to Radians
183	/// # Arguments
184	/// * `value` - The Seconds Of Arc input value
185	pub fn to_radians(value: f64) -> f64 {
186		return value * std::f64::consts::PI/(180.0 * 3600.0);
187	}
188	/// Converts the supplied Seconds Of Arc value to Gradians
189	/// # Arguments
190	/// * `value` - The Seconds Of Arc input value
191	pub fn to_gradians(value: f64) -> f64 {
192		return value / 3240.0;
193	}
194	/// Converts the supplied Seconds Of Arc value to Milliradians
195	/// # Arguments
196	/// * `value` - The Seconds Of Arc input value
197	pub fn to_milliradians(value: f64) -> f64 {
198		return value * (1000.0 * std::f64::consts::PI) / (180.0 * 3600.0);
199	}
200	/// Converts the supplied Seconds Of Arc value to Minute Of Arc
201	/// # Arguments
202	/// * `value` - The Seconds Of Arc input value
203	pub fn to_minute_of_arc(value: f64) -> f64 {
204		return value / 60.0;
205	}
206}