From 0a71b0a7b9cf5bf850aefecf95a06fbe6e2bcfd8 Mon Sep 17 00:00:00 2001 From: maartin0 <maartin00000@gmail.com> Date: Mon, 4 Nov 2024 22:48:28 +0000 Subject: [PATCH] reduce param requirements to speed up program --- spiro.c | 7 ++++--- spiro.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/spiro.c b/spiro.c index 5c587d8..92b9651 100644 --- a/spiro.c +++ b/spiro.c @@ -14,7 +14,7 @@ void plot(double R, double r, double O) int y = scale((R - r) * sin(t) - O * sin((R - r) / r * t)); if (x < 0 || x >= COLS || y < 0 || y >= LINES) continue; - mvaddch(y, x, '.'); + mvaddch(y, x, '+'); } } @@ -29,6 +29,8 @@ void clearscr() } } +char buf[50]; + int main(int argc, char *argv[]) { initscr(); @@ -38,9 +40,8 @@ int main(int argc, char *argv[]) { for (double r = 0; r <= 1; r += 0.1) { - for (double O = 0; O <= 1; O += 0.1) + for (double O = 0; O <= 1; O += 0.01) { - char buf[50]; plot(R, r, O); sprintf(buf, "R=%.2f r=%.2f O=%.2f", R, r, O); mvaddstr(0, COLS - strlen(buf), buf); diff --git a/spiro.h b/spiro.h index 2367052..a0fa5c0 100644 --- a/spiro.h +++ b/spiro.h @@ -9,6 +9,6 @@ #include <math.h> // number of pixels in the range t=(0, PI) -#define RESOLUTION 1000 +#define RESOLUTION 100 // defines the maximum value of t = T_MAX*PI -#define T_MAX 1000 \ No newline at end of file +#define T_MAX 200 \ No newline at end of file -- GitLab