summaryrefslogtreecommitdiffstats
path: root/geometry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'geometry.cpp')
-rw-r--r--geometry.cpp11
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));
+}