pub struct Curve { /* private fields */ }Expand description
A curve with owned lists of path points and segment lengths.
Implementations§
Source§impl Curve
impl Curve
Sourcepub fn new(
mode: GameMode,
points: &[PathControlPoint],
expected_len: Option<f64>,
bufs: &mut CurveBuffers,
) -> Self
pub fn new( mode: GameMode, points: &[PathControlPoint], expected_len: Option<f64>, bufs: &mut CurveBuffers, ) -> Self
Create a new Curve.
Sourcepub fn position_at(&self, progress: f64) -> Pos
pub fn position_at(&self, progress: f64) -> Pos
The interpolated position at the given progress.
Sourcepub fn progress_to_dist(&self, progress: f64) -> f64
pub fn progress_to_dist(&self, progress: f64) -> f64
Value between 0.0 and the curve’s distance, depending on the given progress between 0.0 and 1.0.
Sourcepub fn idx_of_dist(&self, d: f64) -> usize
pub fn idx_of_dist(&self, d: f64) -> usize
The index into Curve::lengths to reach the distance d.
Sourcepub fn interpolate_vertices(&self, i: usize, d: f64) -> Pos
pub fn interpolate_vertices(&self, i: usize, d: f64) -> Pos
Interpolate the position between the i’th and i+1’th path position
at distance d.
Sourcepub fn as_borrowed_curve(&self) -> BorrowedCurve<'_>
pub fn as_borrowed_curve(&self) -> BorrowedCurve<'_>
Cheaply transform Curve into BorrowedCurve.
Trait Implementations§
impl StructuralPartialEq for Curve
Auto Trait Implementations§
impl Freeze for Curve
impl RefUnwindSafe for Curve
impl Send for Curve
impl Sync for Curve
impl Unpin 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