summaryrefslogtreecommitdiffstats
path: root/balls.h
blob: 32059591b4da90cb19abf318924464e5140d0127 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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);