aboutsummaryrefslogtreecommitdiff
path: root/include/HyperNeat/QuadTree.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/HyperNeat/QuadTree.hpp')
-rw-r--r--include/HyperNeat/QuadTree.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/HyperNeat/QuadTree.hpp b/include/HyperNeat/QuadTree.hpp
new file mode 100644
index 0000000..8090254
--- /dev/null
+++ b/include/HyperNeat/QuadTree.hpp
@@ -0,0 +1,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