From 4e414b2ea56bdb2b74d45bcab4eb3839d41a8a9f Mon Sep 17 00:00:00 2001 From: Jiri Hubacek Date: Mon, 24 Sep 2018 10:00:38 +0200 Subject: [PATCH] Add IS_NEAR macro --- incl/rrtnode.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/incl/rrtnode.h b/incl/rrtnode.h index ef66143..40ca962 100644 --- a/incl/rrtnode.h +++ b/incl/rrtnode.h @@ -20,6 +20,12 @@ along with I am car. If not, see . #include +#define IS_NEAR(a, b) ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + pow(pow(_b->x() - _a->x(), 2) + \ + pow(_b->y() - _a->y(), 2), 0.5) < 0.2 && \ + std::abs(_b->h() - _a->h()) < M_PI / 32 ? true : false; }) + class RRTNode { private: float dcost_ = 0; // direct cost (of edge) to parent -- 2.39.2