pub struct HermiteCurve {
pub points: Vec<[f64; 3]>,
pub tangents: Vec<[f64; 3]>,
}Expand description
A piecewise cubic Hermite spline interpolating through control points with user-supplied tangent vectors at each knot.
Guarantees C0 continuity at joints; C1 continuity if tangents are chosen consistently (e.g., Catmull–Rom style).
Fields§
§points: Vec<[f64; 3]>Interpolation knots (positions).
tangents: Vec<[f64; 3]>Tangent vectors at each knot, matching points in length.
Implementations§
Source§impl HermiteCurve
impl HermiteCurve
Sourcepub fn new(points: Vec<[f64; 3]>, tangents: Vec<[f64; 3]>) -> Self
pub fn new(points: Vec<[f64; 3]>, tangents: Vec<[f64; 3]>) -> Self
Construct a Hermite spline from points and tangents.
§Panics
Panics if points.len() != tangents.len() or fewer than 2 points.
Sourcepub fn eval(&self, t: f64) -> [f64; 3]
pub fn eval(&self, t: f64) -> [f64; 3]
Evaluate the spline at a global parameter t ∈ [0, n_segments].
The integer part selects the segment; the fractional part is the local Hermite parameter.
Sourcepub fn derivative(&self, t: f64) -> [f64; 3]
pub fn derivative(&self, t: f64) -> [f64; 3]
Derivative of the spline at global parameter t.
Auto Trait Implementations§
impl Freeze for HermiteCurve
impl RefUnwindSafe for HermiteCurve
impl Send for HermiteCurve
impl Sync for HermiteCurve
impl Unpin for HermiteCurve
impl UnsafeUnpin for HermiteCurve
impl UnwindSafe for HermiteCurve
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.