#include <vector>
#include "obstacle.h"
#include "rrtnode.h"
-#include "sample.h"
#include "slotplanner.h"
#define NOFNODES 20000
#define IXSIZE 100
-#define IXSTEP (1.0 * ((HMAX) - (HMIN)) / IXSIZE)
-#define IXI(x) ({ __typeof__ (x) _x = (x); \
- std::abs((int) floor(_x / IXSTEP)); })
#define IYSIZE 100
-#define IYSTEP (1.0 * ((VMAX) - (VMIN)) / IYSIZE)
-#define IYI(y) ({ \
- __typeof__ (y) _y = (y); \
- (int) floor((_y - VMIN) / IYSTEP); \
+
+#define GLVERTEX(n) ((n)->x() * glplwscale), ((n)->y() * glplhscale)
+
+// Nearest neighbor
+struct mcnn { // min-cost nearest neighbour
+ float mc;
+ RRTNode *nn;
+};
+#pragma omp declare reduction \
+ (minn: struct mcnn: omp_out = \
+ omp_in.mc < omp_out.mc ? omp_in : omp_out) \
+ initializer \
+ (omp_priv(omp_orig))
+
+// Near vertices
+#define GAMMA_RRTSTAR(card_V) ({ \
+ __typeof__ (card_V) _card_V = (card_V); \
+ pow(log(_card_V) / _card_V, 1.0/3.0); \
})
+# pragma omp declare reduction \
+ (merge: std::vector<RRTNode *>: \
+ omp_out.insert(omp_out.end(), omp_in.begin(), omp_in.end()))
+
class Cell {
private:
std::vector<RRTNode *> nodes_;
bool rebase(RRTNode *nr);
std::vector<RRTNode *> findt();
std::vector<RRTNode *> findt(RRTNode *n);
- float XI(RRTNode *n);
- float YI(RRTNode *n);
+ int XI(RRTNode *n);
+ int YI(RRTNode *n);
// RRT Framework
+ void defaultSamplingInfo();
void setSamplingInfo(SamplingInfo si);
RRTNode *sample();
float cost(RRTNode *init, RRTNode *goal);