[][src]Struct fractal_gen::fractal::Fractal

pub struct Fractal {
    pub image: Img,
}

The structure of the Fractal.

Fields

image: Img

The fractal's image data.

Methods

impl Fractal[src]

pub fn new(pixels: Vec<Vec<Pixel>>) -> Fractal[src]

Create a Fractal by giving the pixels as a 2D Vector.

Example

let mut image = Fractal::new(pixels);

pub fn write_image(&self, path: &str)[src]

Write the image as a bmp file in the given path.

Example

let image = image::Img::new(pixels);
image.write_image("./myimage.bmp");

pub fn circle(&mut self, xc: usize, yc: usize, radius: u32, color: Pixel)[src]

Generate a circle by giving the center coordinates, the radius, and the color.

pub fn multiple_circles(
    &mut self,
    xc: usize,
    yc: usize,
    radius: u32,
    number: u32,
    color: Pixel
)
[src]

Generate repeating circle patterns where each circle's radius is decremented by number.

Example

image.multiple_circles(825, 825, 125, 6, Pixel::new(0, 150, 150));

pub fn koch_curve(
    &mut self,
    p1x: i32,
    p1y: i32,
    p2x: i32,
    p2y: i32,
    amount: u32,
    color: Pixel
)
[src]

Generate a Koch Curve by giving the start and end coordinates, the color, and the amount of recursion. Keep in mind that the time to run increases significantly as amount increases.

Example

image.koch_curve(675, 75, 925, 325, 5, Pixel::new(0, 250, 0));

pub fn triangle(&mut self, x: u32, y: u32, h: u32, color: Pixel)[src]

Generate a triange by giving its coordinates, height and color.

pub fn trianglev2(&mut self, x: u32, y: u32, h: u32, color: Pixel)[src]

Generate a triange by giving its coordinates, height and color.

pub fn sierpinski_triangle(&mut self, x: u32, y: u32, h: u32, color: Pixel)[src]

Generate a Sierpinksi Triange by giving its coordinates, height, and color.

pub fn multiple_triangles(
    &mut self,
    x: u32,
    y: u32,
    h: u32,
    number: u32,
    color: Pixel
)
[src]

Generate repeating triangles where each triangles height is decremented by number.

Example

image.multiple_triangles(175, 800, 220, 6, Pixel::new(250, 0, 250));

pub fn mandelbrot(&mut self, color: Pixel)[src]

Generate a Mandelbrot Set with the given color.

Example

image.mandelbrot(Pixel::new(250, 0, 0));

pub fn rotate(&mut self)[src]

Rotate the fractal by 90 degrees.

pub fn tree(
    &mut self,
    x: u32,
    y: u32,
    h: u32,
    angle: f64,
    growth: u32,
    color: Pixel
)
[src]

Generate a tree by giving its coordinates, height, angle, growth, and color.

Example

image.tree(100, 800, 100, PI / 4.0, 2, Pixel::new(0, 0, 255));

pub fn barnsley_fern(&mut self, x: i32, y: u32, iterations: u32, color: Pixel)[src]

Generate a fern by selecting its coordinates, number of iterations, and color. The more iterations, the better the shape becomes a fern. A good value is about 5000000.

Example

image.barnsley_fern(500, 100, 5000000, Pixel::new(255, 0, 0));

pub fn julia(&mut self)[src]

Generate a Julia Set.

Example

image.julia();

pub fn julia_colored(&mut self, color: Pixel)[src]

Generate a Julia Set with a mixture of colors given in the pixel parameter.

Example

image.julia_colored(Pixel::new(250, 150, 100));

Auto Trait Implementations

impl RefUnwindSafe for Fractal

impl Send for Fractal

impl Sync for Fractal

impl Unpin for Fractal

impl UnwindSafe for Fractal

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.