aboutsummaryrefslogtreecommitdiff
path: root/QuadTree.h
blob: 5a371d44607c11130ac2f63d10f7a1ea3a084064 (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
#pragma once

#include <memory>
#include <forward_list>

#include "Artist.h"
#include "Rectangle.h"

class QuadTree {
public:
	QuadTree(Museum &);
	QuadTree(const QuadTree *, const Rectangle & boundary);
	const Rectangle & get_boundary() { return this->boundary; }
	std::unique_ptr<QuadTree> subtree[4] = {
		nullptr,
		nullptr,
		nullptr,
		nullptr,
	};

private:
	const int capacity = 2;

	std::forward_list<Artist *> artists;
	size_t artists_size = 0;

	Rectangle boundary;

	void subdivide();
	void cull();
};