diff options
Diffstat (limited to 'balls.h')
| -rw-r--r-- | balls.h | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1,3 +1,5 @@ +#include <stdlib.h> + typedef struct { double x, y; } Point; @@ -13,11 +15,17 @@ typedef struct { typedef struct { Point p; /* position [m] */ Vector v; /* velocity [m/s] */ - double m; /* mass [kg] */ double r; /* radius [m] */ + double m; /* mass [kg] */ } Ball; Point ptAddVec(Point p, Vector v); +Point Pt(double x, double y); Rectangle insetRect(Rectangle r, double n); +Point randPtInRect(Rectangle r); + +int isCollision(Point p1, double r1, Point p2, double r2); +void collideWall(Ball *b, Rectangle wall); -void collideWall(Ball *b, Rectangle wall);
\ No newline at end of file +int randInt(int lo, int hi); +double randDouble(double lo, double hi); |