From 7b2bd7679a26bdb16a70ecf613b3cc3f1e043e16 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 6 Nov 2024 01:33:28 -0500 Subject: [PATCH] parker is a little bitch :3 i love him so much --- CMakeLists.txt | 2 +- src/main.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1363d70..be1aa03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(COSC-4P80-Assignment-3 VERSION 0.0.6) +project(COSC-4P80-Assignment-3 VERSION 0.0.7) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) diff --git a/src/main.cpp b/src/main.cpp index 84edc44..17ff51c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,10 +54,38 @@ void update(const blt::gfx::window_data& data) } ImGui::End(); + auto& meow = *std::find_if(files.begin(), files.end(), [](const data_file_t& v) { return v.data_points.begin()->bins.size() == 32; }); for (auto& v : som->get_array().get_map()) { float scale = 35; - renderer_2d.drawPointInternal(blt::make_color(1, 0, 0), point2d_t{v.get_x() * scale + scale, v.get_y() * scale + scale, scale}); + + float total_good_distance = 0; + float total_bad_distance = 0; + float total_goods = 0; + float total_bads = 0; + + for (auto& point : meow.data_points) + { + auto dist = v.dist(point.bins); + if (point.is_bad) + { + total_bads++; + total_bad_distance += dist; + } else + { + total_goods++; + total_good_distance += dist; + } + } + + float good_ratio = total_goods > 0 ? total_good_distance / total_goods : 0; + float bad_ratio = total_bads > 0 ? total_bad_distance / total_bads : 0; + float good_to_bad = total_good_distance / total_bad_distance; + + BLT_TRACE("%f %f %f", good_ratio, bad_ratio, good_to_bad); + + renderer_2d.drawPointInternal(blt::make_color(good_ratio, bad_ratio, good_to_bad), + point2d_t{v.get_x() * scale + scale, v.get_y() * scale + scale, scale}); } renderer_2d.render(data.width, data.height);