Den 23.01.2012 13:09, skrev Sebastian Haase:
>
> I would think that interactive zooming would be quite nice
> ("illuminating") .... and for that 13 secs would not be tolerable....
> Well... it's not at the top of my priority list ... ;-)
>
Sure, that comes under the 'fast enough' issue. But even Fortran might
be too slow here?
For zooming Mandelbrot I'd use PyOpenGL and a GLSL fragment shader
(which would be a text string in Python):
madelbrot_fragment_shader = """
uniform sampler1D tex;
uniform vec2 center;
uniform float scale;
uniform int iter;
void main() {
vec2 z, c;
c.x = 1.3333 * (gl_TexCoord[0].x - 0.5) * scale - center.x;
c.y = (gl_TexCoord[0].y - 0.5) * scale - center.y;
int i;
z = c;
for(i=0; i<iter; i++) {
float x = (z.x * z.x - z.y * z.y) + c.x;
float y = (z.y * z.x + z.x * z.y) + c.y;
if((x * x + y * y)> 4.0) break;
z.x = x;
z.y = y;
}
gl_FragColor = texture1D(tex, (i == iter ? 0.0 : float(i)) / 100.0);
}
"""
The rest is just boiler-plate OpenGL...
Sources:
http://nuclear.mutantstargoat.com/articles/sdr_fract/
http://pyopengl.sourceforge.net/context/tutorials/shader_1.xhtml
Sturla
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion