aboutsummaryrefslogtreecommitdiffstats
path: root/geom.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'geom.hpp')
-rw-r--r--geom.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/geom.hpp b/geom.hpp
index e6dee0c..06b9e65 100644
--- a/geom.hpp
+++ b/geom.hpp
@@ -27,7 +27,7 @@ struct vec {
double angle() const {
if (is_nil()) return 0;
double xx = x / norm();
- double a = acos(x);
+ double a = acos(xx);
return (y >= 0 ? a : -a + 2*M_PI);
}
@@ -144,6 +144,10 @@ struct circle {
vec at_angle(double theta) const {
return c + vec(r * cos(theta), r * sin(theta));
}
+
+ bool intersects(vec p) const {
+ return (c - p).norm() <= r;
+ }
};
struct circarc {