summaryrefslogtreecommitdiff
path: root/misc.h
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-02 11:00:08 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-02 11:00:08 -0300
commit8745b40e3eb216fc5cfa7373fea3b4ae991f1c3e (patch)
treeeab2aa7ec1941bd3da99f1dbcf64eab04d34667a /misc.h
downloadeeshow-8745b40e3eb216fc5cfa7373fea3b4ae991f1c3e.tar.gz
eeshow-8745b40e3eb216fc5cfa7373fea3b4ae991f1c3e.tar.bz2
eeshow-8745b40e3eb216fc5cfa7373fea3b4ae991f1c3e.zip
rename sch2fig to eeshow
Diffstat (limited to 'misc.h')
-rw-r--r--misc.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/misc.h b/misc.h
new file mode 100644
index 0000000..40c15f0
--- /dev/null
+++ b/misc.h
@@ -0,0 +1,51 @@
+/*
+ * misc.h - Helper functions for geometry and attributes
+ *
+ * Written 2016 by Werner Almesberger
+ * Copyright 2016 Werner Almesberger
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+
+#ifndef MISC_H
+#define MISC_H
+
+#include <stdbool.h>
+
+
+static inline int mxr(int x, int y, const int m[6])
+{
+ return x * m[1] + y * m[2];
+}
+
+
+static inline int myr(int x, int y, const int m[6])
+{
+ return x * m[4] + y * m[5];
+}
+
+
+static inline int mx(int x, int y, const int m[6])
+{
+ return m[0] + mxr(x, y, m);
+}
+
+
+static inline int my(int x, int y, const int m[6])
+{
+ return m[3] + myr(x, y, m);
+}
+
+
+unsigned matrix_to_angle(const int m[6]);
+bool matrix_is_mirrored(const int m[6]);
+int angle_add(int a, int b);
+
+int rx(int x, int y, int rot);
+int ry(int x, int y, int rot);
+
+#endif /* !MISC_H */