autd3_link_visualizer/backend/
mod.rs1mod null;
2#[cfg(feature = "plotters")]
3mod plotters;
4#[cfg(feature = "python")]
5mod python;
6
7use crate::error::VisualizerError;
8
9use autd3_driver::{defined::Complex, geometry::Geometry};
10
11pub trait Backend: Send + Sync {
12 type PlotConfig;
13
14 fn new() -> Self;
15
16 fn initialize(&mut self) -> Result<(), VisualizerError>;
17
18 fn plot_1d(
19 observe_points: Vec<f32>,
20 acoustic_pressures: Vec<Complex>,
21 resolution: f32,
22 x_label: &str,
23 config: Self::PlotConfig,
24 ) -> Result<(), VisualizerError>;
25
26 #[allow(clippy::too_many_arguments)]
27 fn plot_2d(
28 observe_x: Vec<f32>,
29 observe_y: Vec<f32>,
30 acoustic_pressures: Vec<Complex>,
31 resolution: f32,
32 x_label: &str,
33 y_label: &str,
34 config: Self::PlotConfig,
35 ) -> Result<(), VisualizerError>;
36
37 fn plot_modulation(
38 modulation: Vec<f32>,
39 config: Self::PlotConfig,
40 ) -> Result<(), VisualizerError>;
41
42 fn plot_phase(
43 config: Self::PlotConfig,
44 geometry: &Geometry,
45 phases: Vec<f32>,
46 ) -> Result<(), VisualizerError>;
47}
48
49#[cfg(feature = "plotters")]
50pub use self::plotters::*;
51pub use null::*;
52#[cfg(feature = "python")]
53pub use python::*;