1quantity! {
4 quantity: SolidAngle; "solid angle";
6 dimension: ISQ<
8 Z0, Z0, Z0, Z0, Z0, Z0, Z0>; kind: dyn (crate::si::marker::SolidAngleKind);
16 units {
17 @steradian: 1.0_E0; "sr", "steradian", "steradians";
20 @spat: 1.256_637_061_435_917_3_E1; "sp", "spat", "spats";
21 @square_degree: 3.046_174_197_867_086_E-4; "°²", "square degree", "square degrees";
22 @square_minute: 8.461_594_994_075_238_9_E-8; "′²", "square minute", "square minutes";
23 @square_second: 2.350_443_053_909_788_6_E-11; "″²", "square second", "square seconds";
24 }
25}
26
27#[cfg(feature = "f32")]
28impl SolidAngle<crate::si::SI<f32>, f32> {
29 pub const SPHERE: Self = Self {
32 dimension: crate::lib::marker::PhantomData,
33 units: crate::lib::marker::PhantomData,
34 value: 4. * crate::lib::f32::consts::PI,
35 };
36}
37
38#[cfg(feature = "f64")]
39impl SolidAngle<crate::si::SI<f64>, f64> {
40 pub const SPHERE: Self = Self {
43 dimension: crate::lib::marker::PhantomData,
44 units: crate::lib::marker::PhantomData,
45 value: 4. * crate::lib::f64::consts::PI,
46 };
47}
48
49#[cfg(test)]
50mod tests {
51 storage_types! {
52 use crate::lib::f64::consts::PI;
53 use crate::num::{FromPrimitive, One};
54 use crate::si::quantities::*;
55 use crate::si::solid_angle as sa;
56 use crate::tests::Test;
57
58 #[test]
59 fn check_units() {
60 Test::assert_eq(&SolidAngle::new::<sa::steradian>(V::from_f64(4.0 * PI).unwrap()),
61 &SolidAngle::new::<sa::spat>(V::one()));
62 Test::assert_approx_eq(
63 &SolidAngle::new::<sa::square_degree>(V::from_f64(360.0 * 360.0 / PI).unwrap()),
64 &SolidAngle::new::<sa::spat>(V::one()));
65 Test::assert_approx_eq(
66 &SolidAngle::new::<sa::square_minute>(V::from_f64(60.0 * 60.0).unwrap()),
67 &SolidAngle::new::<sa::square_degree>(V::one()));
68 Test::assert_approx_eq(
69 &SolidAngle::new::<sa::square_second>(
70 V::from_f64((60.0 * 60.0) * (60.0 * 60.0)).unwrap()),
71 &SolidAngle::new::<sa::square_degree>(V::one()));
72 }
73 }
74}