aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rw-r--r--Test - Benchmark/Mandelbrot.c31
-rw-r--r--src/render.c3
3 files changed, 28 insertions, 13 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3ab2a6c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# Mandelbrot Render - ProzProg Projekt
+
+Ideen:
+
+ - Mandelbrot ist symetrisch zur x-Achse
+ - Color Smoothing
+ \ No newline at end of file
diff --git a/Test - Benchmark/Mandelbrot.c b/Test - Benchmark/Mandelbrot.c
index d06d154..cffa090 100644
--- a/Test - Benchmark/Mandelbrot.c
+++ b/Test - Benchmark/Mandelbrot.c
@@ -8,11 +8,11 @@
#define x_MIN -2.0
#define x_MAX 1.0
-#define y_MIN -1.0
+#define y_MIN 0
#define y_MAX 1.0
-#define BMP_HEIGHT 800
-#define BMP_WIDTH 1000
+#define BMP_HEIGHT 1080
+#define BMP_WIDTH 1920
#define N_MAX 250
@@ -30,7 +30,7 @@ void toMath(int X, int Y, double* x, double* y) {
int mandelbrot(double x, double y, double zx, double zy, int n, int n_max,
double threshold) {
- if ((n <= n_max) && ((zx * zx + zy * zy) < threshold)) {
+ if ((n < n_max) && ((zx * zx + zy * zy) < threshold)) {
double zx_new = (zx * zx - zy * zy + x);
double zy_new = (2 * zx * zy + y);
if ((zx_new == zx) && (zy_new == zy)) {
@@ -64,8 +64,8 @@ int main(){
}
}
end = clock();
- // printf("Rekursion Ende");
- // getchar();
+ printf("Rekursion Ende\n");
+ //getchar();
// for(int i = 0; i < BMP_HEIGHT*BMP_WIDTH; i++){
// printf("%d\n",data[i]);
@@ -73,7 +73,6 @@ int main(){
begin2 = clock();
uint32_t* data2 = (uint32_t*) malloc(BMP_WIDTH * BMP_HEIGHT * sizeof(uint32_t));
- int m = 0;
for (int Y = 0; Y < BMP_HEIGHT; Y++) {
for (int X = 0; X < BMP_WIDTH; X++) {
@@ -81,20 +80,25 @@ int main(){
toMath(X, Y, &x, &y);
double cx = x;
double cy = y;
- while(m <=n_max && (x*x)+(y*y) <= 4){
+ int m = 0;
+ while(m <=n_max && (x*x)+(y*y) < 4){
x2 = x;
x = (x*x) - (y*y) + cx;
y = 2.0*x2*y + cy;
m++;
}
- data2[Y * BMP_WIDTH + X] = n;
+ data2[Y * BMP_WIDTH + X] = m;
}
}
end2 = clock();
+ printf("Schleife Ende\n");
- // for(int i = 0; i < BMP_HEIGHT*BMP_WIDTH; i++){
- // printf("%d\n",data2[i]);
+ // for(int i = 0; i < BMP_WIDTH * BMP_HEIGHT; i++){
+ // if(data[i] != data[2]){
+ // printf("Unterschied\n");
+ // }
// }
+
printf("Rekursion:\n");
@@ -114,6 +118,11 @@ int main(){
z/=CLOCKS_PER_SEC;
printf("Zeit zwischen begin und end: %f Sekunden\n", z);
printf("CLOCKS_PER_SEC: %d\n", CLOCKS_PER_SEC);
+
+ for(int i = 0; i < BMP_HEIGHT*BMP_WIDTH; i++){
+ printf("Schleife: %d -- Rekursion: %d\n",data2[i], data[i]);
+ getch();
+ }
diff --git a/src/render.c b/src/render.c
index 9e7f1a4..27573cf 100644
--- a/src/render.c
+++ b/src/render.c
@@ -7,6 +7,7 @@
#include "render.h"
#define HAVE_STRUCT_TIMESPEC
+#include <pthread.h>
void render_init(Config *config, u32 (*sfunc) (long double, long double, u32))
{
@@ -126,5 +127,3 @@ void gl_idle(void)
y_max = y_max_s - zoom_func(ft, (long double)1.0 - _config->to_y);
glutPostRedisplay();
}
-
-