Category : Printer + Display Graphics
Archive   : BMRPH102.ZIP
Filename : BIOMORPH.CPP

 
Output of file : BIOMORPH.CPP contained in archive : BMRPH102.ZIP
// Program: Biomorph (Generate non-standard fractals)
// Version: 1.02 14-Nov-1989
//
// Language: C++ 2.0
// Environ: Any
// Compilers: Zortech C++ 2.01
//
// Purpose: Generates fractals based on complex number formula iterations
//
// Written by: Scott Robert Ladd
// 705 West Virginia
// Gunnison CO 81230
//
// BBS (303)641-6438
// FidoNet 1:104/708

#include "conio.h"
#include "zg_lwlvl.h"

#include "Complex.hpp"

Complex C, Z, Power;

double Range, Xinc, Yinc, Xmax, Ymax, Xorig, Yorig;

int X, Y, I, Iterations, Species;

void GetParams();
int main();

void GetParams()
{
cout << "Biomorph 1.02 -- a complex-plane fractal generator\n";
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";

cout << "This program generates these species of biomorphs...\n";
cout << " Species 0: Z^X + C Species 1: sin(Z) + exp(Z) + C\n";
cout << " Species 2: Z^Z + Z^X + C Species 3: sin(Z) + Z^X + C\n\n";

do {
cout << "What species of biomorph do you want (0..3)? ";
cin >> Species;
}
while ((Species < 0) || (Species > 3));

cout << "\nNow we need one or two complex numbers. These can be entered\n";
cout << "in the following formats (where 'f' indicates a floating-point\n";
cout << "value:\n";
cout << " f -or- (f) (just a real number)\n";
cout << " (f,f) (entering both the real and imaginary parts)\n\n";

if (Species != 1)
{
cout << "Enter the complex power applied to Z: ";
cin >> Power;
}

cout << "Enter the complex constant C: ";
cin >> C;

cout << "\nThe next two numbers are floating point values representing the\n";
cout << "origin point on the complex plane of the area being viewed.\n\n";

cout << "Enter the X location of the center of the picture: ";
cin >> Xorig;

cout << "Enter the Y location of the center of the picture: ";
cin >> Yorig;

cout << "\nThe next number represents the distance the graph extends away\n";
cout << "from the above origin.\n\n";

cout << "Enter the range of the graph: ";
cin >> Range;

cout << "\nFinally, how many iterations should the program perform? ";
cin >> Iterations;
}

int main()
{
GetParams();

if (ZG_Init()) return 1;

if (ZG_SetMode(ZG_MOD_BESTRES)) return 2;

Ymax = ZG_VideoInfo.Ylength;
Xmax = Ymax / ((4/3) * Ymax / ZG_VideoInfo.Xwidth);

Xinc = 2.0 * Range / Xmax;
Yinc = 2.0 * Range / Ymax;

Range = -Range;

for (X = 0; X < Xmax; ++X)
{
for (Y = 0; Y < Ymax; ++Y)
{
Z = Complex((Range + Xinc * X + Xorig),(Range + Yinc * Y + Yorig));

for (I = 0; I < Iterations; ++I)
{
switch (Species)
{
case 0 :
Z = pow(Z,Power) + C;
break;
case 1:
Z = sin(Z) + exp(Z) + C;
break;
case 2:
Z = pow(Z,Z) + pow(Z,Power) + C;
break;
case 3:
Z = sin(Z) + pow(Z,Power) + C;
break;
}

if ((abs(real(Z)) >= 10.0) || (abs(imag(Z)) >= 10.0)
|| (norm(Z) >= 100.0))
break;
}

if ((abs(real(Z)) < 10.0) || (abs(imag(Z)) < 10.0))
ZG_PlotPixel(X,Y,0);
else
ZG_PlotPixel(X,Y,ZG_VideoInfo.NoColors - 1);

if (kbhit()) break;
}

if (kbhit()) break;
}

while (!kbhit()) ;

if (!getch()) getch();

ZG_Done();

return 0;
}


  3 Responses to “Category : Printer + Display Graphics
Archive   : BMRPH102.ZIP
Filename : BIOMORPH.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/