diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs index 90fc7ea..34adc14 100644 --- a/src/main.rs +++ b/src/main.rs @@ -227,19 +227,18 @@ impl canvas::Program<Message, Renderer> for Graph { state.map_coords(end_x as f32, 0.0), ); frame.stroke(&line, zeroline.clone()); - + let mut y1 = self + .func + .eval( + FunctionArgument::new(vec![Complex::new(start_x as f64, 0.0)]), + &self.ctx, + ) + .unwrap() + .real as f32; for x in start_x..end_x { for d in 0..10 { let d = d as f32 / 10.0; let x1 = x as f32 + d; - let y1 = self - .func - .eval( - FunctionArgument::new(vec![Complex::new(x1 as f64, 0.0)]), - &self.ctx, - ) - .unwrap() - .real as f32; let x2 = x as f32 + d + 0.1; let y2 = self .func @@ -253,6 +252,7 @@ impl canvas::Program<Message, Renderer> for Graph { let line = Path::line(state.map_coords(x1, y1), state.map_coords(x2, y2)); frame.stroke(&line, graphline.clone()) } + y1 = y2; } } }); |