pub struct KnotVector {
pub values: Vec<f64>,
pub multiplicities: Vec<usize>,
}Expand description
A knot vector as IFC stores it: distinct values plus multiplicities.
Kept compressed because that is what the file says. Self::expanded
produces the repeated vector a kernel wants, in one place, so no consumer
re-implements the expansion.
Fields§
§values: Vec<f64>The distinct knot values, finite and strictly increasing.
multiplicities: Vec<usize>How many times each value repeats; parallel to values.
Implementations§
Source§impl KnotVector
impl KnotVector
Sourcepub fn expanded(&self) -> Option<Vec<f64>>
pub fn expanded(&self) -> Option<Vec<f64>>
The full, repeated knot vector.
Length equals ControlPoints + Degree + 1 for a valid curve, which
BSplineCurve::knots has already checked.
Returns None when the multiplicities sum beyond usize, which only a
hostile or corrupt file achieves. Callers must refuse such a curve
rather than expand it; see Self::total_multiplicity.
Sourcepub fn total_multiplicity(&self) -> Option<usize>
pub fn total_multiplicity(&self) -> Option<usize>
The length the expanded vector would have.
None on overflow. Multiplicities come straight from the file, so a
plain sum() here panics in debug and wraps in release on input a
hostile file fully controls.
Sourcepub fn is_clamped(&self, degree: usize) -> bool
pub fn is_clamped(&self, degree: usize) -> bool
Is the curve clamped, i.e. does it touch its first and last control point?
True when the end multiplicities equal degree + 1. Worth asking
because an unclamped curve starts somewhere in the middle of its
control polygon, which looks like a modelling error to anyone who has
only seen clamped splines.
Trait Implementations§
Source§impl Clone for KnotVector
impl Clone for KnotVector
Source§fn clone(&self) -> KnotVector
fn clone(&self) -> KnotVector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more