pub struct SplineCurve<const K: usize, const N: usize> {
pub t: Vec<f64>,
pub c: Vec<f64>,
pub k: usize,
pub n: usize,
/* private fields */
}
Expand description
General B-Spline Curve Knot/Coefficient Representation
Fields§
§t: Vec<f64>
§c: Vec<f64>
§k: usize
§n: usize
Implementations§
Source§impl<const K: usize, const N: usize> SplineCurve<K, N>
impl<const K: usize, const N: usize> SplineCurve<K, N>
pub fn new(t: Vec<f64>, c: Vec<f64>) -> Self
pub fn try_new(t: Vec<f64>, c: Vec<f64>) -> Result<Self, Box<dyn Error>>
Sourcepub fn evaluate(&self, u: &[f64]) -> Result<Vec<f64>>
pub fn evaluate(&self, u: &[f64]) -> Result<Vec<f64>>
Calulates spline coordinates for a collection of parameter values
The coordinates are given as a one-dimensional array, starting with the N —with N the dimension of the cuve— coordinates of the firt point, followed by the coordinates of all the other points. For example, for a two-dimensional curve (N=2), the (x,y)-coordinates are given as [x0, y0, x1, y1, x2, …] and for a three-dimensional curve, with coordinates (x,y,z) you will get [x0, y0, z0, x1, y1, z1, x2, y2 …]. If you need to convert them into individual coordinate arrays, I suggest to use the transpose function.
Sourcepub fn eval(&mut self, t: f64) -> Result<f64, f64>
pub fn eval(&mut self, t: f64) -> Result<f64, f64>
Calulates spline coordinates for a collection of parameter values
The coordinates are given as a one-dimensional array, starting with the N —with N the dimension of the cuve— coordinates of the firt point, followed by the coordinates of all the other points. For example, for a two-dimensional curve (N=2), the (x,y)-coordinates are given as [x0, y0, x1, y1, x2, …] and for a three-dimensional curve, with coordinates (x,y,z) you will get [x0, y0, z0, x1, y1, z1, x2, y2 …]. If you need to convert them into individual coordinate arrays, I suggest to use the transpose function.
Trait Implementations§
Source§impl<const K: usize, const N: usize> Clone for SplineCurve<K, N>
impl<const K: usize, const N: usize> Clone for SplineCurve<K, N>
Source§fn clone(&self) -> SplineCurve<K, N>
fn clone(&self) -> SplineCurve<K, N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more