pub struct Curve {
pub id: String,
pub kind: CurveKind,
pub points: Vec<CurvePoint>,
}Expand description
A piecewise-linear mapping from x to y (§2.3). Static.
points has x strictly increasing and length ≥ 2.
Fields§
§id: StringString identifier for this curve.
kind: CurveKindSemantic kind, used to select validation rules.
points: Vec<CurvePoint>Ordered sample points with strictly increasing x-values. Length ≥ 2.
Implementations§
Source§impl Curve
impl Curve
Sourcepub fn eval(&self, x: f64) -> f64
pub fn eval(&self, x: f64) -> f64
Evaluates the curve at x using piecewise-linear interpolation.
Implements §2.3: when x is inside the range the bracketing segment is
used directly. When x is outside the range the nearest endpoint
segment is extended linearly (extrapolation).
For single-point curves, returns the y-value of that point (constant).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Curve
impl RefUnwindSafe for Curve
impl Send for Curve
impl Sync for Curve
impl Unpin for Curve
impl UnsafeUnpin for Curve
impl UnwindSafe for Curve
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more