diff --git a/attractors/testAttractor.stf b/attractors/testAttractor.stf index 0ab5b98..45a7d21 100644 --- a/attractors/testAttractor.stf +++ b/attractors/testAttractor.stf @@ -4,21 +4,46 @@ output: "png" attractor: { type: lorenz/unravel/polynomial/polynomial a/logistic - => "unravel" + => "polynomial" dimensions: most types only support 3D => "3" + orde: "2" iterations: "1000000" parameters: the variables of the attractortype { - :"-0.78" - :"2.042" - :"1.22" - :"-1.267" - :"1.37" - :"2.3" - :"-2.195" + :"0.148" + :"0" + :"0" + :"0" + :"0" + :"0" + :"0.119" + :"0.424" + :"1.100" + :"0" + :"0.125" + :"0.199" + :"0" + :"0" + :"0" + :"0" + :"-0.643" + :"0" + :"0" + :"0" + :"-1.120" + :"-1.188" + :"0" + :"0" + :"0" + :"-0.864" + :"0" + :"0" + :"0" + :"0" + :"0" } } diff --git a/attractors/testLorenz.stf b/attractors/testLorenz.stf new file mode 100644 index 0000000..ef5e48c --- /dev/null +++ b/attractors/testLorenz.stf @@ -0,0 +1,77 @@ + +input: "attractor" +output: "png" + +attractor: { + type: lorenz/unravel/polynomial/polynomial a/logistic + => "Lorenz" + dimensions: most types only support 3D + => "3" + + iterations: "1000000" + + parameters: the variables of the attractortype + { + :"0.001" + :"4.2" + :"28" + :"0.3" + } +} + +projector: { + type: auto center/lineair map/spherical/color projector + => "lineair map" + + domain: input of the projector, normally the attractor, but can also be a projector + => "attractor" + domainDimension: redundant, because it knows from domain + => "3" + + codomain: output of the Projector, normally a canvas, but can also be another projector + => "canvas" + codomainDimensions: redundant, because it knows from codomain + => "2" + + matrix: describing the lineair map + { + :{ :"1" :"0" :"0" } + :{ :"0" :"1" :"0" } + } +} + +canvas: { + type: 2D image/2D slices/3D volume/2D animation + => "2D image" + output: canvas/png/jpg/zip/mpg + => "png" + + width: "6400" + height: "6400" + colors: "3" + + imageConversion: description how to show the abstract canvas classe + { + colorMatrix: desciribing lineair map from canvas colors to RGB colorspace + { + :{ :"1" :"0" :"0" } + :{ :"0" :"1" :"0" } + :{ :"0" :"0" :"1" } + } + + vibrancy: "0" + gamma: "-2.5" + brightness: "3" + } + + pngFile: png options + { + fileName: leave empty to autogenerate filename + => "" + + compression: "9" + author: "Joshua Moerman" + title: "Unravel" + description: "A unravel-type attractor made with AwesomeAttractor" + } +} diff --git a/attractors/testPolynomial.stf b/attractors/testPolynomial.stf new file mode 100644 index 0000000..93110b3 --- /dev/null +++ b/attractors/testPolynomial.stf @@ -0,0 +1,105 @@ + +input: "attractor" +output: "png" + +attractor: { + type: lorenz/unravel/polynomial/polynomial a/logistic + => "polynomial" + dimensions: most types only support 3D + => "3" + orde: "2" + + iterations: "1000000" + + parameters: the variables of the attractortype + { + :"0.148" + :"0" + :"0" + :"0" + :"0" + :"-0.001" + :"0.119" + :"0.424" + :"1.100" + :"0" + :"0.125" + :"0.199" + :"0" + :"0" + :"0" + :"0" + :"-0.643" + :"0" + :"0" + :"0" + :"-1.1201" + :"-1.1881" + :"0" + :"0" + :"0.001" + :"-0.8639" + :"-0.001" + :"0.001" + :"0" + :"0" + :"0" + } +} + +projector: { + type: auto center/lineair map/spherical/color projector + => "lineair map" + + domain: input of the projector, normally the attractor, but can also be a projector + => "attractor" + domainDimension: redundant, because it knows from domain + => "3" + + codomain: output of the Projector, normally a canvas, but can also be another projector + => "canvas" + codomainDimensions: redundant, because it knows from codomain + => "2" + + matrix: describing the lineair map + { + :{ :"1" :"0" :"0" } + :{ :"0" :"1" :"0" } + } +} + +canvas: { + type: 2D image/2D slices/3D volume/2D animation + => "2D image" + output: canvas/png/jpg/zip/mpg + => "png" + + width: "6400" + height: "6400" + colors: "3" + + imageConversion: description how to show the abstract canvas classe + { + colorMatrix: desciribing lineair map from canvas colors to RGB colorspace + { + :{ :"1" :"0" :"0" } + :{ :"0" :"1" :"0" } + :{ :"0" :"0" :"1" } + } + + vibrancy: "0" + gamma: "-2.5" + brightness: "3" + } + + pngFile: png options + { + fileName: leave empty to autogenerate filename + => "" + + compression: "9" + author: "Joshua Moerman" + title: "Unravel" + description: "A unravel-type attractor made with AwesomeAttractor" + } +} diff --git a/attractors/testUnravel.stf b/attractors/testUnravel.stf new file mode 100644 index 0000000..0ab5b98 --- /dev/null +++ b/attractors/testUnravel.stf @@ -0,0 +1,80 @@ + +input: "attractor" +output: "png" + +attractor: { + type: lorenz/unravel/polynomial/polynomial a/logistic + => "unravel" + dimensions: most types only support 3D + => "3" + + iterations: "1000000" + + parameters: the variables of the attractortype + { + :"-0.78" + :"2.042" + :"1.22" + :"-1.267" + :"1.37" + :"2.3" + :"-2.195" + } +} + +projector: { + type: auto center/lineair map/spherical/color projector + => "lineair map" + + domain: input of the projector, normally the attractor, but can also be a projector + => "attractor" + domainDimension: redundant, because it knows from domain + => "3" + + codomain: output of the Projector, normally a canvas, but can also be another projector + => "canvas" + codomainDimensions: redundant, because it knows from codomain + => "2" + + matrix: describing the lineair map + { + :{ :"1" :"0" :"0" } + :{ :"0" :"1" :"0" } + } +} + +canvas: { + type: 2D image/2D slices/3D volume/2D animation + => "2D image" + output: canvas/png/jpg/zip/mpg + => "png" + + width: "6400" + height: "6400" + colors: "3" + + imageConversion: description how to show the abstract canvas classe + { + colorMatrix: desciribing lineair map from canvas colors to RGB colorspace + { + :{ :"1" :"0" :"0" } + :{ :"0" :"1" :"0" } + :{ :"0" :"0" :"1" } + } + + vibrancy: "0" + gamma: "-2.5" + brightness: "3" + } + + pngFile: png options + { + fileName: leave empty to autogenerate filename + => "" + + compression: "9" + author: "Joshua Moerman" + title: "Unravel" + description: "A unravel-type attractor made with AwesomeAttractor" + } +} diff --git a/main.cpp b/main.cpp index f8d901b..7e29f9b 100644 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,5 @@ #include +#include using namespace std; #include "Attractor.hpp" @@ -6,11 +7,14 @@ using namespace std; #include "Projector.hpp" int main(int argc, char *argv[]) { + clock_t start, end; + double totalTime, totalIterations; - Attractor myAttractor("attractors/testAttractor.stf"); + // initialising stuff + Attractor myAttractor("attractors/testLorenz.stf"); Projector projection; - Canvas canvas(6400, 6400, 3); + Canvas canvas(800, 800, 3); projection.canvas = &canvas; myAttractor.projectors.push_back(&projection); @@ -18,7 +22,9 @@ int main(int argc, char *argv[]) { projection.output(); - unsigned int iterations = 2000000000; // twee miljard + // iterating 4 evah + unsigned int iterations = 200000; // twintig duizend + start = clock(); for ( unsigned int j = 1; j <= 100; j++ ) { for ( unsigned int i = 0; i <= iterations; i++ ) { myAttractor.iterate(); @@ -28,8 +34,21 @@ int main(int argc, char *argv[]) { myAttractor.output(); cout << j << "% done" << endl; } + end = clock(); + totalIterations = 100.0*iterations; + totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC)); + printf("\ntotal clock time: %f\n", totalTime ); + printf("average iterations per second: %f\n", totalIterations/((double)(end-start)/(double)(CLOCKS_PER_SEC)) ); + + // saving output + start = clock(); canvas.output_file(); + end = clock(); + + totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC)); + + printf("\ntotal clock time for writing png: %f\n", totalTime ); /*if ( argc <= 2 ) { cout << endl << "nothing to do..." << endl;