From d439ed77546a00929ddd55bf44d65b448d9d520c Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Thu, 19 Sep 2024 20:11:32 -0400 Subject: pretty good collisions --- balls.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'balls.h') diff --git a/balls.h b/balls.h index 0fa93a7..8e66ae0 100644 --- a/balls.h +++ b/balls.h @@ -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 -- cgit v1.2.3