clip/
clip.rs

1use std::{error::Error,
2          fs::File,
3          f64::NAN};
4use curve_sampling as cs;
5
6fn main() -> Result<(), Box<dyn Error>> {
7    let s = cs::Sampling::from_iter(
8        [[0., -0.5], [1.5, 1.], [0.2, 0.5], [0.3, 1.5], [1., 0.6],
9         [NAN, NAN], [-0.5, 0.5], [-1., 0.], [0.5, 0.5]]);
10    s.write(&mut File::create("/tmp/clip0.dat")?)?;
11    s.latex().write(&mut File::create("/tmp/clip0.tex")?)?;
12    let s1 = s.clip(cs::BoundingBox { xmin: 0., xmax: 1.,
13                                      ymin: 0., ymax: 1. });
14    s1.write(&mut File::create("/tmp/clip1.dat")?)?;
15    s1.latex().write(&mut File::create("/tmp/clip1.tex")?)?;
16
17    Ok(())
18}