Bug fixes

This commit is contained in:
THoehne 2024-10-13 19:09:15 +02:00
parent 89d96bbdf9
commit bb759b1a9a
10 changed files with 155 additions and 152 deletions

View File

@ -134,7 +134,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator+= (TIntVector2<T, A>& v1, T s); TIntVector2<T, A>& operator+= (TIntVector2<T, A>& v1, T s);
/** /**
* Addition operation on same TIntVector2<T, A> (this) by a another TIntVector2<T, A>. * Addition operation on same TIntVector2<T, A> (this) by a another TIntVector2<T, A>.
@ -144,7 +144,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator+= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); TIntVector2<T, A>& operator+= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
/** /**
* Substraction operation on same TIntVector2<T, A> (this) by a scalar. * Substraction operation on same TIntVector2<T, A> (this) by a scalar.
@ -154,7 +154,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator-= (TIntVector2<T, A>& v1, T s); TIntVector2<T, A>& operator-= (TIntVector2<T, A>& v1, T s);
/** /**
* Substraction operation on same TIntVector2<T, A> (this) by a another TIntVector2<T, A>. * Substraction operation on same TIntVector2<T, A> (this) by a another TIntVector2<T, A>.
@ -164,7 +164,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator-= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); TIntVector2<T, A>& operator-= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
/** /**
@ -175,10 +175,10 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator*= (TIntVector2<T, A>& v1, T s); TIntVector2<T, A>& operator*= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator*= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); TIntVector2<T, A>& operator*= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
/** /**
* Devision of Vector * Devision of Vector
@ -190,10 +190,10 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator/= (TIntVector2<T, A>& v1, T s); TIntVector2<T, A>& operator/= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator/= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); TIntVector2<T, A>& operator/= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
/** /**
* Stores the remainder of division by a scalar. * Stores the remainder of division by a scalar.
@ -203,40 +203,40 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator%= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); TIntVector2<T, A>& operator%= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator%= (TIntVector2<T, A>& v1, T s); TIntVector2<T, A>& operator%= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator&= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator&= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator&= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator&= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator|= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator|= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator|= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator|= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator^= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator^= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator^= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator^= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator<<= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator<<= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator<<= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator<<= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator>>= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator>>= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator>>= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator>>= (TIntVector2<T, A>& v1, T s);
/** /**
* Scale of Vector by floating point. (> Creates a new TIntVector2<T, A>) * Scale of Vector by floating point. (> Creates a new TIntVector2<T, A>)
@ -447,7 +447,7 @@ namespace Phanes::Core::Math {
} }
template<IntType T> template<IntType T>
TIntVector2<T, false> MaxV(TIntVector2<T, false>& v1, const TIntVector2<T, false>& v2) TIntVector2<T, false>& MaxV(TIntVector2<T, false>& v1, const TIntVector2<T, false>& v2)
{ {
v1.x = Phanes::Core::Math::Max(v1.x, v2.x); v1.x = Phanes::Core::Math::Max(v1.x, v2.x);
v1.y = Phanes::Core::Math::Max(v1.y, v2.y); v1.y = Phanes::Core::Math::Max(v1.y, v2.y);
@ -465,7 +465,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T> template<IntType T>
TIntVector2<T, false> MinV(TIntVector2<T, false>& v1, const TIntVector2<T, false>& v2) TIntVector2<T, false>& MinV(TIntVector2<T, false>& v1, const TIntVector2<T, false>& v2)
{ {
v1.x = Phanes::Core::Math::Min(v1.x, v2.x); v1.x = Phanes::Core::Math::Min(v1.x, v2.x);
v1.y = Phanes::Core::Math::Min(v1.y, v2.y); v1.y = Phanes::Core::Math::Min(v1.y, v2.y);
@ -481,7 +481,7 @@ namespace Phanes::Core::Math {
/// <param name="v1"></param> /// <param name="v1"></param>
/// <returns></returns> /// <returns></returns>
template<IntType T> template<IntType T>
TIntVector2<T, false> SignVectorV(TIntVector2<T, false>& v1) TIntVector2<T, false>& SignVectorV(TIntVector2<T, false>& v1)
{ {
v1.x = (v1.x >= 0) ? 1 : -1; v1.x = (v1.x >= 0) ? 1 : -1;
v1.y = (v1.y >= 0) ? 1 : -1; v1.y = (v1.y >= 0) ? 1 : -1;
@ -497,7 +497,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T> template<IntType T>
TIntVector2<T, false> Set(TIntVector2<T, false>& v1, const TIntVector2<T, false>& v2) TIntVector2<T, false>& Set(TIntVector2<T, false>& v1, const TIntVector2<T, false>& v2)
{ {
v1 = v2; v1 = v2;
@ -512,7 +512,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T> template<IntType T>
TIntVector2<T, false> Set(TIntVector2<T, false>& v1, T x, T y) TIntVector2<T, false>& Set(TIntVector2<T, false>& v1, T x, T y)
{ {
v1.x = x; v1.x = x;
v1.y = y; v1.y = y;
@ -528,7 +528,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T> template<IntType T>
TIntVector2<T, false> NegateV(TIntVector2<T, false>& v1) TIntVector2<T, false>& NegateV(TIntVector2<T, false>& v1)
{ {
v1.x = -v1.x; v1.x = -v1.x;
v1.y = -v1.y; v1.y = -v1.y;

View File

@ -37,70 +37,70 @@ namespace Phanes::Core::Math
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator+=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator+=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_add<T, S>::map(v1, v1, v2); Detail::compute_ivec2_add<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator+=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator+=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_add<T, S>::map(v1, v1, s); Detail::compute_ivec2_add<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator-=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator-=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_sub<T, S>::map(v1, v1, v2); Detail::compute_ivec2_sub<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator-=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator-=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_sub<T, S>::map(v1, v1, s); Detail::compute_ivec2_sub<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator*=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator*=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_mul<T, S>::map(v1, v1, v2); Detail::compute_ivec2_mul<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator*=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator*=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_mul<T, S>::map(v1, v1, s); Detail::compute_ivec2_mul<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator/=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator/=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_div<T, S>::map(v1, v1, v2); Detail::compute_ivec2_div<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator/=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator/=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_div<T, S>::map(v1, v1, s); Detail::compute_ivec2_div<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator%=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator%=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_mod<T, S>::map(v1, v1, v2); Detail::compute_ivec2_mod<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator%=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator%=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_mod<T, S>::map(v1, v1, s); Detail::compute_ivec2_mod<T, S>::map(v1, v1, s);
return v1; return v1;
@ -193,70 +193,70 @@ namespace Phanes::Core::Math
// Bitwise operators // Bitwise operators
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator&=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator&=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_and<T, S>::map(v1, v1, v2); Detail::compute_ivec2_and<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator&=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator&=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_and<T, S>::map(v1, v1, s); Detail::compute_ivec2_and<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator|=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator|=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_or<T, S>::map(v1, v1, v2); Detail::compute_ivec2_or<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator|=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator|=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_or<T, S>::map(v1, v1, s); Detail::compute_ivec2_or<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator^=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator^=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_xor<T, S>::map(v1, v1, v2); Detail::compute_ivec2_xor<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator^=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator^=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_xor<T, S>::map(v1, v1, s); Detail::compute_ivec2_xor<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator<<=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator<<=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_left_shift<T, S>::map(v1, v1, v2); Detail::compute_ivec2_left_shift<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator<<=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator<<=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_left_shift<T, S>::map(v1, v1, s); Detail::compute_ivec2_left_shift<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator>>=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2) TIntVector2<T, S>& operator>>=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{ {
Detail::compute_ivec2_right_shift<T, S>::map(v1, v1, v2); Detail::compute_ivec2_right_shift<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector2<T, S> operator>>=(TIntVector2<T, S>& v1, T s) TIntVector2<T, S>& operator>>=(TIntVector2<T, S>& v1, T s)
{ {
Detail::compute_ivec2_right_shift<T, S>::map(v1, v1, s); Detail::compute_ivec2_right_shift<T, S>::map(v1, v1, s);
return v1; return v1;

View File

@ -91,7 +91,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector3<T, A> operator+= (TIntVector3<T, A>& v1, T s); inline TIntVector3<T, A>& operator+= (TIntVector3<T, A>& v1, T s);
/** /**
* Coponentwise addition of 3D vector to 3D vector * Coponentwise addition of 3D vector to 3D vector
@ -101,7 +101,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector3<T, A> operator+= (TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2); inline TIntVector3<T, A>& operator+= (TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2);
/** /**
* Coponentwise substraction of scalar of 3D vector * Coponentwise substraction of scalar of 3D vector
@ -111,7 +111,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector3<T, A> operator-= (TIntVector3<T, A>& v1, T s); inline TIntVector3<T, A>& operator-= (TIntVector3<T, A>& v1, T s);
/** /**
* Coponentwise substraction of 3D vector to 3D vector * Coponentwise substraction of 3D vector to 3D vector
@ -121,7 +121,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector3<T, A> operator-= (TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2); inline TIntVector3<T, A>& operator-= (TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2);
/** /**
* Dot product between two 3D Vectors * Dot product between two 3D Vectors
@ -131,7 +131,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector3<T, A> operator*= (TIntVector3<T, A>& v1, T s); inline TIntVector3<T, A>& operator*= (TIntVector3<T, A>& v1, T s);
/** /**
* Division of vector by scalar * Division of vector by scalar
@ -141,44 +141,44 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector3<T, A> operator/= (TIntVector3<T, A>& v1, T s); inline TIntVector3<T, A>& operator/= (TIntVector3<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator%= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); TIntVector2<T, A>& operator%= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
TIntVector2<T, A> operator%= (TIntVector2<T, A>& v1, T s); TIntVector2<T, A>& operator%= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator&= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator&= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator&= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator&= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator|= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator|= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator|= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator|= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator^= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator^= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator^= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator^= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator<<= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator<<= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator<<= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator<<= (TIntVector2<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator>>= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2); inline TIntVector2<T, A>& operator>>= (TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector2<T, A> operator>>= (TIntVector2<T, A>& v1, T s); inline TIntVector2<T, A>& operator>>= (TIntVector2<T, A>& v1, T s);
/** /**
* Coponentwise multiplication of 3D Vectors with scalar * Coponentwise multiplication of 3D Vectors with scalar

View File

@ -44,70 +44,70 @@ namespace Phanes::Core::Math
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator+=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator+=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_add<T, S>::map(v1, v1, v2); Detail::compute_ivec3_add<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator+=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator+=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_add<T, S>::map(v1, v1, s); Detail::compute_ivec3_add<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator-=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator-=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_sub<T, S>::map(v1, v1, v2); Detail::compute_ivec3_sub<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator-=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator-=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_sub<T, S>::map(v1, v1, s); Detail::compute_ivec3_sub<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator*=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator*=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_mul<T, S>::map(v1, v1, v2); Detail::compute_ivec3_mul<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator*=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator*=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_mul<T, S>::map(v1, v1, s); Detail::compute_ivec3_mul<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator/=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator/=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_div<T, S>::map(v1, v1, v2); Detail::compute_ivec3_div<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator/=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator/=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_div<T, S>::map(v1, v1, s); Detail::compute_ivec3_div<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator%=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator%=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_mod<T, S>::map(v1, v1, v2); Detail::compute_ivec3_mod<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator%=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator%=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_mod<T, S>::map(v1, v1, s); Detail::compute_ivec3_mod<T, S>::map(v1, v1, s);
return v1; return v1;
@ -200,70 +200,70 @@ namespace Phanes::Core::Math
// Bitwise operators // Bitwise operators
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator&=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator&=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_and<T, S>::map(v1, v1, v2); Detail::compute_ivec3_and<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator&=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator&=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_and<T, S>::map(v1, v1, s); Detail::compute_ivec3_and<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator|=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator|=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_or<T, S>::map(v1, v1, v2); Detail::compute_ivec3_or<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator|=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator|=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_or<T, S>::map(v1, v1, s); Detail::compute_ivec3_or<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator^=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator^=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_xor<T, S>::map(v1, v1, v2); Detail::compute_ivec3_xor<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator^=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator^=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_xor<T, S>::map(v1, v1, s); Detail::compute_ivec3_xor<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator<<=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator<<=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_left_shift<T, S>::map(v1, v1, v2); Detail::compute_ivec3_left_shift<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator<<=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator<<=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_left_shift<T, S>::map(v1, v1, s); Detail::compute_ivec3_left_shift<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator>>=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2) TIntVector3<T, S>& operator>>=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{ {
Detail::compute_ivec3_right_shift<T, S>::map(v1, v1, v2); Detail::compute_ivec3_right_shift<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector3<T, S> operator>>=(TIntVector3<T, S>& v1, T s) TIntVector3<T, S>& operator>>=(TIntVector3<T, S>& v1, T s)
{ {
Detail::compute_ivec3_right_shift<T, S>::map(v1, v1, s); Detail::compute_ivec3_right_shift<T, S>::map(v1, v1, s);
return v1; return v1;

View File

@ -138,7 +138,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector4<T, A> operator+= (TIntVector4<T, A>& v1, T s); TIntVector4<T, A>& operator+= (TIntVector4<T, A>& v1, T s);
/** /**
* Addition operation on same TIntVector4<T, A> (this) by a another TIntVector4<T, A>. * Addition operation on same TIntVector4<T, A> (this) by a another TIntVector4<T, A>.
@ -148,7 +148,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector4<T, A> operator+= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2); TIntVector4<T, A>& operator+= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2);
/** /**
* Substraction operation on same TIntVector4<T, A> (this) by a floating point. * Substraction operation on same TIntVector4<T, A> (this) by a floating point.
@ -158,7 +158,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector4<T, A> operator-= (TIntVector4<T, A>& v1, T s); TIntVector4<T, A>& operator-= (TIntVector4<T, A>& v1, T s);
/** /**
* Substraction operation on same TIntVector4<T, A> (this) by a another TIntVector4<T, A>. * Substraction operation on same TIntVector4<T, A> (this) by a another TIntVector4<T, A>.
@ -168,7 +168,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector4<T, A> operator-= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2); TIntVector4<T, A>& operator-= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2);
/** /**
@ -179,7 +179,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector4<T, A> operator*= (TIntVector4<T, A>& v1, T s); TIntVector4<T, A>& operator*= (TIntVector4<T, A>& v1, T s);
/** /**
* Devision of Vector * Devision of Vector
@ -191,7 +191,7 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector4<T, A> operator/= (TIntVector4<T, A>& v1, T s); TIntVector4<T, A>& operator/= (TIntVector4<T, A>& v1, T s);
/** /**
* Stores the remainder of division by a scalar. * Stores the remainder of division by a scalar.
@ -201,40 +201,40 @@ namespace Phanes::Core::Math {
*/ */
template<IntType T, bool A> template<IntType T, bool A>
TIntVector4<T, A> operator%= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2); TIntVector4<T, A>& operator%= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
TIntVector4<T, A> operator%= (TIntVector4<T, A>& v1, T s); TIntVector4<T, A>& operator%= (TIntVector4<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator&= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2); inline TIntVector4<T, A>& operator&= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator&= (TIntVector4<T, A>& v1, T s); inline TIntVector4<T, A>& operator&= (TIntVector4<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator|= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2); inline TIntVector4<T, A>& operator|= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator|= (TIntVector4<T, A>& v1, T s); inline TIntVector4<T, A>& operator|= (TIntVector4<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator^= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2); inline TIntVector4<T, A> operator^= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator^= (TIntVector4<T, A>& v1, T s); inline TIntVector4<T, A>& operator^= (TIntVector4<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator<<= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2); inline TIntVector4<T, A>& operator<<= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator<<= (TIntVector4<T, A>& v1, T s); inline TIntVector4<T, A>& operator<<= (TIntVector4<T, A>& v1, T s);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator>>= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2); inline TIntVector4<T, A>& operator>>= (TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2);
template<IntType T, bool A> template<IntType T, bool A>
inline TIntVector4<T, A> operator>>= (TIntVector4<T, A>& v1, T s); inline TIntVector4<T, A>& operator>>= (TIntVector4<T, A>& v1, T s);
/** /**
* Scale of Vector by floating point. (> Creates a new TIntVector4<T, A>) * Scale of Vector by floating point. (> Creates a new TIntVector4<T, A>)
@ -443,12 +443,14 @@ namespace Phanes::Core::Math {
template<IntType T> template<IntType T>
void Set(TIntVector4<T, false>& v1, TIntVector4<T, false>& v2) TIntVector4<T, false>& Set(TIntVector4<T, false>& v1, TIntVector4<T, false>& v2)
{ {
v1.x = v2.x; v1.x = v2.x;
v1.y = v2.y; v1.y = v2.y;
v1.z = v2.z; v1.z = v2.z;
v1.w = v2.w; v1.w = v2.w;
return v1;
} }
@ -494,7 +496,7 @@ namespace Phanes::Core::Math {
/// <param name="v2">Vector two</param> /// <param name="v2">Vector two</param>
/// <returns>Copy of v1.</returns> /// <returns>Copy of v1.</returns>
template<IntType T> template<IntType T>
TIntVector4<T, false> MaxV(TIntVector4<T, false>& v1, const TIntVector4<T, false>& v2) TIntVector4<T, false>& MaxV(TIntVector4<T, false>& v1, const TIntVector4<T, false>& v2)
{ {
v1.x = (v1.x > v2.x) ? v1.x : v2.x; v1.x = (v1.x > v2.x) ? v1.x : v2.x;
v1.y = (v1.y > v2.y) ? v1.y : v2.y; v1.y = (v1.y > v2.y) ? v1.y : v2.y;
@ -532,7 +534,7 @@ namespace Phanes::Core::Math {
/// <param name="v2">Vector two</param> /// <param name="v2">Vector two</param>
/// <returns>Copy of v1.</returns> /// <returns>Copy of v1.</returns>
template<IntType T> template<IntType T>
TIntVector4<T, false> MinV(TIntVector4<T, false>& v1, const TIntVector4<T, false>& v2) TIntVector4<T, false>& MinV(TIntVector4<T, false>& v1, const TIntVector4<T, false>& v2)
{ {
v1.x = (v1.x < v2.x) ? v1.x : v2.x; v1.x = (v1.x < v2.x) ? v1.x : v2.x;
v1.y = (v1.y < v2.y) ? v1.y : v2.y; v1.y = (v1.y < v2.y) ? v1.y : v2.y;
@ -568,7 +570,7 @@ namespace Phanes::Core::Math {
/// <param name="v1">Vector</param> /// <param name="v1">Vector</param>
/// <returns>Copy of v1.</returns> /// <returns>Copy of v1.</returns>
template<IntType T> template<IntType T>
TIntVector4<T, false> NegateV(TIntVector4<T, false>& v1) TIntVector4<T, false>& NegateV(TIntVector4<T, false>& v1)
{ {
v1.x = -v1.x; v1.x = -v1.x;
v1.y = -v1.y; v1.y = -v1.y;
@ -609,7 +611,7 @@ namespace Phanes::Core::Math {
/// <typeparam name="T">Type of vector</typeparam> /// <typeparam name="T">Type of vector</typeparam>
/// <returns></returns> /// <returns></returns>
template<IntType T> template<IntType T>
TIntVector4<T, false> SignVectorV(TIntVector4<T, false>& v1) TIntVector4<T, false>& SignVectorV(TIntVector4<T, false>& v1)
{ {
v1.x = (v1.x > 0) ? 1 : -1; v1.x = (v1.x > 0) ? 1 : -1;
v1.y = (v1.y > 0) ? 1 : -1; v1.y = (v1.y > 0) ? 1 : -1;

View File

@ -43,70 +43,70 @@ namespace Phanes::Core::Math
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator+=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator+=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_add<T, S>::map(v1, v1, v2); Detail::compute_ivec4_add<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator+=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator+=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_add<T, S>::map(v1, v1, s); Detail::compute_ivec4_add<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator-=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator-=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_sub<T, S>::map(v1, v1, v2); Detail::compute_ivec4_sub<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator-=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator-=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_sub<T, S>::map(v1, v1, s); Detail::compute_ivec4_sub<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator*=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator*=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_mul<T, S>::map(v1, v1, v2); Detail::compute_ivec4_mul<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator*=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator*=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_mul<T, S>::map(v1, v1, s); Detail::compute_ivec4_mul<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator/=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator/=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_div<T, S>::map(v1, v1, v2); Detail::compute_ivec4_div<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator/=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator/=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_div<T, S>::map(v1, v1, s); Detail::compute_ivec4_div<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator%=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator%=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_mod<T, S>::map(v1, v1, v2); Detail::compute_ivec4_mod<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator%=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator%=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_mod<T, S>::map(v1, v1, s); Detail::compute_ivec4_mod<T, S>::map(v1, v1, s);
return v1; return v1;
@ -199,70 +199,70 @@ namespace Phanes::Core::Math
// Bitwise operators // Bitwise operators
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator&=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator&=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_and<T, S>::map(v1, v1, v2); Detail::compute_ivec4_and<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator&=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator&=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_and<T, S>::map(v1, v1, s); Detail::compute_ivec4_and<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator|=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator|=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_or<T, S>::map(v1, v1, v2); Detail::compute_ivec4_or<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator|=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator|=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_or<T, S>::map(v1, v1, s); Detail::compute_ivec4_or<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator^=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator^=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_xor<T, S>::map(v1, v1, v2); Detail::compute_ivec4_xor<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator^=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator^=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_xor<T, S>::map(v1, v1, s); Detail::compute_ivec4_xor<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator<<=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator<<=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_left_shift<T, S>::map(v1, v1, v2); Detail::compute_ivec4_left_shift<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator<<=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator<<=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_left_shift<T, S>::map(v1, v1, s); Detail::compute_ivec4_left_shift<T, S>::map(v1, v1, s);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator>>=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2) TIntVector4<T, S>& operator>>=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{ {
Detail::compute_ivec4_right_shift<T, S>::map(v1, v1, v2); Detail::compute_ivec4_right_shift<T, S>::map(v1, v1, v2);
return v1; return v1;
} }
template<IntType T, bool S> template<IntType T, bool S>
TIntVector4<T, S> operator>>=(TIntVector4<T, S>& v1, T s) TIntVector4<T, S>& operator>>=(TIntVector4<T, S>& v1, T s)
{ {
Detail::compute_ivec4_right_shift<T, S>::map(v1, v1, s); Detail::compute_ivec4_right_shift<T, S>::map(v1, v1, s);
return v1; return v1;

View File

@ -47,7 +47,7 @@ namespace Phanes::Core::Math
*/ */
template<RealType T> template<RealType T>
TLine<T> NormalizeV(TLine<T>& l1) TLine<T>& NormalizeV(TLine<T>& l1)
{ {
std::any std::any

View File

@ -139,7 +139,7 @@ namespace Phanes::Core::Math {
// ====================== // // ====================== //
template<RealType T> template<RealType T>
TMatrix2<T> operator+= (TMatrix2<T>& m1, T s) TMatrix2<T>& operator+= (TMatrix2<T>& m1, T s)
{ {
m1(0, 0) += s; m1(0, 0) += s;
m1(0, 1) += s; m1(0, 1) += s;
@ -150,7 +150,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T> template<RealType T>
TMatrix2<T> operator+= (TMatrix2<T>& m1, const TMatrix2<T>& m2) TMatrix2<T>& operator+= (TMatrix2<T>& m1, const TMatrix2<T>& m2)
{ {
m1(0, 0) += m2(0, 0); m1(0, 0) += m2(0, 0);
m1(0, 1) += m2(0, 1); m1(0, 1) += m2(0, 1);
@ -161,7 +161,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T> template<RealType T>
TMatrix2<T> operator-= (TMatrix2<T>& m1, T s) TMatrix2<T>& operator-= (TMatrix2<T>& m1, T s)
{ {
m1(0, 0) -= s; m1(0, 0) -= s;
m1(0, 1) -= s; m1(0, 1) -= s;
@ -172,7 +172,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T> template<RealType T>
TMatrix2<T> operator-= (TMatrix2<T>& m1, const TMatrix2<T>& m2) TMatrix2<T>& operator-= (TMatrix2<T>& m1, const TMatrix2<T>& m2)
{ {
m1(0, 0) -= m2(0, 0); m1(0, 0) -= m2(0, 0);
m1(0, 1) -= m2(0, 1); m1(0, 1) -= m2(0, 1);
@ -183,7 +183,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T> template<RealType T>
TMatrix2<T> operator*= (TMatrix2<T>& m1, T s) TMatrix2<T>& operator*= (TMatrix2<T>& m1, T s)
{ {
m1.data[0][0] *= s; m1.data[0][0] *= s;
m1.data[0][1] *= s; m1.data[0][1] *= s;
@ -194,7 +194,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T> template<RealType T>
TMatrix2<T> operator*= (TMatrix2<T>& m1, const TMatrix2<T>& m2) TMatrix2<T>& operator*= (TMatrix2<T>& m1, const TMatrix2<T>& m2)
{ {
TMatrix2<T> c = m1; TMatrix2<T> c = m1;
@ -208,7 +208,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T> template<RealType T>
TMatrix2<T> operator/= (TMatrix2<T>& m1, T s) TMatrix2<T>& operator/= (TMatrix2<T>& m1, T s)
{ {
s = (T)1.0 / s; s = (T)1.0 / s;
m1.data[0][0] *= s; m1.data[0][0] *= s;
@ -300,7 +300,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T> template<RealType T>
TMatrix2<T> InverseV(TMatrix2<T>& m1) TMatrix2<T>& InverseV(TMatrix2<T>& m1)
{ {
float _1_det = 1.0f / Determinant(m1); float _1_det = 1.0f / Determinant(m1);
float m00 = m1(0, 0); float m00 = m1(0, 0);
@ -315,7 +315,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T> template<RealType T>
TMatrix2<T> TransposeV(TMatrix2<T>& m1) TMatrix2<T>& TransposeV(TMatrix2<T>& m1)
{ {
Swap(m1(0, 1), m1(1, 0)); Swap(m1(0, 1), m1(1, 0));

View File

@ -165,7 +165,7 @@ namespace Phanes::Core::Math {
*/ */
template<RealType T, bool S> template<RealType T, bool S>
TMatrix3<T, S> operator+= (TMatrix3<T, S>& m1, T s) TMatrix3<T, S>& operator+= (TMatrix3<T, S>& m1, T s)
{ {
m1.c0 += s; m1.c0 += s;
m1.c1 += s; m1.c1 += s;
@ -182,7 +182,7 @@ namespace Phanes::Core::Math {
*/ */
template<RealType T, bool S> template<RealType T, bool S>
TMatrix3<T, S> operator+= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2) TMatrix3<T, S>& operator+= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2)
{ {
m1.c0 += m2.c0; m1.c0 += m2.c0;
m1.c1 += m2.c1; m1.c1 += m2.c1;
@ -199,7 +199,7 @@ namespace Phanes::Core::Math {
*/ */
template<RealType T, bool S> template<RealType T, bool S>
TMatrix3<T, S> operator-= (TMatrix3<T, S>& m1, T s) TMatrix3<T, S>& operator-= (TMatrix3<T, S>& m1, T s)
{ {
m1.c0 -= s; m1.c0 -= s;
m1.c1 -= s; m1.c1 -= s;
@ -216,7 +216,7 @@ namespace Phanes::Core::Math {
*/ */
template<RealType T, bool S> template<RealType T, bool S>
TMatrix3<T, S> operator-= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2) TMatrix3<T, S>& operator-= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2)
{ {
m1.c0 -= m2.c0; m1.c0 -= m2.c0;
m1.c1 -= m2.c1; m1.c1 -= m2.c1;
@ -233,7 +233,7 @@ namespace Phanes::Core::Math {
*/ */
template<RealType T, bool S> template<RealType T, bool S>
TMatrix3<T, S> operator*= (TMatrix3<T, S>& m1, T s) TMatrix3<T, S>& operator*= (TMatrix3<T, S>& m1, T s)
{ {
m1.c0 *= s; m1.c0 *= s;
m1.c1 *= s; m1.c1 *= s;
@ -250,7 +250,7 @@ namespace Phanes::Core::Math {
*/ */
template<RealType T, bool S> template<RealType T, bool S>
TMatrix3<T, S> operator*= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2); TMatrix3<T, S>& operator*= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2);
/** /**
* Multiply matrix with scalar * Multiply matrix with scalar
@ -260,7 +260,7 @@ namespace Phanes::Core::Math {
*/ */
template<RealType T, bool S> template<RealType T, bool S>
TMatrix3<T, S> operator/= (TMatrix3<T, S>& m1, T s) TMatrix3<T, S>& operator/= (TMatrix3<T, S>& m1, T s)
{ {
s = (T)1.0 / s; s = (T)1.0 / s;
m1.c0 *= s; m1.c0 *= s;
@ -278,7 +278,7 @@ namespace Phanes::Core::Math {
*/ */
template<RealType T, bool S> template<RealType T, bool S>
TMatrix3<T, S> operator/= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2) TMatrix3<T, S>& operator/= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2)
{ {
m1.c0 /= m2.c0; m1.c0 /= m2.c0;
m1.c1 /= m2.c1; m1.c1 /= m2.c1;

View File

@ -141,7 +141,7 @@ namespace Phanes::Core::Math {
// ==================== // // ==================== //
template<RealType T, bool S> template<RealType T, bool S>
TMatrix4<T, S> operator+= (TMatrix4<T, S>& m1, T s) TMatrix4<T, S>& operator+= (TMatrix4<T, S>& m1, T s)
{ {
m1.c0 += s; m1.c0 += s;
m1.c1 += s; m1.c1 += s;
@ -152,7 +152,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T, bool S> template<RealType T, bool S>
TMatrix4<T, S> operator+= (TMatrix4<T, S>& m1, const TMatrix4<T, S>& m2) TMatrix4<T, S>& operator+= (TMatrix4<T, S>& m1, const TMatrix4<T, S>& m2)
{ {
m1.c0 += m2.c0; m1.c0 += m2.c0;
m1.c1 += m2.c1; m1.c1 += m2.c1;
@ -163,7 +163,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T, bool S> template<RealType T, bool S>
TMatrix4<T, S> operator-= (TMatrix4<T, S>& m1, T s) TMatrix4<T, S>& operator-= (TMatrix4<T, S>& m1, T s)
{ {
m1.c0 -= s; m1.c0 -= s;
m1.c1 -= s; m1.c1 -= s;
@ -174,7 +174,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T, bool S> template<RealType T, bool S>
TMatrix4<T, S> operator-= (TMatrix4<T, S>& m1, const TMatrix4<T, S>& m2) TMatrix4<T, S>& operator-= (TMatrix4<T, S>& m1, const TMatrix4<T, S>& m2)
{ {
m1.c0 -= m2.c0; m1.c0 -= m2.c0;
m1.c1 -= m2.c1; m1.c1 -= m2.c1;
@ -185,7 +185,7 @@ namespace Phanes::Core::Math {
} }
template<RealType T, bool S> template<RealType T, bool S>
TMatrix4<T, S> operator*= (TMatrix4<T, S>& m1, T s) TMatrix4<T, S>& operator*= (TMatrix4<T, S>& m1, T s)
{ {
m1.c0 *= s; m1.c0 *= s;
m1.c1 *= s; m1.c1 *= s;
@ -195,11 +195,12 @@ namespace Phanes::Core::Math {
return m1; return m1;
} }
// Matrix multiplication
template<RealType T, bool S> template<RealType T, bool S>
TMatrix4<T, S> operator*= (TMatrix4<T, S>& m1, const TMatrix4<T, S>& m2); TMatrix4<T, S>& operator*= (TMatrix4<T, S>& m1, const TMatrix4<T, S>& m2);
template<RealType T, bool S> template<RealType T, bool S>
TMatrix4<T, S> operator/= (TMatrix4<T, S>& m1, T s) TMatrix4<T, S>& operator/= (TMatrix4<T, S>& m1, T s)
{ {
s = (T)1.0 / s; s = (T)1.0 / s;
m1.c0 *= s; m1.c0 *= s;
@ -301,7 +302,7 @@ namespace Phanes::Core::Math {
bool InverseV(TMatrix4<T, S>& a); bool InverseV(TMatrix4<T, S>& a);
template<RealType T, bool S> template<RealType T, bool S>
TMatrix4<T, S> TransposeV(TMatrix4<T, S>& a); TMatrix4<T, S>& TransposeV(TMatrix4<T, S>& a);
// =============== // // =============== //