diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-10-02 12:53:54 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-10-02 12:53:54 -0400 |
| commit | 9ade04722dd351c3f42cd98be28fc255043b3030 (patch) | |
| tree | 3aced80bf9cc9fb4160e2fab1ad7afa2d5b45df9 /balls.h | |
| parent | 2c54c155c9dc92c62881998c055bce17beddbe4f (diff) | |
| download | balls-9ade04722dd351c3f42cd98be28fc255043b3030.zip | |
multiple balls
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); |