diff --git a/CMakeLists.txt b/CMakeLists.txt index 06cb6a3..b52928c 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.0.9) +set(BLT_VERSION 2.1.0) set(BLT_TARGET BLT) diff --git a/include/blt/iterator/iterator.h b/include/blt/iterator/iterator.h index 4048c52..48c1070 100644 --- a/include/blt/iterator/iterator.h +++ b/include/blt/iterator/iterator.h @@ -29,6 +29,12 @@ namespace blt { + template + static inline auto iterate(T begin, T end) + { + return iterator::iterator_container{std::move(begin), std::move(end)}; + } + template static inline auto iterate(T& container) { diff --git a/include/blt/math/matrix.h b/include/blt/math/matrix.h index 8f32b3c..673a442 100644 --- a/include/blt/math/matrix.h +++ b/include/blt/math/matrix.h @@ -12,6 +12,7 @@ #include #include #include +#include "blt/iterator/iterator.h" #ifndef M_PI // MSVC does not have M_PI @@ -163,6 +164,17 @@ namespace blt return copy; } + [[nodiscard]] constexpr matrix_t bipolar() const + { + matrix_t copy = *this; + for (auto& v : copy.data) + { + for (auto& d : blt::iterate(v.begin(), v.end())) + d = d >= 0 ? 1 : -1; + } + return copy; + } + constexpr inline const blt::vec& operator[](u32 column) const { return data[column]; diff --git a/include/blt/math/vectors.h b/include/blt/math/vectors.h index 17c5d67..f4fbe9a 100644 --- a/include/blt/math/vectors.h +++ b/include/blt/math/vectors.h @@ -34,6 +34,8 @@ namespace blt private: std::array elements; public: + constexpr static blt::u32 data_size = size; + constexpr vec() { for (auto& v : elements)