diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-09-19 20:11:32 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-09-19 20:11:32 -0400 |
| commit | d439ed77546a00929ddd55bf44d65b448d9d520c (patch) | |
| tree | cf1070d32e766c0fe5d753aebee840f0be67756f /balls.h | |
| parent | 8944ad075c6b12bbda1273ec31efade801892c19 (diff) | |
| download | balls-d439ed77546a00929ddd55bf44d65b448d9d520c.zip | |
pretty good collisions
Diffstat (limited to 'balls.h')
| -rw-r--r-- | balls.h | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -8,7 +8,7 @@ enum { }; typedef struct { - int x, y; + double x, y; } Vec; typedef struct { @@ -18,17 +18,17 @@ typedef struct { typedef struct { Point p; /* position */ Vec v; /* velocity */ - int m; /* mass */ + double m; /* mass */ } Ball; Vec vsub(Vec v1, Vec v2); -Vec vmuls(Vec v, int a); -Vec vdivs(Vec v, int a); -int vdot(Vec v1, Vec v2); -int vlen(Vec v); +Vec vmuls(Vec v, double a); +Vec vdivs(Vec v, double a); +double vdot(Vec v1, Vec v2); +double vlen(Vec v); Vec unitnorm(Vec v); Point ptaddv(Point p, Vec v); -Vec V(int x, int y); +Vec V(double x, double y); Vec Vpt(Point p, Point q); int iscollision(Point p, Point q);
\ No newline at end of file |