From 79148a8506b1e26a5197977b4ece1091f026b052 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Wed, 19 Mar 2025 19:38:29 -0400 Subject: [PATCH] compairsion operators on vectors --- CMakeLists.txt | 2 +- include/blt/math/vectors.h | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b88d6e7..fc7b86d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 5.2.26) +set(BLT_VERSION 5.2.27) set(BLT_TARGET BLT) diff --git a/include/blt/math/vectors.h b/include/blt/math/vectors.h index 52d909f..75820bb 100644 --- a/include/blt/math/vectors.h +++ b/include/blt/math/vectors.h @@ -428,6 +428,50 @@ namespace blt return true; } + template + constexpr bool operator>=(const vec& left, const vec& right) + { + for (u32 i = 0; i < size; i++) + { + if (left[i] < right[i]) + return false; + } + return true; + } + + template + constexpr bool operator>(const vec& left, const vec& right) + { + for (u32 i = 0; i < size; i++) + { + if (left[i] <= right[i]) + return false; + } + return true; + } + + template + constexpr bool operator<(const vec& left, const vec& right) + { + for (u32 i = 0; i < size; i++) + { + if (left[i] >= right[i]) + return false; + } + return true; + } + + template + constexpr bool operator<=(const vec& left, const vec& right) + { + for (u32 i = 0; i < size; i++) + { + if (left[i] > right[i]) + return false; + } + return true; + } + template inline constexpr bool operator!=(const vec& left, const vec& right) {