Struct bevy::math::cubic_splines::CubicCurve
pub struct CubicCurve<P>where
P: Point,{ /* private fields */ }
Expand description
A collection of CubicSegment
s chained into a curve.
Implementations§
§impl<P> CubicCurve<P>where
P: Point,
impl<P> CubicCurve<P>where P: Point,
pub fn position(&self, t: f32) -> P
pub fn position(&self, t: f32) -> P
Compute the position of a point on the cubic curve at the parametric value t
.
Note that t
varies from 0..=(n_points - 3)
.
pub fn velocity(&self, t: f32) -> P
pub fn velocity(&self, t: f32) -> P
Compute the first derivative with respect to t at t
. This is the instantaneous velocity of
a point on the cubic curve at t
.
Note that t
varies from 0..=(n_points - 3)
.
pub fn acceleration(&self, t: f32) -> P
pub fn acceleration(&self, t: f32) -> P
Compute the second derivative with respect to t at t
. This is the instantaneous
acceleration of a point on the cubic curve at t
.
Note that t
varies from 0..=(n_points - 3)
.
pub fn iter_samples(
&self,
subdivisions: usize,
sample_function: fn(_: &CubicCurve<P>, _: f32) -> P
) -> impl Iterator<Item = P>
pub fn iter_samples( &self, subdivisions: usize, sample_function: fn(_: &CubicCurve<P>, _: f32) -> P ) -> impl Iterator<Item = P>
A flexible iterator used to sample curves with arbitrary functions.
This splits the curve into subdivisions
of evenly spaced t
values across the
length of the curve from start (t = 0) to end (t = 1), returning an iterator that evaluates
the curve with the supplied sample_function
at each t
.
Given subdivisions = 2
, this will split the curve into two lines, or three points, and
return an iterator over those three points, one at the start, middle, and end.
pub fn iter_positions(&self, subdivisions: usize) -> impl Iterator<Item = P>
pub fn iter_positions(&self, subdivisions: usize) -> impl Iterator<Item = P>
Iterate over the curve split into subdivisions
, sampling the position at each step.
pub fn iter_velocities(&self, subdivisions: usize) -> impl Iterator<Item = P>
pub fn iter_velocities(&self, subdivisions: usize) -> impl Iterator<Item = P>
Iterate over the curve split into subdivisions
, sampling the velocity at each step.
pub fn iter_accelerations(&self, subdivisions: usize) -> impl Iterator<Item = P>
pub fn iter_accelerations(&self, subdivisions: usize) -> impl Iterator<Item = P>
Iterate over the curve split into subdivisions
, sampling the acceleration at each step.
Trait Implementations§
§impl<P> Clone for CubicCurve<P>where
P: Clone + Point,
impl<P> Clone for CubicCurve<P>where P: Clone + Point,
§fn clone(&self) -> CubicCurve<P>
fn clone(&self) -> CubicCurve<P>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<P> Debug for CubicCurve<P>where
P: Debug + Point,
impl<P> Debug for CubicCurve<P>where P: Debug + Point,
§impl<P> Default for CubicCurve<P>where
P: Default + Point,
impl<P> Default for CubicCurve<P>where P: Default + Point,
§fn default() -> CubicCurve<P>
fn default() -> CubicCurve<P>
§impl<P> PartialEq<CubicCurve<P>> for CubicCurve<P>where
P: PartialEq<P> + Point,
impl<P> PartialEq<CubicCurve<P>> for CubicCurve<P>where P: PartialEq<P> + Point,
§fn eq(&self, other: &CubicCurve<P>) -> bool
fn eq(&self, other: &CubicCurve<P>) -> bool
self
and other
values to be equal, and is used
by ==
.impl<P> StructuralPartialEq for CubicCurve<P>where P: Point,
Auto Trait Implementations§
impl<P> RefUnwindSafe for CubicCurve<P>where P: RefUnwindSafe,
impl<P> Send for CubicCurve<P>where P: Send,
impl<P> Sync for CubicCurve<P>where P: Sync,
impl<P> Unpin for CubicCurve<P>where P: Unpin,
impl<P> UnwindSafe for CubicCurve<P>where P: UnwindSafe,
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World