diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-10-02 12:53:54 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-10-02 12:53:54 -0400 |
| commit | 9ade04722dd351c3f42cd98be28fc255043b3030 (patch) | |
| tree | 3aced80bf9cc9fb4160e2fab1ad7afa2d5b45df9 /geometry.cpp | |
| parent | 2c54c155c9dc92c62881998c055bce17beddbe4f (diff) | |
| download | balls-9ade04722dd351c3f42cd98be28fc255043b3030.zip | |
multiple balls
Diffstat (limited to 'geometry.cpp')
| -rw-r--r-- | geometry.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/geometry.cpp b/geometry.cpp index ae2c8ae..2bdad8c 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -7,6 +7,12 @@ ptAddVec(Point p, Vector v) { return p; } +Point +Pt(double x, double y) { + Point p = {x, y}; + return p; +} + Rectangle insetRect(Rectangle r, double n) { r.min.x += n; @@ -15,3 +21,8 @@ insetRect(Rectangle r, double n) { r.max.y -= n; return r; } + +Point +randPtInRect(Rectangle r) { + return Pt(randDouble(r.min.x, r.max.x), randDouble(r.min.y, r.max.y)); +} |