9
Viscomp I c2-2011

Viscomp I

Embed Size (px)

DESCRIPTION

Viscomp I. c2-2011. Entrega TP1 ?. Fractales y mapeo del espacio. El conjunto de Mandelbrot : conjunto de valores complejos ( z ). Fractales y mapeo del espacio. Fractal de Mandelbrot Zr i = Zr i-1 2 + Z 0 Converge cuando el modulo es < 2 ComplexNumber z0 = new ComplexNumber(r,i); - PowerPoint PPT Presentation

Citation preview

Page 1: Viscomp I

Viscomp I

c2-2011

Page 2: Viscomp I

Entrega TP1 ?

Page 3: Viscomp I

El conjunto de Mandelbrot : conjunto de valores complejos (z).

Fractales y mapeo del espacio

Page 4: Viscomp I

Fractales y mapeo del espacio

Fractal de Mandelbrot

Zri = Zri-12 + Z0

Converge cuando el modulo es < 2ComplexNumber z0 = new ComplexNumber(r,i);

ComplexNumber zn = new ComplexNumber(0,0);

double modulo = zn.module();

while ((count<256) && ((modulo)<2)) {

zn = ComplexNumber.add ( ComplexNumber.square(zn), z0); modulo = zn.module();

count++;

}

return (count); } /// Esta es la variable que vamos a usar para colorear

Page 5: Viscomp I

Cómo dibujo en pantalla ?

Fractal determinado entreZr (reales ) : -1.5 < zr < 0.5Zi (imaginario : -1 < zi < 1

Pantalla

Page 6: Viscomp I

Fractales y mapeo del espacio

Dado px y py ,mapear a espacio complejo

int w = Buffer.Width;int h = Buffer.Height;rMax = 0.5 ;rMin = -1.5;iMax = 1.0;iMin = -1.0;

// Mapeo de la pantalla al fractalDouble rRange = (rMax-rmin)/w;double iRange = (iMax-iMin)/h;int count = 0;double zr = px * rRange + rMin ;double zi = (h-py) * iRange + iMin;

Ejemplos: Si px=512dx = [0.5- (-1.5)] / 512 = 0.00390625zr = 512 * 0.00390625 + (-1.5) = 0.5

Si px=0dx = [0.5- (-1.5)] / 512 = 0.00390625zr = 0 * 0.00390625 + (-1.5) = -1.5

Si px=256dx = [0.5- (-1.5)] / 512 = 0.00390625zr = 256 * 0.00390625 + (-1.5) = -0.5

Page 7: Viscomp I

Operaciones de números complejos

class ComplexNumber {double r,i;…

Square: r = r2– i2 i = 2 * r * i

Add: r = z1.r + z2.r i = z1.i + z2.i

Mul: r = z1.r * z2.r - z1.i * z2.i i = z1.i * z2.r + z1.r * z2.i

Scale: r = z1.r * scale i = z1.i + scale

Module: result = sqrt(r2 + i2)

Page 8: Viscomp I

Manowar

c = z1(0) = z(0)zn+1 = zn

2 + z1n + c;

z1n+1 = zn;

Page 9: Viscomp I

Spider

c = z(0)zn+1 = zn

2 + cn;

cn+1 = (cn /2) + zn+1 ;