Skip to main content

cad_cs/libs/cs/
model.rs

1// 📃 ./src/libs/cs/model.rs
2use crate::libs::angle::Angle;
3
4// =============================================================================
5// 1. RDZEŃ GENERYCZNY (BASE MODEL)
6// =============================================================================
7
8/// 📚 【 POL】: Generyczny wrapper dla tablic o stałym rozmiarze, ograniczony do wymiarów 2D i 3D.
9/// 📚 【 ENG】: Generic wrapper for fixed-size arrays, restricted to 2D and 3D dimensions.
10///
11/// ⚠️ 【 POL】: Implementacja ściśle ograniczona do N=2 lub N=3. Inne wymiary nie są wspierane.
12/// ⚠️ 【 ENG】: Implementation strictly limited to N=2 or N=3. Other dimensions are not supported.
13#[derive(Debug, Clone, Copy, PartialEq)]
14pub struct Cs<const N: usize>(pub [f64; N]);
15
16// =============================================================================
17// 2. STRUKTURY DANYCH WSPÓŁRZĘDNYCH (COORDS MODELS)
18// =============================================================================
19
20// --- KARTEZJAŃSKIE ---
21
22/// 📚 【 POL】: Współrzędne 2D w układzie kartezjańskim.
23/// 📚 【 ENG】: 2D coordinates in the Cartesian system.
24/// 💡 Może reprezentować dowolną płaszczyznę rzutowania (XY, XZ, YZ) traktowaną jako przestrzeń dwuwymiarowa.
25/// 💡 Can represent any projection plane (XY, XZ, YZ) treated as a two-dimensional space.
26#[derive(Debug, Clone, Copy, PartialEq)]
27pub struct CoordsXy {
28	pub x: f64,
29	pub y: f64,
30}
31
32/// 📚 【 POL】: Współrzędne 3D w układzie kartezjańskim (Przestrzeń XYZ).
33/// 📚 【 ENG】: 3D coordinates in the Cartesian system (XYZ Space).
34#[derive(Debug, Clone, Copy, PartialEq)]
35pub struct CoordsXyz {
36	pub x: f64,
37	pub y: f64,
38	pub z: f64,
39}
40
41// --- BIEGUNOWE I CYLINDRYCZNE ---
42
43/// 📚 【 POL】: Współrzędne 2D w układzie biegunowym (Promień, Azymut).
44/// 📚 【 ENG】: 2D coordinates in the Polar system (Radius, Azimuth).
45/// 💡 Może reprezentować dowolną płaszczyznę rzutowania (XY, XZ, YZ) traktowaną jako przestrzeń dwuwymiarowa.
46/// 💡 Can represent any projection plane (XY, XZ, YZ) treated as a two-dimensional space.
47#[derive(Debug, Clone, Copy, PartialEq)]
48pub struct CoordsPolar {
49	pub r_d2: f64,
50	pub f_y_x: f64, // w radianach
51}
52
53/// 📚 【 POL】: Współrzędne 3D w układzie cylindrycznym względem osi Z.
54/// 📚 【 ENG】: 3D coordinates in the Cylindrical system relative to the Z-axis.
55#[derive(Debug, Clone, Copy, PartialEq)]
56pub struct CoordsCylindricalZ {
57	pub r_d2: f64,
58	pub f_y_x: f64, // w radianach
59	pub z: f64,
60}
61
62/// 📚 【 POL】: Współrzędne 3D w układzie cylindrycznym względem osi Y.
63/// 📚 【 ENG】: 3D coordinates in the Cylindrical system relative to the Y-axis.
64#[derive(Debug, Clone, Copy, PartialEq)]
65pub struct CoordsCylindricalY {
66	pub r_d2: f64,
67	pub f_z_x: f64, // w radianach
68	pub y: f64,
69}
70
71/// 📚 【 POL】: Współrzędne 3D w układzie cylindrycznym względem osi X.
72/// 📚 【 ENG】: 3D coordinates in the Cylindrical system relative to the X-axis.
73#[derive(Debug, Clone, Copy, PartialEq)]
74pub struct CoordsCylindricalX {
75	pub r_d2: f64,
76	pub f_z_y: f64, // w radianach
77	pub x: f64,
78}
79
80// --- SFERYCZNE I GEOGRAFICZNE ---
81
82/// 📚 【 POL】: Współrzędne 3D w układzie sferycznym (Promień, Azymut, Inklinacja).
83/// 📚 【 ENG】: 3D coordinates in the Spherical system (Radius, Azimuth, Inclination).
84#[derive(Debug, Clone, Copy, PartialEq)]
85pub struct CoordsSpherical {
86	pub r_d3: f64,
87	pub f_y_x: f64, // w radianach (Azymut w płaszczyźnie XY)
88	pub t_z_r: f64, // w radianach (Inklinacja od osi Z)
89}
90
91// 📚 【 POL】: Współrzędne geograficzne w formacie DMS (Stopnie, Minuty, Sekundy).
92/// 📚 【 ENG】: Geographic coordinates in DMS format (Degrees, Minutes, Seconds).
93/// 🗺️ Orientacja: Nz90Ex0 (Oś Z: Biegun N, Oś X: Greenwich).
94#[derive(Debug, Clone, Copy, PartialEq)]
95pub struct CoordsSphericalEcefSnWeDms {
96	pub sn_lat_d: i8,  // Szerokość stopnie (-90 do 90)
97	pub sn_lat_m: u8,  // Szerokość minuty (0 do 59)
98	pub sn_lat_s: f32, // Szerokość sekundy (0.0 do 59.99999)
99	pub we_lon_d: i16, // Długość stopnie (-180 do 180)
100	pub we_lon_m: u8,  // Długość minuty (0 do 59)
101	pub we_lon_s: f32, // Długość sekundy (0.0 do 59.99999)
102	                   //pub alt: f64,    // Wysokość nad poziomem morza (m)
103}
104
105/// 📚 【 POL】: Współrzędne geograficzne w formacie DDD (Stopnie Dziesiętne).
106/// 📚 【 ENG】: Geographic coordinates in DDD format (Decimal Degrees).
107/// 🗺️ Orientacja: Nz90Ex0 (Oś Z: Biegun N, Oś X: Greenwich).
108#[derive(Debug, Clone, Copy, PartialEq)]
109pub struct CoordsSphericalEcefSnWeDdd {
110	pub sn_lat: Angle, // Szerokość (-90.0 do 90.0)
111	pub we_lon: Angle, // Długość (-180.0 do 180.0)
112	                   //pub alt: f64,    // Wysokość nad poziomem morza (m)
113}