Crates.io | fastcurve_3d |
lib.rs | fastcurve_3d |
version | 0.1.1 |
source | src |
created_at | 2020-05-14 19:48:40.274678 |
updated_at | 2020-05-24 08:41:52.238393 |
description | Library for 3D and 2D fast curve generation |
homepage | https://github.com/gberrante/fastcurve_3d |
repository | https://github.com/gberrante/fastcurve_3d |
max_upload_size | |
id | 241624 |
size | 49,889 |
This algorithm is generates a curve from a list of control points.
Original paper: G. M. Chaikin, “An algorithm for high-speed curve generation, Computer Graphics and Image Processing,” vol. 3, 1974, pp. 346-349 On Chaikin's algorithm R.F.Riesenfeld
The library contains the following functions:
For the examples the rust gnuplot library is used.
let x = vec![1.0,1.0,4.0,5.0,2.0];
let y = vec![1.0,2.0,0.5,1.0,2.0];
let z = vec![1.0,2.0,0.8,1.0,1.5];
let n: u8 = 4;
let (xn,yn,zn) = fast_curve_3d(&x, &y, &z, n);
// gnu plot Figure
let mut fg = Figure::new();
fg.axes3d()
.lines(&x, &y, &z,&[Caption("Original"), Color("blue")])
.lines(&xn, &yn, &zn, &[Caption("Smoothed"), Color("red")]);
fg.set_scale(1.0, 1.0);
fg.show().unwrap();
let x = vec![1.0,1.0,4.0,5.0,2.0];
let y = vec![1.0,2.0,0.5,1.0,2.0];
let n: u8 = 4;
let (xn,yn) = fast_curve_2d(&x, &y, n);
let mut fg = Figure::new();
fg.axes2d()
.lines(&x, &y,&[Caption("Original"), Color("blue")])
.lines(&xn, &yn, &[Caption("Smoothed"), Color("red")]);
fg.set_scale(1.0, 1.0);
fg.show().unwrap();