]> rtime.felk.cvut.cz Git - hubacji1/rrts.git/blobdiff - api/rrtext.h
Copy skeleton from ext4
[hubacji1/rrts.git] / api / rrtext.h
index 128fe0c49334d7674b06ee454569d95f5439810a..ed246f9066ebacbd4ce87d7dc021c59663924741 100644 (file)
 #define GRID_MAX_XI ((unsigned int) floor(GRID_WIDTH / GRID)) // min is 0
 #define GRID_MAX_YI ((unsigned int) floor(GRID_HEIGHT / GRID)) // min is 0
 
+/*! \brief Use grid data structure to store RRT nodes.
+
+This approach speeds up the search process for the nearest neighbor and
+the near vertices procedures.
+*/
+class RRTExt9 : public virtual RRTS {
+        private:
+                class Cell {
+                        private:
+                                bool changed_ = false;
+                                std::vector<RRTNode *> nodes_;
+                        public:
+                                void nn(RRTNode *t, RRTNode **nn, RRTS *p);
+                                void store_node(RRTNode *n);
+
+                                // getter, setter
+                                bool changed() const
+                                {
+                                        return this->changed_;
+                                }
+                                std::vector<RRTNode *> &nodes()
+                                {
+                                        return this->nodes_;
+                                }
+
+                                Cell();
+                };
+                Cell grid_[GRID_MAX_XI][GRID_MAX_YI]; // [0, 0] is bottom left
+                unsigned int x_min_ = 0;
+                unsigned int x_max_ = 0;
+                unsigned int y_min_ = 0;
+                unsigned int y_max_ = 0;
+
+                unsigned int xi(RRTNode n);
+                unsigned int yi(RRTNode n);
+        public:
+                void init();
+                void deinit();
+                void store_node(RRTNode n);
+                RRTNode *nn(RRTNode &t);
+                std::vector<RRTNode *> nv(RRTNode &t);
+};
+
 /*! \brief Use k-d tree data structure to store RRT nodes.
 
 This approach speeds up the search process for the nearest neighbor and