refactor
This commit is contained in:
parent
58dff12fd0
commit
f7f0ff88e0
|
|
@ -1,8 +1,7 @@
|
|||
use egui_plot::{Plot, PlotPoints};
|
||||
use std::f64::{self, consts::PI};
|
||||
|
||||
pub fn plot(ui: &mut egui::Ui, circles: &mut Vec<crate::Circle>, num_points: &usize, line_colors: &Vec<egui::Color32>) {
|
||||
Plot::new("Encoded Message")
|
||||
egui_plot::Plot::new("Encoded Message")
|
||||
.height(ui.available_height())
|
||||
.width(ui.available_width())
|
||||
.show_axes(false)
|
||||
|
|
@ -27,7 +26,7 @@ pub fn plot(ui: &mut egui::Ui, circles: &mut Vec<crate::Circle>, num_points: &us
|
|||
});
|
||||
}
|
||||
|
||||
fn gaussian_distribution(num_points: &usize, peak_values: &Vec<f64>, offset: &f64) -> PlotPoints {
|
||||
fn gaussian_distribution(num_points: &usize, peak_values: &Vec<f64>, offset: &f64) -> egui_plot::PlotPoints {
|
||||
let mut radii: Vec<f64> = vec![1.0; *num_points];
|
||||
let num_peaks = peak_values.len();
|
||||
let peak_angles = generate_peak_angles(&num_peaks);
|
||||
|
|
@ -54,7 +53,7 @@ fn normalize(radii: &mut Vec<f64>, offset: &f64) -> Vec<f64> {
|
|||
}).collect()
|
||||
}
|
||||
|
||||
fn cartesian_to_polar(radii: &Vec<f64>, theta: &Vec<f64>) -> PlotPoints {
|
||||
fn cartesian_to_polar(radii: &Vec<f64>, theta: &Vec<f64>) -> egui_plot::PlotPoints {
|
||||
theta.iter()
|
||||
.zip(radii.iter())
|
||||
.map(|(&theta, &radius)| {
|
||||
|
|
|
|||
Loading…
Reference in New Issue