aboutsummaryrefslogtreecommitdiff
path: root/algorithms
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2015-07-28 13:16:42 +1200
committerDavid Phillips <dbphillipsnz@gmail.com>2015-07-28 13:16:42 +1200
commit5de1d4d587ab2a655163f52d292a3eb982886331 (patch)
treedb97adf9d9ed8a7db1b0bb84d16ea733acb275a4 /algorithms
parent6287ffad1db78798eb67f0b73194ba465118bafd (diff)
downloadfractal-gen-5de1d4d587ab2a655163f52d292a3eb982886331.tar.xz
Fixing
Diffstat (limited to 'algorithms')
-rw-r--r--algorithms/burning-ship-lattice.c11
-rw-r--r--algorithms/burning-ship.c11
-rw-r--r--algorithms/mandelbrot.c11
-rw-r--r--algorithms/tricorn.c11
4 files changed, 20 insertions, 24 deletions
diff --git a/algorithms/burning-ship-lattice.c b/algorithms/burning-ship-lattice.c
index a219537..7c2d1e9 100644
--- a/algorithms/burning-ship-lattice.c
+++ b/algorithms/burning-ship-lattice.c
@@ -31,27 +31,26 @@ void *generate_burning_ship_lattice_section(void *section)
{
data_section *d = (data_section*)section;
unsigned int x,y,i;
- int idx = 0;
double a,b;
double complex z,c;
double size_units = 0.09f;
double top = -0.082f;
double left = -1.8f;
- for (y = d->core, b = (d->core*(size_units/d->size)+top); y < d->size; b+=((d->cores*size_units)/d->size), y+=d->cores)
+ for (y = d->core, b = (d->core*(size_units/size)+top); y < size; b+=((cores*size_units)/size), y+=cores)
{
- for (x = 0, a = left; x < d->size; a+=(size_units/d->size), x++)
+ for (x = 0, a = left; x < size; a+=(size_units/size), x++)
{
z = 0;
c = a+I*b;
- for (i = 0; i < d->iterat; i++)
+ for (i = 0; i < iterat; i++)
{
if (cabsf(z) >= 2)
break;
- z = cpow( cabsf(crealf(z)) + I*cabsf(cimagf(z)) , d->power) + c;
+ z = cpow( cabsf(crealf(z)) + I*cabsf(cimagf(z)) , power) + c;
}
- d->data[idx++] = (255*i)/d->iterat;
+ d->data[d->idx++] = (255*i)/iterat;
}
}
return NULL;
diff --git a/algorithms/burning-ship.c b/algorithms/burning-ship.c
index 35d1839..8a5d1a1 100644
--- a/algorithms/burning-ship.c
+++ b/algorithms/burning-ship.c
@@ -31,27 +31,26 @@ void *generate_burning_ship_section(void *section)
{
data_section *d = (data_section*)section;
unsigned int x,y,i;
- int idx = 0;
double a,b;
double complex z,c;
double size_units = 3.5f;
double top = -2.2f;
double left = -2.2f;
- for (y = d->core, b = (d->core*(size_units/d->size)+top); y < d->size; b+=((d->cores*size_units)/d->size), y+=d->cores)
+ for (y = d->core, b = (d->core*(size_units/size)+top); y < size; b+=((cores*size_units)/size), y+=cores)
{
- for (x = 0, a = left; x < d->size; a+=(size_units/d->size), x++)
+ for (x = 0, a = left; x < size; a+=(size_units/size), x++)
{
z = 0;
c = a+I*b;
- for (i = 0; i < d->iterat; i++)
+ for (i = 0; i < iterat; i++)
{
if (cabsf(z) >= 2)
break;
- z = cpow( cabsf(crealf(z)) + I*cabsf(cimagf(z)) , d->power) + c;
+ z = cpow( cabsf(crealf(z)) + I*cabsf(cimagf(z)) , power) + c;
}
- d->data[idx++] = (255*i)/d->iterat;
+ d->data[d->idx++] = (255*i)/iterat;
}
}
return NULL;
diff --git a/algorithms/mandelbrot.c b/algorithms/mandelbrot.c
index 1c3f5a2..28bb188 100644
--- a/algorithms/mandelbrot.c
+++ b/algorithms/mandelbrot.c
@@ -31,27 +31,26 @@ void *generate_mandelbrot_section(void *section)
{
data_section *d = (data_section*)section;
unsigned int x,y,i;
- int idx = 0;
double a,b;
double complex z,c;
double size_units = 3.5f;
double top = -1.75f;
double left = -2.5f;
- for (y = d->core, b = (d->core*(size_units/d->size)+top); y < d->size; b+=((d->cores*size_units)/d->size), y+=d->cores)
+ for (y = d->core, b = (d->core*(size_units/size)+top); y < size; b+=((cores*size_units)/size), y+=cores)
{
- for (x = d->clust_id, a = (d->clust_id*(size_units/d->size)+left); x < d->size; a+=((d->clust_total*size_units)/d->size), x+=d->clust_total)
+ for (x = clust_id, a = (clust_id*(size_units/size)+left); x < size; a+=((clust_total*size_units)/size), x+=clust_total)
{
z = 0;
c = a+I*b;
- for (i = 0; i < d->iterat; i++)
+ for (i = 0; i < iterat; i++)
{
if (cabsf(z) >= 2)
break;
- z = cpow(z , d->power) + c;
+ z = cpow(z , power) + c;
}
- d->data[idx++] = (255*i)/d->iterat;
+ d->data[d->idx++] = (255*i)/iterat;
}
}
return NULL;
diff --git a/algorithms/tricorn.c b/algorithms/tricorn.c
index 16c399e..c89420a 100644
--- a/algorithms/tricorn.c
+++ b/algorithms/tricorn.c
@@ -31,27 +31,26 @@ void *generate_tricorn_section(void *section)
{
data_section *d = (data_section*)section;
unsigned int x,y,i;
- int idx = 0;
double a,b;
double complex z,c;
double size_units = 4.f;
double top = -2.f;
double left = -2.3f;
- for (y = d->core, b = (d->core*(size_units/d->size)+top); y < d->size; b+=((d->cores*size_units)/d->size), y+=d->cores)
+ for (y = d->core, b = (d->core*(size_units/size)+top); y < size; b+=((cores*size_units)/size), y+=cores)
{
- for (x = 0, a = left; x < d->size; a+=(size_units/d->size), x++)
+ for (x = 0, a = left; x < size; a+=(size_units/size), x++)
{
z = 0;
c = a+I*b;
- for (i = 0; i < d->iterat; i++)
+ for (i = 0; i < iterat; i++)
{
if (cabsf(z) >= 2)
break;
- z = cpow(conj(z) , d->power) + c;
+ z = cpow(conj(z) , power) + c;
}
- d->data[idx++] = (255*i)/d->iterat;
+ d->data[d->idx++] = (255*i)/iterat;
}
}
return NULL;