From f6dfe995d9d9731bb094b54f12fac962fd8bfc8c Mon Sep 17 00:00:00 2001 From: Yggdrasil75 Date: Wed, 3 Dec 2025 09:29:07 -0500 Subject: [PATCH] minor changes --- tests/g3chromatic.cpp | 4 ++-- util/vectorlogic/vec4.hpp | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/g3chromatic.cpp b/tests/g3chromatic.cpp index 8ce0fc2..cefdb3c 100644 --- a/tests/g3chromatic.cpp +++ b/tests/g3chromatic.cpp @@ -121,9 +121,9 @@ std::vector> pickSeeds(Grid3& grid, AnimationConf int maxTries = 0; while (!foundValidPos && maxTries < 10) { maxTries++; - size_t id = grid.getPositionVec(point, 0.5); + //size_t id = grid.getPositionVec(point, 0.5); + size_t id = grid.getOrCreatePositionVec(point, 0.0, true); if (id > 0) foundValidPos = true; - //size_t id = grid.getOrCreatePositionVec(point, 0.0, true); grid.setColor(id, color); seeds.push_back(std::make_tuple(id,point, color)); } diff --git a/util/vectorlogic/vec4.hpp b/util/vectorlogic/vec4.hpp index dd767b2..41b737e 100644 --- a/util/vectorlogic/vec4.hpp +++ b/util/vectorlogic/vec4.hpp @@ -375,6 +375,12 @@ public: return "RGBA(" + std::to_string(r) + ", " + std::to_string(g) + ", " + std::to_string(b) + ", " + std::to_string(a) + ")"; } + + struct Hash { + std::size_t operator()(const Vec4& v) const { + return std::hash()(v.x) ^ (std::hash()(v.y) << 1) ^ (std::hash()(v.z) << 2) ^ (std::hash()(v.w) << 3); + } + }; }; inline std::ostream& operator<<(std::ostream& os, const Vec4& vec) {