blob: b69eea412739904dc1ce6f9c815d5d8e566b9dcf (
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
24
25
26
27
28
29
30
31
|
#include <stdlib.h>
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 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);
int randInt(int lo, int hi);
double randDouble(double lo, double hi);
|