aboutsummaryrefslogtreecommitdiff
path: root/include/HyperNeat/QuadTree.hpp
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 19:04:34 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 19:16:14 +0100
commite6ab4a8ed100d5d5b7611c74cf3ccd556f1f1d71 (patch)
tree129cf13c2f9b3eae54402300db4570815789a02a /include/HyperNeat/QuadTree.hpp
Initial commitHEADmaster
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