pub struct Spline<T>where
T: MyFloat,{
pub params: Vec<CurveParams<T>>,
pub additional: Vec<Curve>,
}Expand description
A hermite spline, each curve parameterized by CurveParms.
Fields§
§params: Vec<CurveParams<T>>§additional: Vec<Curve>Implementations§
Source§impl<T> Spline<T>where
T: MyFloat,
impl<T> Spline<T>where
T: MyFloat,
Sourcepub fn new(points: &[Point<T>]) -> Self
pub fn new(points: &[Point<T>]) -> Self
Creates a spline from the given points
For each pair of points, we need to find a Hermite polynomial
that smoothly interpolates between them.
Creates a segment between every consecutive pair of points, and uses the solve function to compute Hermite coefficients for each segment.
pub fn max_u(&self) -> Fpt
pub fn max_additional_u(&self) -> f64
Sourcepub fn iter(&self) -> impl Iterator<Item = &CurveParams<T>>
pub fn iter(&self) -> impl Iterator<Item = &CurveParams<T>>
Iterate through the hermite curves of the spline
Sourcepub fn curve_at(&self, u: &T) -> Option<MyVector3<T>>
pub fn curve_at(&self, u: &T) -> Option<MyVector3<T>>
Find the position of the spline at u.
A value of u = 0 gives us the starting point of the spline,
while u = 1 corresponds to the end of the first curve.
This method evaluates the position by taking the floor(u)-th curve
in the spline, and taking its position at u - floor(u).
fn u_to_i_rem(&self, u: &T) -> (usize, T)
pub fn curve_direction_at(&self, u: &T) -> Option<MyVector3<T>>
Sourcepub fn curve_1st_derivative_at(&self, u: &T) -> Option<MyVector3<T>>
pub fn curve_1st_derivative_at(&self, u: &T) -> Option<MyVector3<T>>
Find the 1st derivative (“velocity”) of the spline at u
Sourcepub fn curve_2nd_derivative_at(&self, u: &T) -> Option<MyVector3<T>>
pub fn curve_2nd_derivative_at(&self, u: &T) -> Option<MyVector3<T>>
Find the 2nd derivative (“acceleration”) of the spline at u
Sourcepub fn curve_3rd_derivative_at(&self, u: &T) -> Option<MyVector3<T>>
pub fn curve_3rd_derivative_at(&self, u: &T) -> Option<MyVector3<T>>
Find the 3rd derivative (“jerk”) of the spline at u
Sourcepub fn curve_4th_derivative_at(&self, u: &T) -> Option<MyVector3<T>>
pub fn curve_4th_derivative_at(&self, u: &T) -> Option<MyVector3<T>>
Find the 4th derivative (“snap”) of the spline at u
Sourcepub fn curve_normal_at(&self, u: &T) -> Option<MyVector3<T>>
pub fn curve_normal_at(&self, u: &T) -> Option<MyVector3<T>>
Unit normal of the spline at u
pub fn curve_kappa_at(&self, u: &T) -> Option<T>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Spline<T>
impl<T> !RefUnwindSafe for Spline<T>
impl<T> !Send for Spline<T>
impl<T> !Sync for Spline<T>
impl<T> Unpin for Spline<T>where
T: Unpin,
impl<T> !UnwindSafe for Spline<T>
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.