summaryrefslogtreecommitdiff
path: root/board.h
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-25 19:53:22 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-25 19:53:22 -0700
commit2652dec6b38f04f96a9832622418d01805bb7d4a (patch)
treedd387f144f17c0a509867fd28cce8fe421973674 /board.h
parent0517dcffe7ac66b604143d9457ba6591d34ae07e (diff)
downloaddartboat-2652dec6b38f04f96a9832622418d01805bb7d4a.tar.gz
dartboat-2652dec6b38f04f96a9832622418d01805bb7d4a.tar.xz
minor cleanup and organisation of lib code
Diffstat (limited to 'board.h')
-rw-r--r--board.h21
1 files changed, 11 insertions, 10 deletions
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