From 2c79b15008ac079606b025aef715abb6b1f4dd7d Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 9 Mar 2020 00:28:41 +0000 Subject: [PATCH] Constants tweaking --- criticals.c | 6 ++++-- julia.c | 11 ++++++----- palette.c | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/criticals.c b/criticals.c index 86b509f..c1ad69f 100644 --- a/criticals.c +++ b/criticals.c @@ -17,8 +17,10 @@ #include "criticals.h" #include "util.h" +#define MAX_CRITICALS 100 + static size_t idx = 0; -static long double complex criticals[100]; +static long double complex criticals[MAX_CRITICALS]; int behaves_critical(long double complex (*df)(long double complex), @@ -43,7 +45,7 @@ add_critical_point(long double complex z) { size_t i; - if (idx >= nelems(criticals)) + if (idx >= MAX_CRITICALS) return; for (i = 0; i < idx; i++) if (cabsl(z - criticals[i]) < 1.0e-9) diff --git a/julia.c b/julia.c index 9981402..db9fdeb 100644 --- a/julia.c +++ b/julia.c @@ -31,6 +31,7 @@ #define RITNUM(c, i) (c[i].it - c[i].rit) #define OPTSTRING "a:b:c:D:d:h:Ll:N:n:w:x:y:z:" +#define RADIAN 3.14159265358979323846L struct color contour_color = { 0 }; static long double bailout = 1e100, @@ -133,7 +134,7 @@ julia_main(int argc, char *argv[]) zoom = 1.0, light, light_x, light_y, light_z, rit, rn, sec_h, zx, zy; long long it, idx, ritnum; - int palette_size = 720, + int palette_size = 1000, width = 640, height = 400, rescache_width, rescache_height, i, j; @@ -157,7 +158,7 @@ julia_main(int argc, char *argv[]) density = parse_double(optarg); break; case 'h': - height = parse_integer(optarg, 1, 65536); + height = parse_integer(optarg, 1, INT_MAX); break; case 'L': do_light = 1; @@ -172,7 +173,7 @@ julia_main(int argc, char *argv[]) niters = parse_integer(optarg, 1, LONG_MAX); break; case 'w': - width = parse_integer(optarg, 1, 65536); + width = parse_integer(optarg, 1, INT_MAX); break; case 'x': julia_x = parse_double(optarg); @@ -202,8 +203,8 @@ julia_main(int argc, char *argv[]) if (do_light) { long double angle_xy, angle_z; - angle_xy = drand48() * 2.0L * 3.14159265358979323846L; - angle_z = (0.2L + 0.6L * drand48()) * 3.14159265358979323846L; + angle_xy = drand48() * 2.0L * RADIAN; + angle_z = (0.2L + 0.6L * drand48()) * RADIAN; light_x = cosl(angle_xy) * sinl(angle_z); light_y = sinl(angle_xy) * sinl(angle_z); light_z = cosl(angle_z); diff --git a/palette.c b/palette.c index 03ab1b4..3c8af27 100644 --- a/palette.c +++ b/palette.c @@ -85,8 +85,8 @@ palette_main(int argc, char *argv[]) struct color *palette; int ch, i, j, width, height; - height = 100; - width = 720; + height = 50; + width = 500; while ((ch = getopt(argc, argv, "h:w:")) != -1) switch (ch) { case 'h':