aboutsummaryrefslogtreecommitdiff
path: root/geom.hpp
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-01 16:50:09 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-01 16:50:09 +0100
commit74dba84f9197a3b65b194d8a3dc53bf086d9f072 (patch)
treeb0956f6e166b6cef9c717403a7564418c32afe19 /geom.hpp
parentd6cef8b0585dcadd7a4c6c5811e127fce8436ec3 (diff)
downloadRobotique-Projet-74dba84f9197a3b65b194d8a3dc53bf086d9f072.tar.gz
Robotique-Projet-74dba84f9197a3b65b194d8a3dc53bf086d9f072.zip
Basic interface : can add obstacles ; set begin/end position, ...
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 cb8d583..fc9f32c 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 {