From 2652dec6b38f04f96a9832622418d01805bb7d4a Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 25 May 2022 19:53:22 -0700 Subject: minor cleanup and organisation of lib code --- board.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'board.h') diff --git a/board.h b/board.h index 4348070..440143f 100644 --- a/board.h +++ b/board.h @@ -13,8 +13,8 @@ #define DOUBLE_INSIDE_WIDTH 8.0 #define TREBLE_INSIDE_WIDTH 8.0 -#define SEGMENT_MAX_LEN 5 - +#define NUM_SECTORS 20 +#define SECTOR_WIDTH (360.0 / NUM_SECTORS) #define FOREACH_SECTOR(M) \ M(1) M(2) M(3) M(4) M(5) M(6) M(7) M(8) M(9) M(10) \ M(11) M(12) M(13) M(14) M(15) M(16) M(17) M(18) M(19) M(20) @@ -36,6 +36,10 @@ #define GEN_RING_ENUM(X, D) R_ ## X, #define GEN_RING_STR(X, D) #X, #define GEN_RING_OUTER_DIST(X, D) D, + +extern int SECTORS[]; +extern double OUTER_DISTS[]; + enum ring { FOREACH_RING(GEN_RING_ENUM) R_OUT @@ -46,11 +50,6 @@ struct segment { int sector; }; -extern int SECTORS[]; -extern double OUTER_DISTS[]; - -void init_board(); - struct ccoords { double x, y; }; @@ -59,11 +58,13 @@ struct pcoords { double a, r; }; -struct segment get_segment(struct pcoords c); +void init_board(); + +struct segment segment_from_pcoords(struct pcoords c); +struct segment segment_from_name(const char *name); +struct pcoords segment_centre(struct segment seg); const char *segment_name(struct segment seg); int segment_points(struct segment seg); bool segment_is_double(struct segment seg); -struct pcoords segment_centre(struct segment seg); -struct segment segment_from_name(char *name); #endif -- cgit v1.2.3-70-g09d2