OBB OBB test

This commit is contained in:
Jorijn van der Graaf 2026-03-04 15:57:34 +01:00
commit 55a319a6ac
4 changed files with 137 additions and 35 deletions

View file

@ -238,7 +238,7 @@ namespace Crafter {
}
template <typename BT>
constexpr Vector<T, Len, Aligment> operator+(BT b) const {
constexpr Vector<T, Len, Aligment> operator+(BT b) const requires std::is_arithmetic_v<BT> {
Vector<T, Len, Aligment> resultVector;
for(std::uint32_t i = 0; i < Len; i++) {
resultVector.v[i] = this->v[i] + b;
@ -246,7 +246,7 @@ namespace Crafter {
return resultVector;
}
template <typename BT>
constexpr Vector<T, Len, Aligment> operator-(BT b) const {
constexpr Vector<T, Len, Aligment> operator-(BT b) const requires std::is_arithmetic_v<BT> {
Vector<T, Len, Aligment> resultVector;
for(std::uint32_t i = 0; i < Len; i++) {
resultVector.v[i] = this->v[i] - b;
@ -254,7 +254,7 @@ namespace Crafter {
return resultVector;
}
template <typename BT>
constexpr Vector<T, Len, Aligment> operator*(BT b) const {
constexpr Vector<T, Len, Aligment> operator*(BT b) const requires std::is_arithmetic_v<BT> {
Vector<T, Len, Aligment> resultVector;
for(std::uint32_t i = 0; i < Len; i++) {
resultVector.v[i] = this->v[i] * b;
@ -262,7 +262,7 @@ namespace Crafter {
return resultVector;
}
template <typename BT>
constexpr Vector<T, Len, Aligment> operator/(BT b) const {
constexpr Vector<T, Len, Aligment> operator/(BT b) const requires std::is_arithmetic_v<BT> {
Vector<T, Len, Aligment> resultVector;
for(std::uint32_t i = 0; i < Len; i++) {
resultVector.v[i] = this->v[i] / b;
@ -270,25 +270,25 @@ namespace Crafter {
return resultVector;
}
template <typename BT>
constexpr void operator+=(BT b){
constexpr void operator+=(BT b) requires std::is_arithmetic_v<BT>{
for(std::uint32_t i = 0; i < Len; i++) {
this->v[i] += b;
}
}
template <typename BT>
constexpr void operator-=(BT b){
constexpr void operator-=(BT b) requires std::is_arithmetic_v<BT>{
for(std::uint32_t i = 0; i < Len; i++) {
this->v[i] -= b;
}
}
template <typename BT>
constexpr void operator*=(BT b){
constexpr void operator*=(BT b) requires std::is_arithmetic_v<BT>{
for(std::uint32_t i = 0; i < Len; i++) {
this->v[i] *= b;
}
}
template <typename BT>
constexpr void operator/=(BT b){
constexpr void operator/=(BT b) requires std::is_arithmetic_v<BT>{
for(std::uint32_t i = 0; i < Len; i++) {
this->v[i] /= b;
}
@ -489,6 +489,6 @@ struct std::formatter<Crafter::Vector<T, 4, Aligment>> : std::formatter<std::str
template <typename T, std::uint32_t Len, std::uint32_t Aligment, typename BT>
constexpr Crafter::Vector<T, Len, Aligment> operator*(BT b, const Crafter::Vector<T, Len, Aligment>& v) {
constexpr Crafter::Vector<T, Len, Aligment> operator*(BT b, const Crafter::Vector<T, Len, Aligment>& v) requires std::is_arithmetic_v<BT> {
return v * b;
}