diff --git a/CMakeLists.txt b/CMakeLists.txt index b52928c..56ee3d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 2.1.0) +set(BLT_VERSION 2.1.1) set(BLT_TARGET BLT) diff --git a/include/blt/math/matrix.h b/include/blt/math/matrix.h index 673a442..8936d3b 100644 --- a/include/blt/math/matrix.h +++ b/include/blt/math/matrix.h @@ -168,10 +168,7 @@ namespace blt { matrix_t copy = *this; for (auto& v : copy.data) - { - for (auto& d : blt::iterate(v.begin(), v.end())) - d = d >= 0 ? 1 : -1; - } + v = v.bipolar(); return copy; } diff --git a/include/blt/math/vectors.h b/include/blt/math/vectors.h index f4fbe9a..d1ec57e 100644 --- a/include/blt/math/vectors.h +++ b/include/blt/math/vectors.h @@ -134,6 +134,14 @@ namespace blt return copy; } + [[nodiscard]] constexpr inline vec bipolar() const + { + auto copy = *this; + for (auto& v : copy.elements) + v = v >= 0 ? 1 : -1; + return copy; + } + [[nodiscard]] constexpr inline T magnitude() const { T total = 0;