Struct rosu_map::section::hit_objects::BorrowedCurve
source · 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(
points: &[PathControlPoint],
expected_len: Option<f64>,
bufs: &'bufs mut CurveBuffers
) -> Self
pub fn new( 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 copy 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>
source§fn eq(&self, other: &BorrowedCurve<'bufs>) -> bool
fn eq(&self, other: &BorrowedCurve<'bufs>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<'bufs> StructuralPartialEq for BorrowedCurve<'bufs>
Auto Trait Implementations§
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