home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.xmission.com
/
2014.06.ftp.xmission.com.tar
/
ftp.xmission.com
/
pub
/
lists
/
fractint
/
archive
/
v01.n395
< prev
next >
Wrap
Internet Message Format
|
1999-05-31
|
57KB
From: owner-fractint-digest@lists.xmission.com (fractint-digest)
To: fractint-digest@lists.xmission.com
Subject: fractint-digest V1 #395
Reply-To: fractint-digest
Sender: owner-fractint-digest@lists.xmission.com
Errors-To: owner-fractint-digest@lists.xmission.com
Precedence: bulk
fractint-digest Tuesday, June 1 1999 Volume 01 : Number 395
----------------------------------------------------------------------
Date: Tue, 01 Jun 1999 02:12:32 +1200
From: "Morgan L. Owens" <packrat@nznet.gen.nz>
Subject: RE: (fractint) Topology of the MandelBrot
At 09:29 31/05/99 -0300, you wrote:
>My English is somewhat poor. What is a midgit? The Babylon translator does
>not know it.
It ought to; a midgit is a thing (usually a person) that is smaller than
usual. In this case, it refers to the miniature versions of the Mandelbrot
set that are scattered around the main set.
MLO
- --------------------------------------------------------------
Thanks for using Fractint, The Fractals and Fractint Discussion List
Post Message: fractint@lists.xmission.com
Get Commands: majordomo@lists.xmission.com "help"
Administrator: twegner@phoenix.net
Unsubscribe: majordomo@lists.xmission.com "unsubscribe fractint"
------------------------------
Date: Mon, 31 May 1999 12:28:47 EDT
From: Damascena@aol.com
Subject: Re: (fractint) Topology of the MandelBrot
In a message dated 5/31/99 8:15:48 AM Mountain Daylight Time,
packrat@nznet.gen.nz writes:
> a midgit is a thing (usually a person) that is smaller than
> usual.
Babylon probably wants the word spelled correctly:
midget
Dama
- --------------------------------------------------------------
Thanks for using Fractint, The Fractals and Fractint Discussion List
Post Message: fractint@lists.xmission.com
Get Commands: majordomo@lists.xmission.com "help"
Administrator: twegner@phoenix.net
Unsubscribe: majordomo@lists.xmission.com "unsubscribe fractint"
------------------------------
Date: 31 May 99 22:11:43 MDT
From: Paul Derbyshire <pderbysh@usa.net>
Subject: (fractint) Fractal source code.
Attached below are two source files, which are fairly short.
The first, batchm.cc, is a simple C++ source, fully ANSI (I think, if you=
find
an incompatibility let me know), which generates a Mandelbrot image from
command line parameters (center, mag, and a few more) using either 1 pass=
,
tesseral, or guessing. It's been tested (in all 3 algorithms, with severa=
l
classic seahorse valley images) and works. The output is a 3 megabyte
"iter.dat" file. This file consists of a 1024x768 array of unsigned 32-bi=
t
integer values, which are iteration values, arrayed first across then dow=
n.
This is raw iteration data, not a meaningful image file format, to be col=
ored
externally. It is also not compressed, so it always takes up exactly 3
megabytes. (4 byte integer times 1024 times 768 is 4 times 1024 times (10=
24 *
3/4)) bytes ... or three quarters of 4*1024*1024, which is three quarters=
of 4
megs, which is 3 megs.)
A future revision will allow the output filename to be changed from the
default with a command line parameter and will nix a slight bug.
Known bugs: Just one. The occasional image is generated with a few pixels=
saved with maxiter+1 as the value. I am not certain how this happens and =
plan
to investigate. As a result, the maximum value in the iters.dat file isn'=
t
always the value you color black to fill the lake.
The program uses long double arithmetic (whose precision depends on the
machine architecture compiled on). It should be as capable of zooming as
Fractint sans arbitrary precision (e.g. Fractint 18.21 or Winfract).
It only does Mandelbrots. And it only does them plainly, with the lake fi=
lled
in as the set maxiter value.
There is periodicity checking by the way. The algorithm is a variant of a=
classic one and probably similar to Fractint's.
The second program is srenderm.cc. It requires the Allegro graphics libra=
ry or
something compatible. It should work with winalleg, dos allegro, and x wi=
ndows
allegro. It reads "iter.dat" in the format output by batchm and displays =
it
onscreen in the highest-bit-depth 1024x768 video mode it can autodetect. =
(A
high-color, i.e. 15 or more bits, 1024x768 mode *must* be available.)
The iterations are mapped between the minimum and maximum iteration to a
simple golden color scheme. The M-set itself is black (unless the
afore-mentioned batchm bug struck, in which case it will be white with
scattered black pixels adjoining).
A future revision will allow specifying the input file, saving the output=
in
=2Epcx format (to any input filename), optionally doing a render and save=
without invoking graphics, and allow editing of color scheme, loading, an=
d
saving in a manner resembling Ultra Fractal. I may also include an option=
for
rendering to a greyscale, applying some log function to the input in the
process, and outputting a greyscale TGA of the kind ray tracers can use f=
or
height-fields.
I may also develop a third program, pure ANSI with no special libraries
needed, for converting the batchm output into a triangle mesh of chosen l=
evel
of detail (up to 1024x768x2 triangles) saved in a format ray tracers can =
use.
Both programs handle errors rather ungracefully, by immediately terminati=
ng
with a terse but meaningful error message. (Some bug with killing the gfx=
mode
seems to suppress these with srenderm, which I shall fix soon.)
- ---
Here is the batchm.cc file, with comments explaining command line options=
and
some of the internals.
// batchm.cc
// (c) 1999 PGD. Open Source.
// Very simple batch Mandelbrot program.
// Types: just Mandelbrot.
// Algorithms: just periodicity checking and either 1-pass, tesseral, or =
solid
guessing.
// Options: 1, t, or g for algorithm, and option to determine "iteration
resolution".
// Interface: command line.
// Command line consists of center and mag (long doubles), iteration
resolution control, and optional switches.
// Examples: foo.exe (basic Mandelbrot)
// foo.exe -.75 0 10 (seahorse valley zoom)
// foo.exe -.75 0 10 5000 (Maxiter 5000 instead of default 2000)
// foo.exe -.75 0 10 5000 30 (Now iterations resolved individually =
from
1 to 30, to nearest even number from 31 to 90, etc.)
// foo.exe [real-center-coordinate] [imag-center-coordinate] [magnificati=
on]
[iteration-resolution] [switches]
// Anything before the first switch is regarded as the first, first and
second, first, second, and third, or first, second, third,
// and fourth of the numerical parameters.
// Switches: /1, /t, /g for algorithm.
// Output: Either an iter.dat file or an error message from the following=
:
// * Invalid switch Command line has an unrecognized switch.
// * Extra parameter Command line has an extra non-switch item.
// * Ill-formed parameter Command line has a parameter that is not a num=
ber
or else is not an integer
// but should be an integer.
// * Various libc file I/O errors to do with problems with writing iter.d=
at
// On-screen a successful run will display a progress indicator, outputin=
g
pixels-done/pixels-in-image every thousand pixels.
// Format of iter.dat: across-then-down 1024x768 array of iter values. Ea=
ch
value is a big-endian 32-bit integer.
// File size is thus 3 megabytes ... post-process it and then archive/del=
ete!
// Defaults: passes=3D1, center at (0, 0), magnification 1 (which means i=
mage is
4 units by 3), maxiter 2000, and
// iterations resolved as follows: individual -- 1 through 50. Nearest ev=
en --
51 through 150 (as 52, 54, ... , 150).
// Nearest multiple of 4 -- 151 through 350, etc.
// Math used: long doubles everywhere.
// For batchfile use, the errorlevels returned are:
// 0 -- Normal exit.
// 1 -- Incorrect cmdline.
// 2 -- File I/O error with output.
// 3 -- Miscellaneous error.
// 255 (-1) -- Crashed (should not happen).
// Compilation:
// This is portable ANSI C++. Compile this into an object, link with libc=
into
an executable, and you are off.
// For best results compile with latest egcs, with the best optimization
options for your cpu. The inner loop should run
// fast and tight in FP registers. There is no abort key -- if it is taki=
ng
forever you need to kill the process
// from the operating system.
// Get stdio to perform file output. This is largely 'C' code with only a=
few
C++ features. We mainly want C++
// for its pass-by-reference and tight type-checking.
#include <stdio.h>
// Convienient shorthands.
typedef long double real;
typedef unsigned long iter;
// Statically allocate 3 megabyte array to store iteration values.
iter iter_data[768][1024]; // Y then X reduces cache misses with small c=
aches
using passes=3D1 and passes=3Dg.
// Keep track of options.
// Algorithm for pixel 'coloring'.
enum alg { one, tess, guess };
alg current_alg =3D one;
// Periodicity checking sensitivity.
real per_check_sens;
const real per_check_s_base =3D 0.0000001;
// Bailout radius squared.
const real bail_radius_squared =3D 4;
// Center and magnification.
real center_real =3D -0.75;
real center_imag =3D 0;
real mag =3D 1;
// Dimensions at magnification 1.
const real xmag1 =3D 4;
const real ymag1 =3D 3;
// How frequently (in pixels) to report progress.
const long progress_freq =3D 1024; // Every row in passes=3D1; 768 times=
=2E
// Progress report stuff.
long pixels_done, next_report;
// Iteration resolution feature (used to enhance passes=3Dt, g with detai=
led
fractals; not used with passes=3D1).
iter ires_change =3D 50;
// Maxiter.
iter maxiter =3D 2000;
// Miniter.
iter miniter; // Value is determined by find_lowest_iter().
// Tesseral stop threshold.
const int min_tess_box_size =3D 4;
// Guessing initial stepsize.
const int guess_size =3D 16;
// Function prototypes.
// Input-related.
// Command line processor. Takes argc, argv, returns true if all is well,=
false if error.
// Outputs error message to stderr itself on failure. On success leaves
results stored in above globals.
bool process_cmdline (int argc, const char **argv);
// Output-related.
// Outputs an unsigned long to a FILE * in big-endian format.
void write_iter (FILE *dest, iter value);
// Outputs the iter_data array to iter.dat. Indiscriminately overwrites. =
Bool
has same meaning as for process_cmdline.
bool output_iters (void);
// Calculation-related.
// Calculates absolute of a real.
inline real ldabs (real x) { return (x<0) ? -x : x; }
// Calculates one pixel. Input: two reals, the x and y coordinates. Outpu=
t: a
long, the iteration count (raw).
iter calculate_pixel (real x, real y);
// Calculates an adjusted iter from a raw iter based on ires_change.
inline iter adjust_iter (iter i);
// Calculates an adjusted pixel.
inline iter calculate_adjusted_pixel (real x, real y) { return
adjust_iter(calculate_pixel(x, y)); }
// Find the minimum iteration.
void find_lowest_iter (void);
// Calculates the fractal.
void do_pixel (int sx, int sy);
void do_adjusted_pixel (int sx, int sy);
void one_pass_mandel (void);
void tesseral_mandel (int blockx, int blocky, int xblocksize, int yblocks=
ize);
void guessing_mandel (int size);
void calculate_mandel (void);
// Translates a pixel coordinate into a complex number, using given
center-mag. Adds a small jitter (+/-0.5) to
// both coordinates to prevent aliasing defects.
void make_coords (int sx, int sy, real &x, real &y);
// Main program.
int main (int argc, const char **argv) {
printf("\nRunning batchm.\n");
if (!process_cmdline(argc, argv)) {
printf("\nThere were some errors.\n\n");
return 1;
}
calculate_mandel();
if (!output_iters()) {
printf("\nThere were some errors.\n\n");
return 2;
}
printf("\nReturning from successful batchm run.\n\n");
return 0;
}
// Input-related.
// Command line processor. Takes argc, argv, returns true if all is well,=
false if error.
// Outputs error message to stderr itself on failure. On success leaves
results stored in above globals.
bool process_cmdline (int argc, const char **argv) {
bool found_switch =3D false;
const char *current;
char c;
int working_on_parm =3D 1;
printf ("\nProcessing input.\n");
for (int i=3D1; i<argc; ++i) {
current=3Dargv[i];
if (found_switch) {
if (current[0] !=3D '/') {
fprintf (stderr, "Error: Extra parameter %s after switches.\n",
current);
return false;
}
}
if (current[0] =3D=3D '/') {
// Found a switch.
c =3D current[1];
if (current[2] !=3D 0) {
fprintf (stderr, "Error: Invalid switch %s.", current);
return false;
}
switch (c) {
case '1':
current_alg =3D one; break;
case 't':
current_alg =3D tess; break;
case 'g':
current_alg =3D guess; break;
default:
fprintf (stderr, "Error: Invalid switch %s.", current);
return false;
}
// For now, only one switch is needed, to set algorithm; any others=
are
redundant.
// Issue a warning if this is a second.
if (found_switch) fprintf (stderr, "Warning: Redundant algorithm
switch.\n");
found_switch =3D true;
} else {
// Okay, we are working on some sort of parameter.
switch (working_on_parm) {
case 1:
// Center real. Is a real.
if (1 !=3D sscanf(current, "%Lf", ¢er_real)) {
fprintf(stderr, "Error: Ill-formed center real coordinate %s =
(not
a real number).", current);
return false;
}
printf ("Center x set to %Lf.\n", center_real);
break;
case 2:
// Center imag. Is a real.
if (1 !=3D sscanf(current, "%Lf", ¢er_imag)) {
fprintf(stderr, "Error: Ill-formed center real coordinate %s =
(not
a real number).", current);
return false;
}
printf ("Center y set to %Lf.\n", center_imag);
break;
case 3:
// Magnification. Is a real.
if (1 !=3D sscanf(current, "%Lf", &mag)) {
fprintf(stderr, "Error: Ill-formed center real coordinate %s =
(not
a real number).", current);
return false;
}
printf ("Magnification set to %Lf.\n", mag);
break;
case 4:
// Maxiter. Is an integer (unsigned).
if (1 !=3D sscanf(current, "%lu", &maxiter)) {
fprintf(stderr, "Error: Ill-formed center real coordinate %s =
(not
a real number).", current);
return false;
}
printf ("Maxiter set to %lu.\n", maxiter);
break;
case 5:
// Iteration resolution parameter. Is an integer (unsigned).
if (1 !=3D sscanf(current, "%lu", &ires_change)) {
fprintf(stderr, "Error: Ill-formed center real coordinate %s =
(not
a real number).", current);
return false;
}
printf ("Iteration resolution parameter set to %lu.\n",
ires_change);
break;
default:
fprintf (stderr, "Error: Extra sixth parameter %s.\n", current)=
;
return false;
}
++working_on_parm;
}
}
if (working_on_parm =3D=3D 6 && current_alg =3D=3D one) {
// The specification of a value for ires_change with passes=3D1 gener=
ates a
warning as ires_change is ignored with
// passes=3D1.
fprintf (stderr, "Warning: Specification of iter res parameter unused=
with
passes=3D1.");
}
return true;
}
// Output-related.
// Outputs an unsigned long to a FILE * in big-endian format.
void write_iter (FILE *dest, iter value) {
fputc((value & 0xff000000ul) >> 24, dest);
fputc((value & 0x00ff0000ul) >> 16, dest);
fputc((value & 0x0000ff00ul) >> 8, dest);
fputc(value & 0x000000fful, dest);
}
// Outputs the iter_data array to iter.dat. Indiscriminately overwrites. =
Bool
has same meaning as for process_cmdline.
bool output_iters (void) {
printf ("\nOutputing iterations data.\n");
FILE *of;
of =3D fopen("iter.dat","wb");
if (!of) {
perror("Error: Filesystem error writing output.\n");
return false;
}
for (int y=3D0; y<768; ++y) {
for (int x=3D0; x<1024; ++x) {
write_iter(of, iter_data[y][x]);
}
}
if (ferror(of)) {
perror("Error: Filesystem error writing output.\n");
return false;
}
if (fclose(of)) {
perror("Error: Filesystem error writing output.\n");
return false;
}
return true;
}
// Calculation-related.
// Calculates one pixel. Input: two reals, the x and y coordinates. Outpu=
t: a
long, the iteration count (raw).
iter calculate_pixel (real x, real y) {
real zx =3D 0;
real zy =3D 0;
real zx2 =3D 0;
real zy2 =3D 0;
real zzx =3D 0;
real zzy =3D 0;
real zzx2 =3D 0;
real zzy2 =3D 0;
real dst;
iter i =3D 0;
int mod16 =3D 0;
while (zx2+zy2 <=3D bail_radius_squared && i < maxiter) {
if (mod16 =3D=3D 16) {
mod16 =3D 0;
zzy =3D 2*zzx*zzy + y;
zzx =3D zzx2 - zzy2 + x;
zzx2 =3D zzx*zzx;
zzy2 =3D zzy*zzy;
}
++mod16;
zy =3D 2*zx*zy + y;
zx =3D zx2 - zy2 + x;
zx2 =3D zx*zx;
zy2 =3D zy*zy;
++i;
dst =3D ldabs(zx - zzx) + ldabs(zy - zzy);
if (dst < per_check_sens) i =3D maxiter; // Periodicity checking =
caught
a cycle.
}
=
return i;
}
// Translates a pixel coordinate into a complex number, using given
center-mag. Adds a small jitter (+/-0.5) to
// both coordinates to prevent aliasing defects.
void make_coords (int sx, int sy, real &x, real &y) {
real dx, dy;
dx =3D (((real)sx - (real)512) / (real)1024) * xmag1 / mag;
dy =3D (((real)384 - (real)sy) / (real)768) * ymag1 / mag;
x =3D center_real + dx;
y =3D center_imag + dy;
}
// Calculates an adjusted iter from a raw iter based on ires_change.
inline iter adjust_iter (iter i) {
iter result =3D i - miniter;
iter r1 =3D result;
int nearest_mod =3D 1;
int nmh =3D 1;
int nm2 =3D 1;
int r_mod;
while (r1 > ires_change) {
nmh =3D nearest_mod;
nearest_mod *=3D 2;
++nm2;
r1 -=3D ires_change;
r1 /=3D 2;
}
if (nearest_mod =3D=3D 1) return result;
// Compute result to nearest multiple of nearest_mod.
r_mod =3D result % nearest_mod;
result >>=3D nm2; // Same as /=3D nearest_mod.
if (r_mod >=3D nmh) ++result; // nmh is 1/2 nearest_mod so result is to=
be
rounded up.
result <<=3D nm2; // Same as *=3D nearest_mod. We have now rounded do=
wn or up,
depending.
return result;
}
// Find the minimum iteration.
void find_lowest_iter (void) {
// We compute the image boundary, and thereby locate the minimum iterat=
ion.
If necessary we retroactively adjust
// the computed iters.
int sx, sy;
real x, y;
iter i;
miniter =3D maxiter;
printf ("\nFinding minimum iteration and doing image border.\n");
// Top edge.
sy =3D 0;
for (sx =3D 0; sx < 1024; ++sx) {
make_coords(sx, sy, x, y);
i =3D calculate_pixel(x, y);
if (i < miniter) miniter =3D i;
iter_data[sy][sx] =3D i;
}
printf ("Top edge done.\n");
// Bottom edge.
sy =3D 767;
for (sx =3D 0; sx < 1024; ++sx) {
make_coords(sx, sy, x, y);
i =3D calculate_pixel(x, y);
if (i < miniter) miniter =3D i;
iter_data[sy][sx] =3D i;
}
printf ("Bottom edge done.\n");
// Left edge.
sx =3D 0;
for (sy =3D 1; sy < 767; ++sy) { // Skip corners, already done.
make_coords(sx, sy, x, y);
i =3D calculate_pixel(x, y);
if (i < miniter) miniter =3D i;
iter_data[sy][sx] =3D i;
}
printf ("Left edge done.\n");
// Right edge.
sx =3D 1023;
for (sy =3D 1; sy < 767; ++sy) { // Skip corners, already done.
make_coords(sx, sy, x, y);
i =3D calculate_pixel(x, y);
if (i < miniter) miniter =3D i;
iter_data[sy][sx] =3D i;
}
printf ("Right edge done.\n");
printf ("Minimum iteration is %ld.\n", miniter);
if (current_alg =3D=3D one) return;
printf ("Adjusting edge iters.\n");
// Top edge.
sy =3D 0;
for (sx =3D 0; sx < 1024; ++sx) {
iter_data[sy][sx] =3D adjust_iter(iter_data[sy][sx]); =
}
// Bottom edge.
sy =3D 767;
for (sx =3D 0; sx < 1024; ++sx) {
iter_data[sy][sx] =3D adjust_iter(iter_data[sy][sx]); =
}
// Left edge.
sx =3D 0;
for (sy =3D 1; sy < 767; ++sy) { // The corners are already done.
iter_data[sy][sx] =3D adjust_iter(iter_data[sy][sx]); =
}
// Top edge.
sx =3D 1023;
for (sy =3D 1; sy < 767; ++sy) { // The corners are already done.
iter_data[sy][sx] =3D adjust_iter(iter_data[sy][sx]); =
}
printf("Done adjusting edge iters.\n");
}
void do_pixel (int sx, int sy) {
real x, y;
if (iter_data[sy][sx] =3D=3D 0) {
make_coords(sx, sy, x, y);
iter_data[sy][sx] =3D calculate_pixel(x, y);
++pixels_done;
if (pixels_done >=3D next_report) {
printf ("%06ld/786432\n",pixels_done);
next_report=3D(pixels_done/progress_freq)*progress_freq + progress_=
freq;
}
}
}
void do_adjusted_pixel (int sx, int sy) {
real x, y;
if (iter_data[sy][sx] =3D=3D 0) {
make_coords(sx, sy, x, y);
iter_data[sy][sx] =3D calculate_adjusted_pixel(x, y);
++pixels_done;
if (pixels_done >=3D next_report) {
printf ("%06ld/786432\n",pixels_done);
next_report=3D(pixels_done/progress_freq)*progress_freq + progress_=
freq;
}
}
}
void fill_pixel (int sx, int sy, int i) {
if (iter_data[sy][sx] =3D=3D 0) {
iter_data[sy][sx] =3D i;
++pixels_done;
if (pixels_done >=3D next_report) {
printf ("%06ld/786432\n",pixels_done);
next_report=3D(pixels_done/progress_freq)*progress_freq + progress_=
freq;
}
}
}
// Calculates the fractal.
void calculate_mandel (void) {
printf("\nComputing iter data.\n");
per_check_sens =3D per_check_s_base/mag;
find_lowest_iter();
printf("\nComputing body.\n");
printf("003580/786432\n");
pixels_done=3D3580;
next_report=3D(pixels_done/progress_freq)*progress_freq + progress_freq=
;
switch(current_alg) {
case one:
one_pass_mandel(); break;
case tess:
tesseral_mandel(0, 0, 1023, 767); break;
case guess:
guessing_mandel(guess_size);
}
if (next_report !=3D 786432 + progress_freq) {
printf("786432/786432\n");
}
printf("\nCalculation complete.\n");
}
void one_pass_mandel (void) {
for (int sy=3D0; sy<768; ++sy) {
for (int sx=3D0; sx<1024; ++sx) {
do_pixel(sx, sy);
}
}
}
void tesseral_mandel (int blockx, int blocky, int xblocksize, int yblocks=
ize)
{
iter cmp;
bool subdivide =3D false;
int sx, sy;
int midx, midy;
int right =3D blockx + xblocksize;
int bottom =3D blocky + yblocksize;
do_adjusted_pixel(blockx, blocky);
cmp =3D iter_data[blocky][blockx];
// Top edge.
sy =3D blocky;
for (sx =3D blockx; sx <=3D right; ++sx) {
do_adjusted_pixel(sx, sy);
if (cmp !=3D iter_data[sy][sx]) subdivide =3D true;
}
// Bottom edge.
sy =3D bottom;
for (sx =3D blockx; sx <=3D right; ++sx) {
do_adjusted_pixel(sx, sy);
if (cmp !=3D iter_data[sy][sx]) subdivide =3D true;
}
// Left edge.
sx =3D blockx;
for (sy =3D blocky + 1; sy < bottom; ++sy) { // The corners are alread=
y done.
do_adjusted_pixel(sx, sy);
if (cmp !=3D iter_data[sy][sx]) subdivide =3D true;
}
// Right edge.
sx =3D right;
for (sy =3D blocky + 1; sy < bottom; ++sy) { // The corners are alread=
y done.
do_adjusted_pixel(sx, sy);
if (cmp !=3D iter_data[sy][sx]) subdivide =3D true;
}
if (subdivide) {
if (xblocksize <=3D min_tess_box_size) {
// Do inside of box pixel by pixel.
for (sy =3D blocky + 1; sy < bottom; ++sy) {
for (sx =3D blockx + 1; sx < right; ++sx) {
do_adjusted_pixel(sx, sy);
}
}
return;
}
if (xblocksize >=3D yblocksize) {
midx =3D (blockx + right)/2;
tesseral_mandel(blockx, blocky, midx - blockx + 1, yblocksize);
tesseral_mandel(midx, blocky, right - midx, yblocksize);
return;
}
midy =3D (blocky + bottom)/2;
tesseral_mandel(blockx, blocky, xblocksize, midy - blocky + 1);
tesseral_mandel(blockx, midy, xblocksize, bottom - midy);
return;
}
// Fill inside of box.
for (sy =3D blocky + 1; sy < bottom; ++sy) {
for (sx =3D blockx + 1; sx < right; ++sx) {
fill_pixel(sx, sy, cmp);
}
}
}
void guessing_mandel (int size) {
int bx, by, sx, sy;
iter cmp;
int s2 =3D size - 1;
for (by =3D 0; by < 768; by +=3D size) {
for (bx =3D 0; bx < 1024; bx +=3D size) {
// Check if box is not filled.
if (size=3D=3D2 || iter_data[by][bx + 1] =3D=3D 0) {
// Compute box corners.
do_adjusted_pixel(bx, by);
do_adjusted_pixel(bx + s2, by);
do_adjusted_pixel(bx, by + s2);
do_adjusted_pixel(bx + s2, by + s2);
cmp =3D iter_data[by][bx];
if (iter_data[by][bx + s2] =3D=3D cmp && iter_data[by + s2][bx] =3D=
=3D cmp &&
iter_data[by + s2][bx + s2] =3D=3D cmp) {
// Fill inside of box.
for (sy =3D by; sy < by + size; ++sy) {
for (sx =3D bx; sx < bx + size; ++sx) {
fill_pixel(sx, sy, cmp);
}
}
}
}
}
}
if (size>2) guessing_mandel(size/2);
}
- ---
Here is the srenderm.cc file. It has no command line options as yet. Run =
it
and get an error of or a gfx screen. After
admiring the fractal hit any key to kill gfx and exit to the OS.
// srenderm.cc
// (c) 1999 PGD. Open Source.
// Simple Mandelbrot data renderer.
// Allegro program, loads 1024x768x24 bit gfx mode and iter.dat file, out=
puts
// on video screen the fractal. Coloring is from black at miniter to dark=
red
at 20% to yellow at 80% to white at 100%.
// Maxiter is colored black.
#include <stdio.h>
#include <allegro.h>
typedef unsigned long iter;
iter iter_data[768][1024];
iter miniter, maxiter, difiter;
bool in_gfx =3D false;
void do_allegro_error (void);
void do_stdio_error (void);
void do_eof_error (void);
bool startup (void);
bool read_iter_value (iter &i, FILE *f);
bool load_data (void);
void render_data (void);
int get_color_for_iter (iter i);
void wait_for_exit (void);
int main (void) {
if (!startup()) return 1;
render_data();
wait_for_exit();
return 0;
}
void do_allegro_error (void) {
if (in_gfx) { set_gfx_mode (GFX_TEXT,80,25,0,0); }
fprintf(stderr, "Error: %s.\n", allegro_error);
}
void do_stdio_error (void) {
if (in_gfx) { set_gfx_mode (GFX_TEXT,80,25,0,0); }
perror("Error:");
}
void do_eof_error (void) {
if (in_gfx) { set_gfx_mode (GFX_TEXT,80,25,0,0); }
fprintf(stderr, "Unexpected EOF.\n");
}
bool startup (void) {
if (allegro_init()) { do_allegro_error(); return false; }
if (install_keyboard()) { do_allegro_error(); return false; }
set_color_depth(32);
if (set_gfx_mode(GFX_AUTODETECT, 1024, 768, 0, 0)) {
set_color_depth(24);
if (set_gfx_mode(GFX_AUTODETECT, 1024, 768, 0, 0)) {
set_color_depth(16);
if (set_gfx_mode(GFX_AUTODETECT, 1024, 768, 0, 0)) {
set_color_depth(15);
if (set_gfx_mode(GFX_AUTODETECT, 1024, 768, 0, 0)) {
do_allegro_error(); return false;
}
}
}
}
return load_data();
}
bool read_iter_value (iter &i, FILE *f) {
int j;
j =3D fgetc(f);
if (j =3D=3D EOF) { do_eof_error(); return false; }
i =3D j << 24;
j =3D fgetc(f);
if (j =3D=3D EOF) { do_eof_error(); return false; }
i +=3D j << 16;
j =3D fgetc(f);
if (j =3D=3D EOF) { do_eof_error(); return false; }
i +=3D j << 8;
j =3D fgetc(f);
if (j =3D=3D EOF) { do_eof_error(); return false; }
i +=3D j;
return true;
}
bool load_data (void) {
FILE *f;
iter i;
miniter =3D 0;
--miniter; // Should wrap to maximum value.
maxiter =3D 0;
f =3D fopen("iter.dat","rb");
if (!f) { do_stdio_error(); return false; }
for (int y=3D0; y<768; ++y) {
for (int x=3D0; x<1024; ++x) {
if (!read_iter_value(i, f)) return false;
iter_data[y][x] =3D i;
if (i < miniter) miniter =3D i;
if (i > maxiter) maxiter =3D i;
}
}
if (ferror(f)) { do_stdio_error(); return false; }
if (fclose(f)) { do_stdio_error(); return false; }
difiter =3D maxiter - miniter;
return true;
}
void render_data (void) {
iter i;
int col;
int white =3D makecol(255, 255, 255);
for (int y=3D0; y<768; ++y) {
hline(screen, 0, y, 1023, white);
for (int x=3D0; x<1024; ++x) {
i =3D iter_data[y][x];
col =3D get_color_for_iter(i);
putpixel(screen, x, y, col);
}
}
}
int get_color_for_iter (iter i) {
if (i =3D=3D maxiter) return makecol(0, 0, 0);
long double d =3D i;
d -=3D miniter;
d /=3D difiter;
int r, g, b;
if (d<0.002) {
d *=3D 500;
d *=3D 96;
r =3D (int)d;
return makecol(r, 0, 0);
}
if (d<0.152) {
d -=3D 0.002;
d /=3D 0.15;
r =3D 96 + (int)(d*160);
g =3D (int)(d*256);
return makecol(r, g, 0);
}
d -=3D 0.152;
d /=3D 0.848;
d *=3D 256;
b =3D (int)d;
return makecol(255, 255, b);
}
void wait_for_exit (void) {
while (keypressed()) readkey();
while (!keypressed());
set_gfx_mode (GFX_TEXT,80,25,0,0);
}
____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=3D=
1
- --------------------------------------------------------------
Thanks for using Fractint, The Fractals and Fractint Discussion List
Post Message: fractint@lists.xmission.com
Get Commands: majordomo@lists.xmission.com "help"
Administrator: twegner@phoenix.net
Unsubscribe: majordomo@lists.xmission.com "unsubscribe fractint"
------------------------------
Date: 31 May 99 22:20:57 MDT
From: Paul Derbyshire <pderbysh@usa.net>
Subject: (fractint) Code improvement: call for ideas
Below is the isolated main iteration loop from my batchm.cc. Any suggesti=
ons
to improve it (chiefly, the periodicity-checking) are welcomed.
As is, it competes with Fractint and I think slightly outperforms it, whe=
n
compiled optimized for Pentium Pro class CPUs and into native 32-bit code=
=2E
(Its performance on low-end 486s and especially coprocessorless machines =
will
probably be underwhelming, however. It is targeted at Pentiums and above.=
)
iter is a short-hand typedef for unsigned long.
iter calculate_pixel (real x, real y) {
real zx =3D 0;
real zy =3D 0;
real zx2 =3D 0;
real zy2 =3D 0;
real zzx =3D 0;
real zzy =3D 0;
real zzx2 =3D 0;
real zzy2 =3D 0;
real dst;
iter i =3D 0;
int mod16 =3D 0;
while (zx2+zy2 <=3D bail_radius_squared && i < maxiter) {
if (mod16 =3D=3D 16) {
mod16 =3D 0;
zzy =3D 2*zzx*zzy + y;
zzx =3D zzx2 - zzy2 + x;
zzx2 =3D zzx*zzx;
zzy2 =3D zzy*zzy;
}
++mod16;
zy =3D 2*zx*zy + y;
zx =3D zx2 - zy2 + x;
zx2 =3D zx*zx;
zy2 =3D zy*zy;
++i;
dst =3D ldabs(zx - zzx) + ldabs(zy - zzy);
if (dst < per_check_sens) i =3D maxiter; // Periodicity checking =
caught
a cycle.
}
=
return i;
}
____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=3D=
1
- --------------------------------------------------------------
Thanks for using Fractint, The Fractals and Fractint Discussion List
Post Message: fractint@lists.xmission.com
Get Commands: majordomo@lists.xmission.com "help"
Administrator: twegner@phoenix.net
Unsubscribe: majordomo@lists.xmission.com "unsubscribe fractint"
------------------------------
Date: Mon, 31 May 1999 22:40:53 -0600
From: Phil McRevis <legalize@xmission.com>
Subject: Re: (fractint) Fractal source code.
In article <19990601041143.18014.qmail@www0t.netaddress.usa.net>,
Paul Derbyshire <pderbysh@usa.net> writes:
> Attached below are two source files, which are fairly short.
Neither of which have anything to do with fractint. Paul, please make
sure your posts are relevant before you post...
- --
<http://www.xmission.com/~legalize/> Legalize Adulthood!
``Ain't it funny that they all fire the pistol,
at the wrong end of the race?''--PDBT
legalize@xmission.com <http://www.eden.com/~thewho>
- --------------------------------------------------------------
Thanks for using Fractint, The Fractals and Fractint Discussion List
Post Message: fractint@lists.xmission.com
Get Commands: majordomo@lists.xmission.com "help"
Administrator: twegner@phoenix.net
Unsubscribe: majordomo@lists.xmission.com "unsubscribe fractint"
------------------------------
Date: Mon, 31 May 1999 22:33:38 -0700
From: Mark Christenson <mchris@hooked.net>
Subject: (fractint) new images
It's not much to brag about, but after five months of infractivity
I have finally added five new "gravibrot" images to my site,
including my second layered image. They can be found at
http://www.hooked.net/~mchris/merge.htm
More to come in the near future...
Aloha, Bud
- --------------------------------------------------------------
Thanks for using Fractint, The Fractals and Fractint Discussion List
Post Message: fractint@lists.xmission.com
Get Commands: majordomo@lists.xmission.com "help"
Administrator: twegner@phoenix.net
Unsubscribe: majordomo@lists.xmission.com "unsubscribe fractint"
------------------------------
Date: Tue, 1 Jun 1999 01:40:28 EDT
From: Damascena@aol.com
Subject: Re: (fractint) new images
In a message dated 5/31/99 11:35:30 PM Mountain Daylight Time,
mchris@hooked.net writes:
> five months of infractivity
What a perfect new word this is! Thank you for appropriate description of the
cliched "dry spell." I like the images too <G>
Dama
- --------------------------------------------------------------
Thanks for using Fractint, The Fractals and Fractint Discussion List
Post Message: fractint@lists.xmission.com
Get Commands: majordomo@lists.xmission.com "help"
Administrator: twegner@phoenix.net
Unsubscribe: majordomo@lists.xmission.com "unsubscribe fractint"
------------------------------
Date: 1 Jun 99 01:24:57 MDT
From: Paul Derbyshire <pderbysh@usa.net>
Subject: (fractint) Two fractal formats.
A simple, universal format for recording the details needed to color and
recolor an image, is as follows. All quantities are big-endian for consis=
tency
across platforms.
offset qty. type description
0x0000 1 ushort width
0x0002 1 ushort height
0x0004 1 ushort # of distinct regions/basins. Basins will=
be
numbered from 0 to this number minus one.
0x0006 width*height record
offset qty. type description
0x0000 1 ushort basin number
0x0002 1 double pixel value (a double can b=
e
used to hold integers with 56 bits precision)
A rendering program will have to scan over all of the data to discover ho=
w
many basins there are and for each, what the
minimum and maximum values for the value are. This can be done while load=
ing
in the data. This is to keep the file format
simple. The file format can be modified by augmenting it with a compressi=
on
scheme such as LZSS.
A slightly less simple format I have devised to record enough to allow th=
e
image to be resumed, zoomed, or the parameters
tweaked, or evolved, follows. It relies on the supposition of the develop=
ment
of an essential infrastructure.
The infrastructure would be a namespace system for the naming of formulas=
=2E I
propose the following: each person use some
easily-recognizable component of their name as their namespace name. They=
name
their formulas in this scheme with that as a
prefix. I'd use PGD for mine, so PGD::Nova is the full name for the Nova
formula. Names will apply to Julibrot objects or to
stand-alone Julia types.
The classics, e.g. Mandelbrot, Julia, etc. would be named as they are.
Some classic (escape-time, 2 dimensional) fractals and their proposed nam=
es.
Fractal Proposed name
z^2+c Mandelbrot
z^n+c (n integer) IntPMandelbrot
z^x+c (x real) RealPMandelbrot
z^w+c (w complex) CplxPMandelbrot (corresponds to fracti=
nt
type=3Dmanzpower, julzpower)
z^z+z^w+c ZZMandelbrot (type=3Dmanzzpwr, julz=
zpwr)
rx(1-x) LambdaMandelbrot (type=3Dlambda, mandel=
lambda)
c*f(z) CfnMandelbrot (type=3Dlambdafn, mand=
elfn)
Newton z^n-1 NewtonUnity (type=3Dnewton, newtba=
sin)
(Unity as it is roots =
of
unity and not general Newton)
(Not a julibrot.)
Newton z^w-1 (w complex) CplxNewton (type=3Dcomplexnewton)=
(Not a julibrot.)
Newton z^3 + (c-1) z - c NewtonCubic (Generic cubical equat=
ion
Newton)
Formulas will have parameter names associated with their parameters. The
name's meaning is determined by the formula in
context. The commonest names will be:
name type description
seed complex or hyper Julia c values. May also be a vector quantity =
for
some formulas.
init " " " Mandel z_0 values. A critical point or value, =
e.g.
0 for Mandelbrot, gives a true Mandelbrot
fractal. Any other value gives a perturbed
Mandelbrot.
exponent integer, real, complex, hyper depending on formula
Exponent in Newton and z^n+c types. Analogous =
for
others.
function The function in CfnMandelbrot and friends.
function1, function2 ... In multi-function relatives of lambdafn, lik=
e
Fractint's fn1*fn2+c.
For all of these, defaults are set by formula-specification.
Formulas will be assumed to have the attractors to check for specified in=
the
formula.
A word on attractors. For Julia types, attractors are sought out by
"discovery".
For Mandelbrot types, attractors are specified in the formula, either as =
fixed
quantities (e.g. infinity for Mandelbrot)
or as some function of the parameters (as with Nova). Two special attract=
or
types will be infinity or find_fixed_point.
The latter will collect all points that tend to settle to one finite valu=
e.
Functions will be specifiable in some complex, yet to be devised format. =
A
fractal formula specification consists of:
string 1 Formula name with qualification, e.g. PGD::Nova.
string 1 Comments. See below about format for a comment string.=
record any Parameter specifications.
type qty. description
string 1 name of parameter
string 1 type-id, 'integer', 'real', 'complex'
allowed, 'complex' can be supplanted
with hypercomplex with the hyper flag =
on.
uint 1 Number of dimensions for a vector valu=
e,
normally 1.
bool 1 Periodicity-checking applies to this
parameter? (Normally no except for the iteration
variable)
The first parameter specified is the iteration variabl=
e
(possibly a vector). Its name will often be 'init'
to match the above convention for the classic types.
delimiter
n-place-function 1 Specifies the new value of the first parameter in t=
erms
of all of the parameter values (incl. previous
value of first parameter). May be a vector-valued
function to match the first parameter's nature.
bool 1 Suppress Julibrot behavior and act pure Julia. (e.g.
NewtonUnity.)
This will usually specify a Julibrot object. A Julia set is taken by fixi=
ng
parameters in the image except to pixel-vary
init. A Mandelbrot set (or slice thereof) is taken by pixel-varying a sli=
ce of
the parameter space except for the fixing
of init at a critical point or critical value. A perturbed Mandelbrot set=
is
taken by doing the same except to fix init at a
point that isn't a critical point or critical value. An oblique slice is =
taken
by using some other more general manner of
slicing.
If there is one init parameter and one other, seed parameter, you have a =
4-D
Julibrot with planar M-sets and planar
Julia sets.
To specify the classic M-set Julibrot:
string Mandelbrot
string The original classic!
record string init
string complex
uint 1
bool true
record string seed
string complex
uint 1
bool false
delimiter
n-place-function (init |-> init*init+seed, specified somehow)
bool false
A convolution is a collection of n n-place functions, where n is the numb=
er of
parameter-space dimensions, often 4.
The dimension of a convolution should match the dimension of the fractal =
to
which it is applied, in the larger sense.
An escape shape is a function that returns a bool from a vector, dependin=
g on
the vector escaping a certain shape. The shape
should have a radius of around 1, it will be scaled automatically when us=
ed.
A plane through the origin in n dimensions is specified by n real
coefficients. These will be termed c_1, ..., c_n, and
the real basis components for the parameter space x_1, ..., z_n. Then the=
plane specified is that satisfying:
c_1*x_1 + c_2*x_2 + ... + c_n*x_n =3D 0.
Format: a ushort, the number of dimensions, then n reals.
How to specify an arbitrary n-valued function.
record any Parameters
string 1 name
string 1 type (bool, integer, real, complex,
function)
delimiter
record any Temporaries
string 1 name
string 1 type (bool, integer, real, complex)
delimiter
record any calculation steps
string 1 operation to perform: add, multiply, squ=
are,
recip, <=3D, >=3D, invoke parametrized function,
etc. Two special ops: 1. Set a label. 2.=
Branch to a label if param 1 is true.
string 1 dest-param [If operation to perform is a=
n
assignment and not a conditional]
bool 1 source-param-1 is a parameter.
string 1 source-param-1 [If source-param-1 is a
parameter]
some type 1 source-param-1 [If not, i.e. source-par=
am-2
is a constant]
string 1 source-param-2 [Only if operation is bi=
nary
and not unary and it's a parameter here.]
some type 1 source-param-1 [Only if operation is bi=
nary
and not unary and it's a constant here.]
string 1 param-name of function to invoke [only i=
f
that is the operation to perform]
string 1 label-name if we are declaring a label o=
r
conditionally branching to one. =
delimiter
string 1 name of temporary to return.
ulong 1 Maximum number of steps before aborting. Ensures the fun=
ction
cannot hang.
return type 1 Value to return on abort.
When these are compiled:
* Type mismatches between number and function values will cause an error.=
* Conversions will be implicitly inserted among the non-function types.
Anything to bool: 0 =3D false, anything else =3D true.
Bool to anything: false =3D 0, true =3D 1.
Integer to real to complex: As expected, value unchanged.
Complex to real: Chop all but real component.
Real to integer: Round to nearest, round 0.5 up.
* Integer operations and such may be optimized, e.g. z^3 should be as fas=
t as
possible if the parameter 3 is an integer type,
and in particular will then be faster than if the 3 was in a complex
parameter type.
* Operations using constants should be faster by taking advantage of the =
exact
value of the constant if it is a small integer.
I.e. z^2 with the 2 constant can be translated into the fast cplx sqyar=
ing
procedure.
* Function parameters must be either unary or binary functions. Ident, ze=
ro,
one, recip, sqr, add, multiply, etc.
* The defined function's return type is that of the parameter named near =
the
end as the return. It is returned at successful
exit of the loop.
* The parameter of a branch is implicitly converted to a boool of course.=
* Some fast operations for integers: increment, decrement, ...
* Manner of compilation is application-dependent. Compilation to a linked=
list
of function pointers or to byte codes is
platform-independent. JIT compilation to native machine instructions is=
also
an option for ultrafast operation on specific
targets.
With that taken care of, some fractal parameters that are universal regar=
dless
of formula:
center complex or hyper Center of image Default: Depends on
formula.
mag real Magnification: 1 will mean the image ha=
s a
longer dimension of 1 in the fractal space.
10 will mean the larger dimension is 0.=
1,
and so forth by reciprocals.
Default: depends on formula.
rotation real In degrees: image rotation (clockwise).=
Default: 0.
skew real Skew. Default: 0.
maxiter ulong Maximum number of iterations to try.
Default: 2048.
hyper-flag bool Hypercomplex or not. Affects the nature=
of
center. Default: false.
quat-flag bool Quaternion flag. Mutually exclusive wit=
h
hyper-flag and with formulas using trig/exp on a
complex parameter.
Either of these doubles all parameter s=
pace
dimensions.
outer_radius real Radius (not squared) for checking escap=
e to
infinity if there is an attractor there.
Default: depends on formula.
inner_radius real Target radius around all finite attract=
ors.
Default: depends on formula.
outer_shape string Formula name for an escape-shape formul=
a.
Builtins such as "circle", "square", "astroid",
"ribbon", ...
Default: circle.
inner_shape string Same. Determines the shapes of target a=
reas
around finite attractors or fixed-point-trap.
Default: circle.
outer_shape_parms various Depends on shape. Might be aspect ratio=
of
an ellipse, etc.
Defaults: depend on shapes.
inner_shape_parms various Depends on shape. Might be aspect ratio=
of
an ellipse, etc.
Defaults: depend on shapes.
Whatever varies by pixel, if the parameter in question is assigned-to in =
the
parameter list, this assignment is ignored
(the pixel overrides) and a warning generated.
Now, the fractal description would be as follows. Here, as variable-lengt=
h
strings are used there will be no offsets
specified. Type 'string' means ASCII, null-terminated. A formula name or
parameter name is as above. =
parameter-block-marker
type qty. description
string 1 Description and comments, including linefeeds for line
breaks, null terminated as always. Default: A null
by itself (empty string) or perhaps computer-generated,=
say,
date and time written and CPU detected.
string 1 formula name Default: Mandelbrot.
string 1 convolution of coordinates -- a named convolution formu=
la =
Default: identity.
string any paramater-name =3D value. Values may be in high precisi=
on,
forcing supporting software to use
high precision if any value is (or if the mag is high
enough) and non-supporting software to complain or
generate fuzzy or imprecise images. Default: defaults.
Sets parameters for formula, convolution, escape traps,=
and
so forth.
delimiter =
The next stuff is in three optional, mutually-exclusive groups.
full-julibrot-flag Makes image an arbitrary Julibrot slice=
=2E
plane real coefficient list Default: plane is some interesting
opblique plane in parameter space.
Determines equation of plane through or=
igin.
Image slices hypercomplex and/or julibr=
ot
slices or many-dimensional
Julia sets. Image center is in full
parameter-space and slice plane is through this
parallel to plane whose equation is giv=
en.
OR
julia-flag Makes image a Julia set.
plane-flag True means a plane follows.
plane Slice for vector space of "init". Plane=
through origin as usual. Slice through parameter
space is parallel and through center.
Default is flat in first two real components in
vector.
OR
mandelbrot-flag Makes image an M-set.
string 1 Parameter-name: names parameter that va=
ries
by pixel and determines image center.
Center is a vector of that parameter.
plane-flag True means a plane follows.
plane Slice for parameter space. Plane throug=
h
origin as usual. Slice through parameter space is
parallel and through center. Default is=
flat
in first two real components in vector.
[Now the fractal is specified, independent of coloring schemes or display=
resolution. This can be used as a compact parameter file.]
algorithm-choice-block-marker
string 1 Algorithm type: 1pass, ..., npass (for reasonably large =
n),
tesseral, guessingn (n is number of passes, 1
is same as using 1pass), boundary, synchronous, diffusio=
n.
Default: guessing5.
real 1 Tolerance for determining how similar pixels are for pur=
poses
of tesseral and b-trace and s-guess. 0 means
must be identical. Default: 0.
periodicity real Periodicity checking sensitivity. Orbits that repe=
at to
within periodicity/mag are a cycle
detection. The factor of mag adjust the sensitivit=
y
automatically for deeper magnification.
Default: 1x10^-7, or is there a less conservative =
value
that gives good results? Better yet, depends
on formula.
[Now details of algorithm are specified.]
image-dimension-block-marker
ulong 1 width in pixels Default: 1024
ulong 1 height in pixels Default: 768
[Image is imagined to be a square of side 1/mag centered on center, then
truncated from top and bottom or from left and right
symmetrically to have the specified proportions.]
[Specifies everything needed to batch-generate the data now.]
basin-info-block-marker
ushort 1 # of basins
real 2*number of basins min and max for each basin
complex or whatever number of basins Attractors, if there is one =
at
infinity it is attractor zero and the
coordinates are ignored, if
fixed-point-trap is an attractor it is number 1 and
again the coordinates are
ignored.
[Specifies "discovered" properties of the fractal.]
pixel-data-block-marker
record width*height Generated image data
type qty. description
ushort 1 Basin number. Remember
maxiter/periodicity is the last and infinity, if present,
the zeroth.
ulong 1 Iterations. (Less than maxiter=
for
periodicity-caught pixels!)
ulong 1 Period. (In case periodicity
checking caught the pixel. 0 if not found periodic.)
real 1 Distance from origin or recip =
of
distance from finite attractor when caught in
a trap. (Recip of distance fro=
m
last point for fixed-point-trapping.)
real 1 Angle to attractor (to origin =
for
infinity, to previous point for
fixed-point-trapping).
real 1 Other data, special purpose, f=
ixed
by formula.
real 2 Coordinates of terminal value.=
ushort 1 Days
byte 1 Hours
byte 1 Minutes
byte 1 Seconds
real 1 Fraction of a second Calculation time
ulong 1 Pixels per second averaged
[Specifies whole fractal without a coloring.]
coloring-data-block-marker
record any Color-maps, applied sequentially to attractor basins.
type qty. description
record 1 or more Color-map.
type qty. description
real 1 Between 0 and 1
inclusive, specifies a value relative to the min-max
range of the value=
in
the basin.
byte 3 red, then green, t=
hen
blue, between 0 and 255 inclusive.
byte 1 0 =3D linear to ne=
xt
point 1 =3D quadratic 2 =3D cubic interpolation.
Default: Something serviceable. Greyscale perhaps.
7-place-function any Functions applied (one per basin) to transfo=
rm
the raw data into a value.
Default: iterations for all basins, except
maxiter/periodicity, where it is constant equal to 0.
1-place-function any Functions applied (one per basin) to transfo=
rm
the output one step further, e.g. for a logmap.
The min and max of the final value
Default: the identity, i.e. the output equal=
s the
input.
[Here, the color map indexes between 0 and 1 must be nondecreasing. Succe=
ssive
identical values are allowed to control
splines which use neighbor points for interpolation. Quadratic uses prev=
ious,
current, and next to determine current to next, and
cubic uses previous and next-after-next for control points.]
[The attracting basins are numbered from 0 up as follows: any
formula-specified attractors in given order, then for Julias any
discovered attractors in order of encountering their basins left to righ=
t,
top to bottom. Lastly the color for max-iter.
Minima and maxima are determined from the raw data. So the scheme is
well-defined.]
[The foregoing specifies a fractal without regard to resolution or genera=
ting
algorithm.]
This should be a reasonable first draft of a universal fractal data forma=
t,
which can have various levels of detail.
One should augment it by using LZSS compression at least when storing a w=
hole
fractal's data. Each of the sections (fractal params,
algorithm specification, color specification, raw data, etc.) should be
optional and delimited. An omitted section (except the raw
data and the "discovered" basin data) is regarded as all values their def=
aults
(as specified by the formula if necessary --
maybe the formula default, Mandelbrot). An omitted parameter is assumed
default. A named parameter not a standard name or
specified in a formula (escape radius, convolution, fractal iteration etc=
=2E)
causes a warning message.
As for computed data, if not specified it is computed.
The information stored per pixel is enough to use the saved data to quick=
ly
render using any of the following methods:
Solid color in a basin
Iterations
Atan or decomp (using the angle value)
Potential (using iterations and the distance; should work aro=
und
finite attractors using the provided recip-of-distance!)
Real, imag, summ, etc. (using the coordinates z_final)
Period (using period value)
Distance estimator (using the 'special' field and a special formul=
a to
put the 'distance' information in that field)
And so forth...
=
=
____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=3D=
1
- --------------------------------------------------------------
Thanks for using Fractint, The Fractals and Fractint Discussion List
Post Message: fractint@lists.xmission.com
Get Commands: majordomo@lists.xmission.com "help"
Administrator: twegner@phoenix.net
Unsubscribe: majordomo@lists.xmission.com "unsubscribe fractint"
------------------------------
End of fractint-digest V1 #395
******************************