--- fract/mandelzoom.cgi 2001/02/25 20:12:25 1.4 +++ fract/mandelzoom.cgi 2001/02/25 22:54:25 1.5 @@ -38,14 +38,14 @@ if form.has_key('diag'): diag= atof(form['diag'].value) else: - diag= math.sqrt(8) + diag= math.sqrt(32) # sqrt(4**2 + 4**2) debug= form.has_key('debug') if form.has_key('iter'): maxiter= atoi(form['iter'].value) else: - maxiter= 240 + maxiter= 270 # If type!=image, then output an HTML page, not an image if not (form.has_key('type') and form['type'].value == "image"): @@ -69,7 +69,7 @@ else: ds="" if form.has_key('zoom'): - zoom=atoi(form['zoom'].value) + zoom=atof(form['zoom'].value) diag=diag/zoom else: # If no zoom provided, don't actually zoom @@ -78,9 +78,9 @@ print 'ALIGN=BOTTOM HEIGHT="%s"' % (str(height)), print 'WIDTH="%s">

' % (str(width)) print 'Zoom: ' - for key in form.keys(): - if key not in ["zoom", "type", "debug", "image.x", "image.y", "iter", "height", "width"]: - print '' % (key, form[key].value) - #for var in [("diag", diag), ("cx", cx), ("cy", cy)]: - + for var in (("diag", diag), ("cx", cx), ("cy", cy)): + print '' % var print '' print """ """ sys.exit(0) -c1, c2 = (-2+2j), (2-2j) # Corner coordinates +# Figure out c1 and c2 from width, height, diag, cx, and cy. +# Diagonal in pixels +diagp= math.sqrt(width**2 + height**2) +# Scale between pixels and coordinates +scale= diagp/diag +x= (width/2.0)/scale +y= (height/2.0)/scale + +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) + +#c1, c2 = (-2+2j), (2-2j) # Corner coordinates # Force c1 to be upper left and c2 to be lower right c1, c2= complex(min(c1.real, c2.real), max(c1.imag, c2.imag)), \