Skip to main content

clip/
clip.rs

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