Next Fractal Explorer: plot.txt

Es parte de la publicación: Next Fractal Explorer
Tamaño del archivo: 2745
md5: 37c748fefcbed7de3bd330038413d37c
#program plot
   1 REM This file - plot.bas - is part of Next Fractal Explorer
   2 REM Next Fractal Explorer is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   3 REM 
   4 REM This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   5 REM 
   6 REM You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/
   7 REM 
   8 REM  to convert this to banked code LOAD plot.bas and then
   9 REM BANK NEW tmpbnk: BANK tmpbnk LINE 1,9999: SAVE "plotbanked.bas" BANK tmpbnk: BANK tmpbnk CLEAR
  11 REM original plotting procedure in BASIC. Very, very slow and 256x192 only
  12 REM Included for interest only. Attribution: https://rosettagit.org/drafts/mandelbrot-set/#basic256
  15 DEFPROC Mandel (plotsize,xmin,xmax,ymin,ymax,maxiter,startcol,savefn$)
  20 LAYER 1,1: BANK uibnk PROC ClearL1(0): PROC NewTextWin(6,9,10,7,12,5,1,4,10,14)
  30 showprog=1: PRINT #6; INK 15; AT 4,3;"H - show/hide"; AT 5,7;"progress"
  40 xoffset= (256-plotwidth)/2: yoffset= (192-plotheight)/2
  50 totalpix=plotwidth*plotheight
  60 layersavefn$= savefn$+".SL2"
  70 stopplot=0
  80 FOR x = startcol TO plotwidth-1
  90 jx = xmin + x * dx
 100 FOR y = 0 TO plotheight -1
 110 jy = ymin + y * dy
 120 k=0: wx=0.0: wy=0.0
 130 REPEAT 
 140 tx = wx * wx - wy * wy + jx
 150 ty = 2.0 * wx * wy + jy
 160 wx = tx
 170 wy = ty
 180 r= wx * wx + wy * wy
 190 k= k + 1
 200 REPEAT UNTIL r > m OR k > maxiter
 210 IF showprog=1 THEN 
 220 LAYER 1,1
 230 PRINT #6; AT 1,2; ; INK 14;"Progress: ";
 240 prog = ((x*plotheight)+y)/totalpix * 100
 250 PRINT #6; STR$ (prog,10,1);"% "
 260 LAYER 2,1
 270 ENDIF 
 280 IF k > maxiter THEN k= 0
 290 k$= INKEY$ 
 300 IF INKEY$ ="" THEN GO TO %360
 310 IF k$<>"h" AND k$<>"H" THEN GO TO %350
 320 showprog = 1 - showprog
 330 IF showprog=0 THEN LAYER OVER 0
 340 IF showprog=1 THEN LAYER OVER 5
 350 IF k$="q" OR k$="Q" THEN stopplot=1
 360 INK k
 370 PLOT x+xoffset,y+yoffset
 380 NEXT y
 390 REM 
 399 REM SavePlot has changed since this was written the call to it probably won't work
 400 PROC SavePlot(plotsize,xmin,xmax,ymin,ymax,maxiter,x,savefn$)
 410 IF stopplot=1 THEN GO TO %450
 420 NEXT x
 430 PAUSE 0
 440 PROC SavePlot (plotsize,xmin,xmax,ymin,ymax,maxiter,-1,savefn$)
 450 IF showprog=1 THEN 
 460 LAYER OVER 0: CLOSE # 6
 470 ENDIF 
 480 SAVE savefn$+".SL2" LAYER 
 490 ENDPROC 
 500 REM