Skip to main content

cad_cs/libs/cs/
core.rs

1// 📃 ./src/libs/cs/core.rs
2
3/// 📚 【 POL】: Implementacje konwersji 2D. 📚 【 ENG】: 2D conversion impls.
4pub mod d2;
5/// 📚 【 POL】: Implementacje konwersji 3D. 📚 【 ENG】: 3D conversion impls.
6pub mod d3;
7
8use std::ops::Deref;
9
10use super::{abstracts::AbstractModelCsGeneric, model::Cs, types::Dim};
11
12/// 📚 【 POL】: Implementacja Deref zapewniająca bezpośredni dostęp do wewnętrznej tablicy danych.
13/// 📚 【 ENG】: Deref implementation providing direct access to the internal data array.
14impl<const N: usize> Deref for Cs<N>
15where Cs<N>: Dim
16{
17	type Target = [f64; N];
18	#[inline]
19	fn deref(&self) -> &Self::Target { &self.0 }
20}
21
22/// 📚 【 POL】: Implementacja kontraktu bazowego (przeniesiona z model.rs).
23impl<const N: usize> AbstractModelCsGeneric<N> for Cs<N>
24where Cs<N>: Dim
25{
26	#[inline]
27	fn new(data: [f64; N]) -> Self { Cs(data) }
28	#[inline]
29	fn origin() -> Self { Cs([0.0; N]) }
30	#[inline]
31	fn as_slice(&self) -> &[f64] { &self.0 }
32}