OBB OBB test
This commit is contained in:
parent
00acab154b
commit
55a319a6ac
4 changed files with 137 additions and 35 deletions
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue