| 28 |
if form.has_key('cx'): |
if form.has_key('cx'): |
| 29 |
cx= atof(form['cx'].value) |
cx= atof(form['cx'].value) |
| 30 |
else: |
else: |
| 31 |
cx= 0 |
cx= 0.0 |
| 32 |
|
|
| 33 |
if form.has_key('cy'): |
if form.has_key('cy'): |
| 34 |
cy= atof(form['cy'].value) |
cy= atof(form['cy'].value) |
| 35 |
else: |
else: |
| 36 |
cy= 0 |
cy= 0.0 |
| 37 |
|
|
| 38 |
if form.has_key('diag'): |
if form.has_key('diag'): |
| 39 |
diag= atof(form['diag'].value) |
diag= atof(form['diag'].value) |
| 53 |
|
|
| 54 |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> |
| 55 |
<HTML><HEAD> |
<HTML><HEAD> |
| 56 |
<TITLE>Mandel Set Zoomer</TITLE> |
<TITLE>Mandelbrot Set Zoomer</TITLE> |
| 57 |
</HEAD> |
</HEAD> |
| 58 |
<BODY> |
<BODY> |
| 59 |
<H1>Mandel Set Zoomer</H1> |
<H1>Mandelbrot Set Zoomer</H1> |
| 60 |
|
|
| 61 |
<FORM ACTION="mandelzoom.cgi" METHOD=GET> |
<FORM ACTION="mandelzoom.cgi" METHOD=GET> |
| 62 |
|
|
| 68 |
ds="&debug=on" |
ds="&debug=on" |
| 69 |
else: |
else: |
| 70 |
ds="" |
ds="" |
| 71 |
|
if form.has_key('image.x') and form.has_key('image.y'): |
| 72 |
|
# Adjust cx and cy |
| 73 |
|
ix= atof(form['image.x'].value) |
| 74 |
|
iy= atof(form['image.y'].value) |
| 75 |
|
owidth= atof(form['owidth'].value) |
| 76 |
|
oheight= atof(form['oheight'].value) |
| 77 |
|
diagp= math.sqrt(width**2 + height**2) |
| 78 |
|
scale= diagp/diag |
| 79 |
|
cx= (ix/scale) + (cx - (width / (scale*2))) |
| 80 |
|
cy= ((height-iy)/scale) + (cy - (height / (scale*2))) |
| 81 |
if form.has_key('zoom'): |
if form.has_key('zoom'): |
| 82 |
zoom=atof(form['zoom'].value) |
zoom=atof(form['zoom'].value) |
| 83 |
diag=diag/zoom |
diag=diag/zoom |
| 84 |
else: |
else: |
| 85 |
# If no zoom provided, don't actually zoom |
# If no zoom provided, don't actually zoom |
| 86 |
zoom= 2 |
zoom= 2.0 |
| 87 |
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 '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)), |
| 88 |
print 'ALIGN=BOTTOM HEIGHT="%s"' % (str(height)), |
print 'ALIGN=BOTTOM HEIGHT="%s"' % (str(height)), |
| 89 |
print 'WIDTH="%s"><P>' % (str(width)) |
print 'WIDTH="%s"><P>' % (str(width)) |
| 96 |
if zv == 1: |
if zv == 1: |
| 97 |
print '>Pan' |
print '>Pan' |
| 98 |
elif zv < 1: |
elif zv < 1: |
| 99 |
if int(1/zv) == 1/zv: |
print '>Out ÷%s' % (str(1/zv)) |
|
print '>Out ÷%s' % (str(int(1/zv))) |
|
|
else: |
|
|
print '>Out ÷%s' % (str(1/zv)) |
|
| 100 |
else: |
else: |
| 101 |
print '>In ×%s' % (str(zv)) |
print '>In ×%s' % (str(zv)) |
| 102 |
print '</SELECT>' |
print '</SELECT>' |
| 112 |
else: |
else: |
| 113 |
print '>' |
print '>' |
| 114 |
print '<INPUT TYPE=SUBMIT VALUE="Apply">' |
print '<INPUT TYPE=SUBMIT VALUE="Apply">' |
| 115 |
for var in (("diag", diag), ("cx", cx), ("cy", cy)): |
for var in (("diag", diag), ("cx", cx), ("cy", cy), ("owidth", width), |
| 116 |
|
("oheight", height)): |
| 117 |
print '<INPUT TYPE=HIDDEN NAME="%s" VALUE="%s">' % var |
print '<INPUT TYPE=HIDDEN NAME="%s" VALUE="%s">' % var |
| 118 |
print '<INPUT TYPE=HIDDEN NAME=type VALUE="html">' |
print '<INPUT TYPE=HIDDEN NAME=type VALUE="html">' |
| 119 |
|
|
| 129 |
x= (width/2.0)/scale |
x= (width/2.0)/scale |
| 130 |
y= (height/2.0)/scale |
y= (height/2.0)/scale |
| 131 |
|
|
| 132 |
c1= cx - x + cy - y * (0+1j) |
c1= cx - x + (cy - y) * (0+1j) |
| 133 |
c2= cx + x + cy + y * (0+1j) |
c2= cx + x + (cy + y) * (0+1j) |
| 134 |
|
|
| 135 |
#print width, height, diag, cx, cy, diagp, scale, x, y, c1, c2 |
#print width, height, diag, cx, cy, diagp, scale, x, y, c1, c2 |
| 136 |
#sys.exit(0) |
#sys.exit(0) |