//! # Transform //! //! Transforms are the "functions" in an iterated function system. They take in a point, //! and generate a new point. For fractal flames, transforms are always affine, //! but produce more interesting images once we add variations. use bytemuck::{Pod, Zeroable}; use glam::{Affine2, Vec2}; /// Affine transform for use in the [`chaos_game`](crate::chaos_game). #[derive(Copy, Clone, Pod, Zeroable)] #[repr(C)] pub struct Transform { coefficients: Affine2, } impl Transform { /// Create a new transform from an affine transformation matrix pub fn new(coefficients: Affine2) -> Self { Transform { coefficients } } /// Apply this transform to a point in IFS coordinates, producing a new point pub fn transform_point(&self, point: Vec2) -> Vec2 { self.coefficients.transform_point2(point) } }