diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-10-02 16:19:30 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-10-02 16:19:30 -0400 |
| commit | 26ce765feb702c6d40f89a8cf50274869cdc35b4 (patch) | |
| tree | 7da69540057e9bcfa89d462f301dc215fbc21734 /balls.h | |
| parent | a59cd43105f938a5acb84d30dc9aaa92f675c966 (diff) | |
| download | balls-26ce765feb702c6d40f89a8cf50274869cdc35b4.zip | |
ball collisions
Diffstat (limited to 'balls.h')
| -rw-r--r-- | balls.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -19,13 +19,30 @@ typedef struct { double m; /* mass [kg] */ } Ball; +Point addPt(Point p, Point q); +Point subPt(Point p, Point q); Point ptAddVec(Point p, Vector v); +Point ptSubVec(Point p, Vector v); +Point ptMulS(Point p, double s); +Point ptDivS(Point p, double s); Point Pt(double x, double y); + +Vector addVec(Vector v1, Vector v2); +Vector subVec(Vector v1, Vector v2); +Vector vecMulS(Vector v, double s); +Vector vecDivS(Vector v, double s); +double vecDot(Vector v1, Vector v2); +Vector unitNorm(Vector v); +double vecLen(Vector v); +Vector Vec(double x, double y); +Vector VecPt(Point p, Point q); + 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 collideBall(Ball *b1, Ball *b2); int randInt(int lo, int hi); double randDouble(double lo, double hi); |