--- fract/mandelzoom.cgi 2001/02/25 22:54:25 1.5 +++ fract/mandelzoom.cgi 2001/02/26 03:13:13 1.6 @@ -28,12 +28,12 @@ if form.has_key('cx'): cx= atof(form['cx'].value) else: - cx= 0 + cx= 0.0 if form.has_key('cy'): cy= atof(form['cy'].value) else: - cy= 0 + cy= 0.0 if form.has_key('diag'): diag= atof(form['diag'].value) @@ -53,10 +53,10 @@ -Mandel Set Zoomer +Mandelbrot Set Zoomer -

Mandel Set Zoomer

+

Mandelbrot Set Zoomer

@@ -68,12 +68,22 @@ ds="&debug=on" else: ds="" + if form.has_key('image.x') and form.has_key('image.y'): + # Adjust cx and cy + ix= atof(form['image.x'].value) + iy= atof(form['image.y'].value) + owidth= atof(form['owidth'].value) + oheight= atof(form['oheight'].value) + diagp= math.sqrt(width**2 + height**2) + scale= diagp/diag + cx= (ix/scale) + (cx - (width / (scale*2))) + cy= ((height-iy)/scale) + (cy - (height / (scale*2))) if form.has_key('zoom'): zoom=atof(form['zoom'].value) diag=diag/zoom else: # If no zoom provided, don't actually zoom - zoom= 2 + zoom= 2.0 print 'SRC="mandelzoom.cgi?type=image&width=%s&height=%s&iter=%s%s&diag=%s&cx=%s&cy=%s"' % (str(width), str(height), str(maxiter), ds, str(diag), str(cx), str(cy)), print 'ALIGN=BOTTOM HEIGHT="%s"' % (str(height)), print 'WIDTH="%s">

' % (str(width)) @@ -86,10 +96,7 @@ if zv == 1: print '>Pan' elif zv < 1: - if int(1/zv) == 1/zv: - print '>Out ÷%s' % (str(int(1/zv))) - else: - print '>Out ÷%s' % (str(1/zv)) + print '>Out ÷%s' % (str(1/zv)) else: print '>In ×%s' % (str(zv)) print '' @@ -105,7 +112,8 @@ else: print '>' print '' - for var in (("diag", diag), ("cx", cx), ("cy", cy)): + for var in (("diag", diag), ("cx", cx), ("cy", cy), ("owidth", width), + ("oheight", height)): print '' % var print '' @@ -121,8 +129,8 @@ x= (width/2.0)/scale y= (height/2.0)/scale -c1= cx - x + cy - y * (0+1j) -c2= cx + x + cy + y * (0+1j) +c1= cx - x + (cy - y) * (0+1j) +c2= cx + x + (cy + y) * (0+1j) #print width, height, diag, cx, cy, diagp, scale, x, y, c1, c2 #sys.exit(0)