From 9ade04722dd351c3f42cd98be28fc255043b3030 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Wed, 2 Oct 2024 12:53:54 -0400 Subject: multiple balls --- balls.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'balls.h') diff --git a/balls.h b/balls.h index 3205959..b69eea4 100644 --- a/balls.h +++ b/balls.h @@ -1,3 +1,5 @@ +#include + 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); -- cgit v1.2.3