pub struct BorrowedCurve<'bufs> { /* private fields */ }Expand description
A curve with borrowed lists of path points and segment lengths.
Implementations§
Source§impl<'bufs> BorrowedCurve<'bufs>
impl<'bufs> BorrowedCurve<'bufs>
Sourcepub fn new(
mode: GameMode,
points: &[PathControlPoint],
expected_len: Option<f64>,
bufs: &'bufs mut CurveBuffers,
) -> Self
pub fn new( mode: GameMode, points: &[PathControlPoint], expected_len: Option<f64>, bufs: &'bufs mut CurveBuffers, ) -> Self
Create a new BorrowedCurve which borrows from CurveBuffers.
Sourcepub const fn path(&self) -> &[Pos]
pub const fn path(&self) -> &[Pos]
Path points of the BorrowedCurve.
Sourcepub const fn lengths(&self) -> &[f64]
pub const fn lengths(&self) -> &[f64]
The BorrowedCurve’s length at each path point.
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 dist(&self) -> f64
pub fn dist(&self) -> f64
The total distance of the BorrowedCurve.
Sourcepub fn idx_of_dist(&self, d: f64) -> usize
pub fn idx_of_dist(&self, d: f64) -> usize
The index into BorrowedCurve::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 to_owned_curve(&self) -> Curve
pub fn to_owned_curve(&self) -> Curve
Allocates the borrowed lists to transform BorrowedCurve into Curve.
Trait Implementations§
Source§impl<'bufs> Clone for BorrowedCurve<'bufs>
impl<'bufs> Clone for BorrowedCurve<'bufs>
Source§fn clone(&self) -> BorrowedCurve<'bufs>
fn clone(&self) -> BorrowedCurve<'bufs>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'bufs> Debug for BorrowedCurve<'bufs>
impl<'bufs> Debug for BorrowedCurve<'bufs>
Source§impl<'bufs> PartialEq for BorrowedCurve<'bufs>
impl<'bufs> PartialEq for BorrowedCurve<'bufs>
impl<'bufs> StructuralPartialEq for BorrowedCurve<'bufs>
Auto Trait Implementations§
impl<'bufs> Freeze for BorrowedCurve<'bufs>
impl<'bufs> RefUnwindSafe for BorrowedCurve<'bufs>
impl<'bufs> Send for BorrowedCurve<'bufs>
impl<'bufs> Sync for BorrowedCurve<'bufs>
impl<'bufs> Unpin for BorrowedCurve<'bufs>
impl<'bufs> UnwindSafe for BorrowedCurve<'bufs>
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