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: AttractorType§state: Vec3§dt: f32§time: f32§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
pub fn new(attractor: AttractorType) -> Self
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
Source§fn clone(&self) -> AttractorSampler
fn clone(&self) -> AttractorSampler
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 moreAuto 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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.