From 90652f512e9621e0dfac497439c7c80bf113d9d5 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Mon, 21 Oct 2024 17:41:38 +0200 Subject: implement quadtree paritioning --- ViewController.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ViewController.cpp') diff --git a/ViewController.cpp b/ViewController.cpp index d336b9c..3b298db 100644 --- a/ViewController.cpp +++ b/ViewController.cpp @@ -70,13 +70,14 @@ void ViewController::update_pathfinding() { void ViewController::update_quadtree_recursive(QuadTree * tree) { if (tree == nullptr) return; + const Rectangle & tree_boundary = tree->get_boundary(); Rectangle rect = { - .x = tree->boundary.x * scale, - .y = tree->boundary.y * scale, - .width = tree->boundary.width * scale, - .height = tree->boundary.height * scale, + .x = tree_boundary.x * scale, + .y = tree_boundary.y * scale, + .width = tree_boundary.width * scale, + .height = tree_boundary.height * scale, }; - this->view.draw_rect(rect, { .red = 0xff, .green = 0x00, .blue = 0xff, }, 2); + this->view.draw_rect(rect, { .red = 0xff, .green = 0x00, .blue = 0xff, }, 1); this->update_quadtree_recursive(tree->subtree[0].get()); this->update_quadtree_recursive(tree->subtree[1].get()); -- cgit v1.2.3