Skip to main content

FractalDescriptor

Trait FractalDescriptor 

Source
pub trait FractalDescriptor {
    // Required methods
    fn config(&self) -> &FractalConfig;
    fn center(&self) -> Complex;
    fn render_pixel(
        &self,
        z_init: Complex,
        scale: f64,
        max_radius: f64,
    ) -> (ColorRGB, f64, f64);
    fn info_text(&self) -> String;

    // Provided method
    fn is_julia(&self) -> bool { ... }
}
Expand description

A polymorphic trait that defines the core algebraic structure for any procedural fractal.

Implementing this trait automatically provides an optimised ImageEffect implementation via the blanket impl below, keeping the rendering engine fully decoupled from the specific mathematics of each generator.

Required Methods§

Source

fn config(&self) -> &FractalConfig

Retrieves the shared viewport layout configuration.

Source

fn center(&self) -> Complex

Focus centre point on the complex plane.

For Julia-family fractals the centre is the constant c; for Mandelbrot-family fractals it is the viewport centre used by Viewport.

Source

fn render_pixel( &self, z_init: Complex, scale: f64, max_radius: f64, ) -> (ColorRGB, f64, f64)

Maps a pre-projected complex coordinate to its blended colour contribution.

Returns (rgb, alpha, shadow_alpha).

Source

fn info_text(&self) -> String

Returns a comprehensive diagnostic string formatted for the generator’s equation.

Provided Methods§

Source

fn is_julia(&self) -> bool

When true the viewport maps the initial z; when false it maps c.

Defaults to false (Mandelbrot-style mapping).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§