1#[derive(Clone, Copy, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
2#[cfg_attr(feature = "python", derive(pyo3::FromPyObject, pyo3::IntoPyObject))]
3#[cfg_attr(feature = "python", pyo3(transparent))]
4pub struct Cycles<T>(pub T);
5
6#[derive(Clone, Copy, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
7#[cfg_attr(feature = "python", derive(pyo3::FromPyObject, pyo3::IntoPyObject))]
8#[cfg_attr(feature = "python", pyo3(transparent))]
9pub struct Radians<T>(pub T);
10
11impl From<Cycles<f64>> for Radians<f64> {
12 fn from(cycles: Cycles<f64>) -> Self {
13 Radians(cycles.0 * 2.0 * std::f64::consts::PI)
14 }
15}
16
17impl From<Radians<f64>> for Cycles<f64> {
18 fn from(radians: Radians<f64>) -> Self {
19 Cycles(radians.0 / (2.0 * std::f64::consts::PI))
20 }
21}
22
23#[cfg(feature = "stubs")]
24impl pyo3_stub_gen::PyStubType for Cycles<f64> {
25 fn type_output() -> pyo3_stub_gen::TypeInfo {
26 pyo3_stub_gen::TypeInfo::builtin("float")
27 }
28}
29
30#[cfg(feature = "stubs")]
31impl pyo3_stub_gen::PyStubType for Radians<f64> {
32 fn type_output() -> pyo3_stub_gen::TypeInfo {
33 pyo3_stub_gen::TypeInfo::builtin("float")
34 }
35}