aboutsummaryrefslogtreecommitdiff
path: root/include/HyperNeat/QuadTree.hpp
blob: 80902540dba25661e8bc7c596b34ec04eb11de7e (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
#ifndef __HYPERNEAT_QUADTREE_HPP__
#define __HYPERNEAT_QUADTREE_HPP__

#include <HyperNeat/Utils/Vector.hpp>
#include <HyperNeat/Utils/Function.hpp>

namespace hyperneat
{
    class QuadTree
    {
    public:
        QuadTree() = default;
        QuadTree(double segment, double x, double y);

        double getSegment() const;
        double getX() const;
        double getY() const;

        void subdivide(Function<bool(QuadTree*)> subdivider);
        void traverse(Function<void(const QuadTree*)> traverser) const;

    private:
        Vector<QuadTree> _children;
        double           _segment = 0.0;
        double           _x       = 0.0;
        double           _y       = 0.0;
    };
}

#endif