pub struct AttractorSampler {
pub attractor: AttractorType,
pub state: Vec3,
pub dt: f32,
pub time: f32,
pub scale: f32,
pub center: Vec3,
pub substeps: usize,
}Expand description
Stateful sampler that integrates an attractor over time.
Maintains the current state and advances it on each call to next().
Fields§
§attractor: AttractorTypeWhich system is integrated.
state: Vec3Current state in the attractor’s own coordinates (before scale and centre).
dt: f32Integration time step per sub-step.
time: f32Simulated time integrated so far.
scale: f32Scale applied to output positions (use normalization_scale() for unit cube).
center: Vec3Center offset applied after scaling.
substeps: usizeHow many integration steps per next() call (sub-steps for stability).
Implementations§
Source§impl AttractorSampler
impl AttractorSampler
Sourcepub fn new(attractor: AttractorType) -> Self
pub fn new(attractor: AttractorType) -> Self
A sampler starting on the attractor (after 5,000 warm-up steps) with its recommended time step and unit-cube scale.
Sourcepub fn next(&mut self) -> Vec3
pub fn next(&mut self) -> Vec3
Advance by substeps integration steps and return the normalised position.
Sourcepub fn sample_trajectory(&mut self, n: usize) -> Vec<Vec3>
pub fn sample_trajectory(&mut self, n: usize) -> Vec<Vec3>
Sample n points from the attractor trajectory.
Sourcepub fn set_attractor(&mut self, attractor: AttractorType)
pub fn set_attractor(&mut self, attractor: AttractorType)
Set the attractor type, resetting the state.
Trait Implementations§
Source§impl Clone for AttractorSampler
impl Clone for AttractorSampler
Auto Trait Implementations§
impl Freeze for AttractorSampler
impl RefUnwindSafe for AttractorSampler
impl Send for AttractorSampler
impl Sync for AttractorSampler
impl Unpin for AttractorSampler
impl UnsafeUnpin for AttractorSampler
impl UnwindSafe for AttractorSampler
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 more