diff --git a/README b/README index 2a94a57..32da31f 100644 --- a/README +++ b/README @@ -31,22 +31,26 @@ You can then simply... $ src/mandelSSE -h - Usage: ./src/mandelSSE [-a] [-s|-x] [-h] [WIDTH HEIGHT] + Usage: ./src/mandelSSE [-a] [-s|-x] [-h] [-f rate] [WIDTH HEIGHT] Where: -h Show this help message - -a Run in autopilot mode (default: mouse mode) - -s Use SSE and OpenMP - -x Use XaoS algorithm (default) - If WIDTH and HEIGHT are not provided, they default to: 800 600 + -m Run in mouse-driven mode + -a Run in autopilot mode (default) + -x Use XaoS algorithm with SSE2 and OpenMP (default) + -s Use naive algorithm with SSE, SSE2 and OpenMP + -f fps Enforce upper bound of frames per second (default: 60) + (use 0 to run at full possible speed) - $ src/mandelSSE -a 1024 768 + If WIDTH and HEIGHT are not provided, they default to: 1024 768 + + $ src/mandelSSE (Runs in autopilot in 1024x768 window, using XaoS) - $ src/mandelSSE -s 1024 768 - (Runs in mouse-driven SSE mode, in a 1024x768 window) + $ src/mandelSSE -s -m 800 600 + (Runs in mouse-driven SSE mode, in a 800x600 window) (left-click zooms-in, right-click zooms out) - $ src/mandelSSE -x 1024 768 + $ src/mandelSSE -x -m 800 600 (same as before, but in XaoS mode - much faster, esp during deep zooms) WHAT IS THIS, AGAIN? diff --git a/README.md b/README.md index 2a94a57..32da31f 100644 --- a/README.md +++ b/README.md @@ -31,22 +31,26 @@ You can then simply... $ src/mandelSSE -h - Usage: ./src/mandelSSE [-a] [-s|-x] [-h] [WIDTH HEIGHT] + Usage: ./src/mandelSSE [-a] [-s|-x] [-h] [-f rate] [WIDTH HEIGHT] Where: -h Show this help message - -a Run in autopilot mode (default: mouse mode) - -s Use SSE and OpenMP - -x Use XaoS algorithm (default) - If WIDTH and HEIGHT are not provided, they default to: 800 600 + -m Run in mouse-driven mode + -a Run in autopilot mode (default) + -x Use XaoS algorithm with SSE2 and OpenMP (default) + -s Use naive algorithm with SSE, SSE2 and OpenMP + -f fps Enforce upper bound of frames per second (default: 60) + (use 0 to run at full possible speed) - $ src/mandelSSE -a 1024 768 + If WIDTH and HEIGHT are not provided, they default to: 1024 768 + + $ src/mandelSSE (Runs in autopilot in 1024x768 window, using XaoS) - $ src/mandelSSE -s 1024 768 - (Runs in mouse-driven SSE mode, in a 1024x768 window) + $ src/mandelSSE -s -m 800 600 + (Runs in mouse-driven SSE mode, in a 800x600 window) (left-click zooms-in, right-click zooms out) - $ src/mandelSSE -x 1024 768 + $ src/mandelSSE -x -m 800 600 (same as before, but in XaoS mode - much faster, esp during deep zooms) WHAT IS THIS, AGAIN? diff --git a/src/mandel.c b/src/mandel.c index 11564e9..c61ae1e 100644 --- a/src/mandel.c +++ b/src/mandel.c @@ -3,6 +3,8 @@ #include #include #include +#include + #include // With this macro defined... @@ -27,8 +29,8 @@ void usage(char *argv[]) printf("Usage: %s [-a] [-s|-x] [-h] [-f rate] [WIDTH HEIGHT]\n", argv[0]); puts("Where:"); puts("\t-h\tShow this help message"); - puts("\t-m\tRun in mouse-driven mode (default)"); - puts("\t-a\tRun in autopilot mode"); + puts("\t-m\tRun in mouse-driven mode"); + puts("\t-a\tRun in autopilot mode (default)"); puts("\t-x\tUse XaoS algorithm with SSE2 and OpenMP (default)"); puts("\t-s\tUse naive algorithm with SSE, SSE2 and OpenMP"); puts("\t-f fps\tEnforce upper bound of frames per second (default: 60)"); @@ -39,7 +41,7 @@ void usage(char *argv[]) int main(int argc, char *argv[]) { - int opt, bAutoPilot = 0, bSSE = 0, fps = 60; + int opt, bAutoPilot = 1, bSSE = 0, fps = 60; while ((opt = getopt(argc, argv, "hmaxsf:")) != -1) { switch (opt) { @@ -103,6 +105,8 @@ int main(int argc, char *argv[]) printf("\n[-] Mandelbrot Zoomer by Thanassis, version: %s\n", version); if (!bAutoPilot) puts("[-] NOTE: you can launch with option '-a' to enable autopilot."); + else + puts("[-] NOTE: you can launch with option '-m' to pilot with your mouse."); printf("[-]\n[-] Mode: %s\n", bSSE ? "naive SSE" : "XaoS"); printf("[-] Autopilot: %s\n", bAutoPilot ? "On" : "Off"); printf("[-] Dimensions: %ld x %ld\n", MAXX, MAXY); @@ -122,9 +126,10 @@ int main(int argc, char *argv[]) unsigned en, st = SDL_GetTicks(); unsigned frames; - if (bAutoPilot) + if (bAutoPilot) { + srand(time(NULL)); frames = autopilot(); - else + } else frames = mousedriven(); en = SDL_GetTicks(); diff --git a/src/xaos.c b/src/xaos.c index bddee13..fdb5aca 100644 --- a/src/xaos.c +++ b/src/xaos.c @@ -1,5 +1,5 @@ -#include // for fabs -#include // For DBL_MIN +#include +#include #include "common.h" #include "xaos.h" @@ -230,13 +230,22 @@ void mandel( int autopilot() { + static double interesting_points[][2] = { + {-0.72996052273553402312, -0.24047620199671820851}, + {-0.73162093699311890000, -0.25655927868100719680}, + {-1.03178026025649338671, -0.36035584735925418887}, + {-0.73174633145360257203, 0.21761907852168510535}, + {-1.25616009010536688884, 0.39944527454476780326}, + {-0.03804043691413014350, -0.98541408335385771711} + }; + const int total_interesting_points = + sizeof(interesting_points) / sizeof(interesting_points[0]); + int rand_idx = rand() % total_interesting_points; + double targetx = interesting_points[rand_idx][0]; + double targety = interesting_points[rand_idx][1]; int i = 0; int x,y; double xld = -2.2, yld=-1.1, xru=-2+(MAXX/MAXY)*3., yru=1.1; - const double - targetx = -0.72996052273553402312, targety = -0.24047620199671820851; - // targetx = -0.73162093699311890000, targety = -0.25655927868100719680; - // targetx = -1.03178026025649338671, targety = -0.36035584735925418887; while(i