-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathQuadTree.h
51 lines (36 loc) · 1.02 KB
/
QuadTree.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// Created by Ryan.Zurrin001 on 12/16/2021.
//
#ifndef PHYSICSFORMULA_QUADTREE_H
#define PHYSICSFORMULA_QUADTREE_H
#pragma once
#include "Point.h"
#include "Segment.h"
#include "Boundries.h"
#include <vector>
namespace rez {
#define NUM_POINTS 4
#define INE 0
#define INW 1
#define ISE 2
#define ISW 3
struct QDTNode {
QDTNode* NE = nullptr, * NW = nullptr, * SE = nullptr, * SW = nullptr;
QDTNode* parent = nullptr;
AABB box{};
Point2d point = DEFAULT_POINT_2D;
bool isALeaf = false;
//bool isAEmptyNode = false;
};
class QuadTree {
QDTNode* root = nullptr;
public:
QuadTree() = default;
explicit QuadTree(const std::vector<Point2d>& _points);
QuadTree(const std::vector<Point2d>& _points, AABB& bounds);
void BalanceTheTree();
void GenerateMesh();
void GetUniqueSegmentList(std::vector<Segment2d>& _segList);
};
}
#endif //PHYSICSFORMULA_QUADTREE_H