diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-10-28 11:09:12 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-10-28 11:09:12 -0400 |
| commit | 93a3f005480effe48513e7bc81161db1adc43f32 (patch) | |
| tree | 64eeca36d8fc5c26663212db9210bc86d63dcd52 /geo.c | |
| parent | 613c6f7390cfc85a440b8aef3ec6e9d88529e526 (diff) | |
| download | balls-93a3f005480effe48513e7bc81161db1adc43f32.zip | |
move
Diffstat (limited to 'geo.c')
| -rw-r--r-- | geo.c | 29 |
1 files changed, 0 insertions, 29 deletions
@@ -1,10 +1,5 @@ -#include <stdlib.h> -#include <time.h> - #include "balls.h" -static float randFloat(float lo, float hi); - int isCollision(float2 p1, float r1, float2 p2, float r2) { float2 dist; @@ -21,27 +16,3 @@ insetRect(Rectangle r, float n) { r.max -= n; return r; } - -float2 -randPtInRect(Rectangle r) { - float2 pt = { - randFloat(r.min[0], r.max[0]), - randFloat(r.min[1], r.max[1]) - }; - return pt; -} - -static float -randFloat(float lo, float hi) { - float r, diff; - static int isInitialized = 0; - - if (!isInitialized) { /* First call. */ - srand(time(0)); - isInitialized = 1; - } - - r = (float) rand() / RAND_MAX; - diff = hi - lo; - return lo + r*diff; -} |