diff options
author | jakobst1n <jakob.stendahl@outlook.com> | 2024-06-04 05:00:57 +0200 |
---|---|---|
committer | jakobst1n <jakob.stendahl@outlook.com> | 2024-06-04 05:00:57 +0200 |
commit | 6e9628e2d20c09eaeb7eedfe2f7278de0b65a09f (patch) | |
tree | 745677d456a80d6e3d3d80d66eea1bf5d0c4b636 /src/main.rs | |
download | textgraph-6e9628e2d20c09eaeb7eedfe2f7278de0b65a09f.tar.gz textgraph-6e9628e2d20c09eaeb7eedfe2f7278de0b65a09f.zip |
Initial commit
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..4cae5be --- /dev/null +++ b/src/main.rs @@ -0,0 +1,31 @@ +use textgraph::graph; + +fn main() { + let mut line: Vec<f64> = Vec::new(); + let mut marks: Vec<f64> = Vec::new(); + for i in 0..500 { + line.push((i as f64 * std::f64::consts::PI / 120.0).sin()); + marks.push(i as f64); + } + + // Choose one of the methods based on sample speed: + //let downsampled_data = graph::downsample(&line, 100); + let interpolated_data = graph::interpolate(&line, &marks, 100); + + + //let processed_data = if marks.windows(2).all(|w| w[1] - w[0] == w[0] - w[1]) { + // downsample(&series, options.width) + //} else { + // interpolate(&series, &marks, options.width) + //}; + + + let g = graph::ascii_trailing( + &interpolated_data, + &graph::GraphOptions { + width: 100.0, + height: 30.0, + }, + ); + println!("{}", g); +} |