pub struct IteratedFunctionSystem {
pub transforms: Vec<AffineTransform2D>,
pub probabilities: Vec<f64>,
}Expand description
An Iterated Function System consisting of affine transforms with associated probabilities.
Fields§
§transforms: Vec<AffineTransform2D>The affine transforms.
probabilities: Vec<f64>Probability weights for each transform (must sum to ~1.0).
Implementations§
Source§impl IteratedFunctionSystem
impl IteratedFunctionSystem
Sourcepub fn new(transforms: Vec<AffineTransform2D>, probabilities: Vec<f64>) -> Self
pub fn new(transforms: Vec<AffineTransform2D>, probabilities: Vec<f64>) -> Self
Create a new IFS with given transforms and probabilities.
Handles empty transforms gracefully (returns empty results).
Sourcepub fn with_equal_probabilities(transforms: Vec<AffineTransform2D>) -> Self
pub fn with_equal_probabilities(transforms: Vec<AffineTransform2D>) -> Self
Create an IFS with equal probabilities for all transforms.
Sourcepub fn chaos_game(
&self,
start: Point2,
iterations: usize,
skip: usize,
) -> Vec<Point2>
pub fn chaos_game( &self, start: Point2, iterations: usize, skip: usize, ) -> Vec<Point2>
Run the chaos game algorithm to generate attractor points.
Starting from start, iterates iterations times selecting transforms
according to their probabilities. Returns the generated points after
discarding the first skip transient points.
Sourcepub fn deterministic_iterate(
&self,
initial_points: &[Point2],
generations: usize,
) -> Vec<Point2>
pub fn deterministic_iterate( &self, initial_points: &[Point2], generations: usize, ) -> Vec<Point2>
Deterministic iteration: apply all transforms to every point in the set.
Starting from initial_points, applies all transforms to produce
the next generation. Repeats for generations steps.
Sourcepub fn num_transforms(&self) -> usize
pub fn num_transforms(&self) -> usize
Number of transforms in this IFS.
Sourcepub fn barnsley_fern() -> Self
pub fn barnsley_fern() -> Self
Create the Barnsley Fern IFS.
Trait Implementations§
Source§impl Clone for IteratedFunctionSystem
impl Clone for IteratedFunctionSystem
Source§fn clone(&self) -> IteratedFunctionSystem
fn clone(&self) -> IteratedFunctionSystem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for IteratedFunctionSystem
impl RefUnwindSafe for IteratedFunctionSystem
impl Send for IteratedFunctionSystem
impl Sync for IteratedFunctionSystem
impl Unpin for IteratedFunctionSystem
impl UnsafeUnpin for IteratedFunctionSystem
impl UnwindSafe for IteratedFunctionSystem
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.