summaryrefslogtreecommitdiff
path: root/inc/quadtree.hpp
blob: eb50db8cc7c47b51917efe81694f35ecee84ebde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef quadtree_h
#define quadtree_h

#include <vector>

#include "constants.hpp"
#include "organism.hpp"
#include "rectangle.hpp"

#include "sdl/window.hpp"

class Quadtree {
        public:
                Quadtree();
                Quadtree(int pLevel, Rectangle pBounds);

                void clear();
                void insert(Organism* iter);

                std::vector<Organism*> retrieve(std::vector<Organism*> returnObject, Rectangle obj);
                std::vector<Organism*> objects;

                Quadtree* nodes;

                std::vector<Rectangle> Draw();

        private:
                void    split();
                int     getIndex(Rectangle object);
                int     level;
                bool    isNull = true;

                Rectangle rect;
                Rectangle bounds;
};

#endif