1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// use egui_plot::{Line, Plot};
// use nalgebra::{dmatrix, dvector};
// use ode_solvers::{DVector, Rk4};
// struct MassSpringSystem {}
// type State = DVector<f64>;
// type Time = f64;
// impl ode_solvers::System<Time, State> for MassSpringSystem {
// fn system(&self, _x: Time, y: &State, dy: &mut State) {
// let k = 1.0;
// let m = 1.0;
// let d = 0.2;
// assert_eq!(y.nrows(), 2);
// assert_eq!(dy.nrows(), 2);
// dy[0] = y[1];
// dy[1] = 1.0 / m * (-d * y[1] - k * y[0]);
// }
// }
// struct MyPlot {
// pub x: Vec<f64>,
// pub y: Vec<f64>,
// }
// impl eframe::App for MyPlot {
// fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
// egui::CentralPanel::default().show(ctx, |ui| {
// let points: Vec<_> = self
// .x
// .iter()
// .zip(self.y.iter())
// .map(|(&x, &y)| [x, y])
// .collect();
// let line = Line::new(points);
// Plot::new("test").show(ui, |plot_ui| {
// plot_ui.line(line);
// });
// });
// }
// }