autd3_core/acoustics/directivity/
sphere.rs

1use super::*;
2
3/// Sphere directivity model.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
5pub struct Sphere {}
6
7impl Directivity for Sphere {
8    #[inline]
9    fn directivity(_: Angle) -> f32 {
10        1.
11    }
12}
13
14#[cfg(test)]
15mod tests {
16    use crate::common::rad;
17
18    use super::*;
19
20    use rand::prelude::*;
21
22    #[test]
23    fn test_directivity() {
24        let mut rng = rand::rng();
25        assert_eq!(1.0, Sphere::directivity(rng.random::<f32>() * rad));
26    }
27}