|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#include "Attractor.hpp"
|
|
|
|
#include "Canvas.hpp"
|
|
|
|
#include "Projector.hpp"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
|
|
|
|
Attractor myAttractor("attractors/testAttractor.stf");
|
|
|
|
|
|
|
|
Projector projection;
|
|
|
|
Canvas canvas(6400, 6400, 3);
|
|
|
|
projection.canvas = &canvas;
|
|
|
|
|
|
|
|
myAttractor.projectors.push_back(&projection);
|
|
|
|
myAttractor.init_range();
|
|
|
|
|
|
|
|
projection.output();
|
|
|
|
|
|
|
|
unsigned int iterations = 2000000000; // twee miljard
|
|
|
|
for ( unsigned int j = 1; j <= 100; j++ ) {
|
|
|
|
for ( unsigned int i = 0; i <= iterations; i++ ) {
|
|
|
|
myAttractor.iterate();
|
|
|
|
myAttractor.plot();
|
|
|
|
}
|
|
|
|
system("clear");
|
|
|
|
myAttractor.output();
|
|
|
|
cout << j << "% done" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
canvas.output_file();
|
|
|
|
|
|
|
|
/*if ( argc <= 2 ) {
|
|
|
|
cout << endl << "nothing to do..." << endl;
|
|
|
|
cout << "usage:" << endl;
|
|
|
|
cout << " rendering to canvas: -a my_attractor.attr 500000000 my_attractor.canv 800 600 3" << endl;
|
|
|
|
cout << " canvas to png: -c my_attractor.canv 800 600 3 my_atttractor.png" << endl << endl;
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int mode;
|
|
|
|
string argv1 = argv[1];
|
|
|
|
if ( argv1 == "-a" ) {
|
|
|
|
cout << "rendermode" << endl;
|
|
|
|
mode = 1;
|
|
|
|
} else if ( argv1 == "-c" ) {
|
|
|
|
cout << "canvasmode" << endl;
|
|
|
|
mode = 2;
|
|
|
|
} else {
|
|
|
|
cout << "i do.. i do... i do not understand... \"" << argv1 << "\""<< endl;
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ( mode ) {
|
|
|
|
case 1: {
|
|
|
|
if ( argc != 8 ) {
|
|
|
|
cout << "all parameters must be set..." << endl;
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
string attractorFile = argv[2];
|
|
|
|
unsigned int iterations = atoi(argv[3]);
|
|
|
|
string canvasFile = argv[4];
|
|
|
|
unsigned int width = atoi(argv[5]);
|
|
|
|
unsigned int height = atoi(argv[6]);
|
|
|
|
unsigned int numColors = atoi(argv[7]);
|
|
|
|
|
|
|
|
Attractor attract(attractorFile.c_str());
|
|
|
|
cout << attractorFile << " is read" << endl;
|
|
|
|
|
|
|
|
Projector projection;
|
|
|
|
Canvas canvas(width, height, numColors);
|
|
|
|
projection.canvas = &canvas;
|
|
|
|
|
|
|
|
attract.projectors.push_back(&projection);
|
|
|
|
attract.init_range();
|
|
|
|
|
|
|
|
projection.output();
|
|
|
|
|
|
|
|
for ( unsigned int j = 1; j <= 100; j++ ) {
|
|
|
|
for ( unsigned int i = 0; 100*i <= iterations; i++ ) {
|
|
|
|
attract.iterate();
|
|
|
|
attract.plot();
|
|
|
|
}
|
|
|
|
cout << j << "% done" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
canvas.output_raw(canvasFile.c_str());
|
|
|
|
cout << canvasFile << " is outputted" << endl;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2: {
|
|
|
|
if ( argc != 7 ) {
|
|
|
|
cout << "all parameters must be set..." << endl;
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
string canvasFile = argv[2];
|
|
|
|
unsigned int width = atoi(argv[3]);
|
|
|
|
unsigned int height = atoi(argv[4]);
|
|
|
|
unsigned int numColors = atoi(argv[5]);
|
|
|
|
string pngFile = argv[6];
|
|
|
|
|
|
|
|
Canvas canvas(width, height, numColors);
|
|
|
|
canvas.input_raw(canvasFile.c_str());
|
|
|
|
cout << canvasFile << " is read" << endl;
|
|
|
|
for ( double v = -1.5; v < 1.6; v += 1.5 ) {
|
|
|
|
canvas.v = v;
|
|
|
|
canvas.output_file();
|
|
|
|
}
|
|
|
|
cout << pngFile << " was exported" << endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default: {
|
|
|
|
cout << "WTF" << endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|