Browse Source

some stuff

master
Joshua 15 years ago
parent
commit
f77daec80f
  1. 3
      AwesomeAttractor.cbp
  2. 8
      Canvas.cpp
  3. 4
      attractors/testLorenz.stf
  4. 61
      attractors/testPolynomial.stf
  5. 8
      main.cpp

3
AwesomeAttractor.cbp

@ -44,6 +44,9 @@
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>
<Unit filename="attractors/testAttractor.stf" /> <Unit filename="attractors/testAttractor.stf" />
<Unit filename="attractors/testLorenz.stf" />
<Unit filename="attractors/testPolynomial.stf" />
<Unit filename="attractors/testUnravel.stf" />
<Unit filename="kernels/Logistic.cpp" /> <Unit filename="kernels/Logistic.cpp" />
<Unit filename="kernels/Logistic.hpp" /> <Unit filename="kernels/Logistic.hpp" />
<Unit filename="kernels/Lorenz3D.cpp" /> <Unit filename="kernels/Lorenz3D.cpp" />

8
Canvas.cpp

@ -118,7 +118,7 @@ void Canvas::output_file(const char * filename){
if ( max_int[i] < int_array[j+i*width*height] ) { if ( max_int[i] < int_array[j+i*width*height] ) {
max_int[i] = int_array[j+i*width*height]; max_int[i] = int_array[j+i*width*height];
} }
if ( int_array[j+i*width*height] ) { if ( int_array[j+i*width*height] > 5 ) {
cumulative += int_array[j+i*width*height]; cumulative += int_array[j+i*width*height];
n++; n++;
} }
@ -138,14 +138,14 @@ void Canvas::output_file(const char * filename){
} }
} }
const double vibrancy = v; const double vibrancy = 2.0;
double averagePower = 0; double averagePower = 0;
for ( unsigned int i = 0; i < num_colors; i++ ) { for ( unsigned int i = 0; i < num_colors; i++ ) {
averagePower += power[i]; averagePower += power[i];
} }
averagePower /= num_colors; averagePower /= (double)num_colors;
for ( unsigned int i = 0; i < num_colors; i++ ) { for ( unsigned int i = 0; i < num_colors; i++ ) {
power[i] = vibrancy*power[i] + (1.0 - vibrancy*averagePower); power[i] = vibrancy*power[i] + (1.0 - vibrancy)*averagePower;
} }
pngwriter * pngFile = new pngwriter(width, height, 0.0, filename); pngwriter * pngFile = new pngwriter(width, height, 0.0, filename);

4
attractors/testLorenz.stf

@ -12,8 +12,8 @@ attractor: {
parameters: the variables of the attractortype parameters: the variables of the attractortype
{ {
:"0.001" :"0.01"
:"4.2" :"4.002"
:"28" :"28"
:"0.3" :"0.3"
} }

61
attractors/testPolynomial.stf

@ -13,37 +13,36 @@ attractor: {
parameters: the variables of the attractortype parameters: the variables of the attractortype
{ {
:"0.148" :"0.862"
:"0" :"-1.147"
:"0" :"0.01"
:"0" :"0.241"
:"0" :"-0.85"
:"-0.001" :"-0.174"
:"0.119" :"1.193"
:"0.424" :"-0.572"
:"1.100" :"0.772"
:"0" :"0.147"
:"0.125" :"-0.049"
:"0.199" :"0.427"
:"0" :"-0.103"
:"0" :"-0.402"
:"0" :"1.13"
:"0" :"0.859"
:"-0.643" :"-0.642"
:"0" :"-0.649"
:"0" :"-1.074"
:"0" :"-0.636"
:"-1.1201" :"-0.706"
:"-1.1881" :"0.315"
:"0" :"-0.125"
:"0" :"1.193"
:"0.001" :"0.533"
:"-0.8639" :"-0.091"
:"-0.001" :"0.778"
:"0.001" :"-1.199"
:"0" :"-0.112"
:"0" :"0.025"
:"0"
} }
} }

8
main.cpp

@ -11,7 +11,7 @@ int main(int argc, char *argv[]) {
double totalTime, totalIterations; double totalTime, totalIterations;
// initialising stuff // initialising stuff
Attractor myAttractor("attractors/testLorenz.stf"); Attractor myAttractor("attractors/testPolynomial.stf");
Projector projection; Projector projection;
Canvas canvas(800, 800, 3); Canvas canvas(800, 800, 3);
@ -23,7 +23,7 @@ int main(int argc, char *argv[]) {
projection.output(); projection.output();
// iterating 4 evah // iterating 4 evah
unsigned int iterations = 200000; // twintig duizend unsigned int iterations = 2000; // tweeduizend
start = clock(); start = clock();
for ( unsigned int j = 1; j <= 100; j++ ) { for ( unsigned int j = 1; j <= 100; j++ ) {
for ( unsigned int i = 0; i <= iterations; i++ ) { for ( unsigned int i = 0; i <= iterations; i++ ) {
@ -39,7 +39,7 @@ int main(int argc, char *argv[]) {
totalIterations = 100.0*iterations; totalIterations = 100.0*iterations;
totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC)); totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC));
printf("\ntotal clock time: %f\n", totalTime ); printf("\ntotal clock time: %f\n", totalTime );
printf("average iterations per second: %f\n", totalIterations/((double)(end-start)/(double)(CLOCKS_PER_SEC)) ); printf("average iterations per second: %f\n\n", totalIterations/((double)(end-start)/(double)(CLOCKS_PER_SEC)) );
// saving output // saving output
start = clock(); start = clock();
@ -48,7 +48,7 @@ int main(int argc, char *argv[]) {
totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC)); totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC));
printf("\ntotal clock time for writing png: %f\n", totalTime ); printf("total clock time for writing png: %f\n", totalTime );
/*if ( argc <= 2 ) { /*if ( argc <= 2 ) {
cout << endl << "nothing to do..." << endl; cout << endl << "nothing to do..." << endl;