Skip to main content

cad_cs/libs/
consts.rs

1// 📃 ./src/libs/consts.rs
2
3/// 📚 【 POL】: Średni promień Ziemi w metrach (model sferyczny R1).
4/// 📚 【 ENG】: Mean Earth radius in meters (spherical model R1).
5pub const EARTH_MEAN_RADIUS_METERS: f64 = 6_371_000.0;
6
7/// 📚 【 POL】: Przyśpieszenie ziemskie (standardowe) w m/s².
8/// 📚 【 ENG】: Standard Earth gravity in m/s².
9pub const G_ACCELERATION: f64 = 9.80665;
10
11/// 📚 【 POL】: Tryb promienia używany w obliczeniach łukowych i konwersjach DMS.
12/// 📚 【 ENG】: Radius mode used in arc calculations and DMS conversions.
13#[derive(Debug, Clone, Copy, PartialEq)]
14pub enum RadiusMode {
15	/// 📚 【 POL】: Średni promień Ziemi (6,371,000 m).
16	/// 📚 【 ENG】: Mean Earth radius (6,371,000 m).
17	Mean,
18	/// 📚 【 POL】: Jedność (1.0) - przydatne do obliczeń znormalizowanych.
19	/// 📚 【 ENG】: Unity (1.0) - useful for normalized calculations.
20	Unity,
21	/// 📚 【 POL】: Własny promień podany w metrach.
22	/// 📚 【 ENG】: Custom radius provided in meters.
23	Custom(f64),
24}
25
26impl RadiusMode {
27	/// 📚 【 POL】: Zwraca liczbową wartość promienia dla wybranego trybu.
28	/// 📚 【 ENG】: Returns the numerical radius value for the selected mode.
29	#[inline]
30	pub fn val(&self) -> f64 {
31		match self {
32			Self::Mean => EARTH_MEAN_RADIUS_METERS,
33			Self::Unity => 1.0,
34			Self::Custom(r) => *r,
35		}
36	}
37}