summaryrefslogtreecommitdiffstats
path: root/balls.h
diff options
context:
space:
mode:
Diffstat (limited to 'balls.h')
-rw-r--r--balls.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/balls.h b/balls.h
new file mode 100644
index 0000000..3205959
--- /dev/null
+++ b/balls.h
@@ -0,0 +1,23 @@
+typedef struct {
+ double x, y;
+} Point;
+
+typedef struct {
+ Point min, max;
+} Rectangle;
+
+typedef struct {
+ double x, y;
+} Vector;
+
+typedef struct {
+ Point p; /* position [m] */
+ Vector v; /* velocity [m/s] */
+ double m; /* mass [kg] */
+ double r; /* radius [m] */
+} Ball;
+
+Point ptAddVec(Point p, Vector v);
+Rectangle insetRect(Rectangle r, double n);
+
+void collideWall(Ball *b, Rectangle wall); \ No newline at end of file