Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
8744 lines (8212 sloc) 433 KB
#ifndef UNITY_VECTORS
union VectorI2
{
struct { Int32 x, y; };
Int32 E[2];
};
union VectorI3
{
struct { Int32 x, y, z; };
Int32 E[3];
};
union VectorI4
{
struct { Int32 x, y, z, w; };
Int32 E[4];
};
union VectorB2
{
struct { Byte x, y; };
Byte E[2];
};
union VectorB3
{
struct { Byte x, y, z; };
Byte E[3];
};
union VectorB4
{
struct { Byte x, y, z, w; };
Byte E[4];
};
union VectorD2
{
struct { Double x, y; };
Double E[2];
};
union VectorD3
{
struct { Double x, y, z; };
Double E[3];
};
union VectorD4
{
struct { Double x, y, z, w; };
Double E[4];
};
union Vector2
{
struct { Single x, y; };
Single E[2];
};
union Vector3
{
struct { Single x, y, z; };
Single E[3];
};
union Vector4
{
struct { Single x, y, z, w; };
Single E[4];
};
#define VectorI2_left (VectorI2{ -1, 0 })
#define VectorI2_down (VectorI2{ 0, -1 })
#define VectorI2_right (VectorI2{ 1, 0 })
#define VectorI2_up (VectorI2{ 0, 1 })
#define VectorI2_one MkVectorI2(1);
#define VectorI2_zero MkVectorI2(0);
#define VectorI2_MinValue MkVectorI2(INT32_MIN);
#define VectorI2_MaxValue MkVectorI2(INT32_MAX);
#define VectorI3_left (VectorI3{ -1, 0, 0 })
#define VectorI3_down (VectorI3{ 0, -1, 0 })
#define VectorI3_back (VectorI3{ 0, 0, -1 })
#define VectorI3_right (VectorI3{ 1, 0, 0 })
#define VectorI3_up (VectorI3{ 0, 1, 0 })
#define VectorI3_forward (VectorI3{ 0, 0, 1 })
#define VectorI3_one MkVectorI3(1);
#define VectorI3_zero MkVectorI3(0);
#define VectorI3_MinValue MkVectorI3(INT32_MIN);
#define VectorI3_MaxValue MkVectorI3(INT32_MAX);
#define VectorI4_one MkVectorI4(1);
#define VectorI4_zero MkVectorI4(0);
#define VectorI4_MinValue MkVectorI4(INT32_MIN);
#define VectorI4_MaxValue MkVectorI4(INT32_MAX);
#define VectorB2_right (VectorB2{ 1, 0 })
#define VectorB2_up (VectorB2{ 0, 1 })
#define VectorB2_one MkVectorB2(1);
#define VectorB2_zero MkVectorB2(0);
#define VectorB2_MinValue MkVectorB2(0);
#define VectorB2_MaxValue MkVectorB2(UINT8_MAX);
#define VectorB3_right (VectorB3{ 1, 0, 0 })
#define VectorB3_up (VectorB3{ 0, 1, 0 })
#define VectorB3_forward (VectorB3{ 0, 0, 1 })
#define VectorB3_one MkVectorB3(1);
#define VectorB3_zero MkVectorB3(0);
#define VectorB3_MinValue MkVectorB3(0);
#define VectorB3_MaxValue MkVectorB3(UINT8_MAX);
#define VectorB4_one MkVectorB4(1);
#define VectorB4_zero MkVectorB4(0);
#define VectorB4_MinValue MkVectorB4(0);
#define VectorB4_MaxValue MkVectorB4(UINT8_MAX);
#define VectorD2_left (VectorD2{ -1, 0 })
#define VectorD2_down (VectorD2{ 0, -1 })
#define VectorD2_right (VectorD2{ 1, 0 })
#define VectorD2_up (VectorD2{ 0, 1 })
#define VectorD2_one MkVectorD2(1);
#define VectorD2_zero MkVectorD2(0);
#define VectorD2_negativeInfinity MkVectorD2(-INFINITY);
#define VectorD2_positiveInfinity MkVectorD2(INFINITY);
#define VectorD3_left (VectorD3{ -1, 0, 0 })
#define VectorD3_down (VectorD3{ 0, -1, 0 })
#define VectorD3_back (VectorD3{ 0, 0, -1 })
#define VectorD3_right (VectorD3{ 1, 0, 0 })
#define VectorD3_up (VectorD3{ 0, 1, 0 })
#define VectorD3_forward (VectorD3{ 0, 0, 1 })
#define VectorD3_one MkVectorD3(1);
#define VectorD3_zero MkVectorD3(0);
#define VectorD3_negativeInfinity MkVectorD3(-INFINITY);
#define VectorD3_positiveInfinity MkVectorD3(INFINITY);
#define VectorD4_one MkVectorD4(1);
#define VectorD4_zero MkVectorD4(0);
#define VectorD4_negativeInfinity MkVectorD4(-INFINITY);
#define VectorD4_positiveInfinity MkVectorD4(INFINITY);
#define Vector2_left (Vector2{ -1, 0 })
#define Vector2_down (Vector2{ 0, -1 })
#define Vector2_right (Vector2{ 1, 0 })
#define Vector2_up (Vector2{ 0, 1 })
#define Vector2_one MkVector2(1);
#define Vector2_zero MkVector2(0);
#define Vector2_negativeInfinity MkVector2(-INFINITY);
#define Vector2_positiveInfinity MkVector2(INFINITY);
#define Vector3_left (Vector3{ -1, 0, 0 })
#define Vector3_down (Vector3{ 0, -1, 0 })
#define Vector3_back (Vector3{ 0, 0, -1 })
#define Vector3_right (Vector3{ 1, 0, 0 })
#define Vector3_up (Vector3{ 0, 1, 0 })
#define Vector3_forward (Vector3{ 0, 0, 1 })
#define Vector3_one MkVector3(1);
#define Vector3_zero MkVector3(0);
#define Vector3_negativeInfinity MkVector3(-INFINITY);
#define Vector3_positiveInfinity MkVector3(INFINITY);
#define Vector4_one MkVector4(1);
#define Vector4_zero MkVector4(0);
#define Vector4_negativeInfinity MkVector4(-INFINITY);
#define Vector4_positiveInfinity MkVector4(INFINITY);
// Constructors from primitives. Float converts to int using floor
inline VectorI2 MkVectorI2(Int32 x, Int32 y)
{
VectorI2 V;
V.x = (Int32)(x);
V.y = (Int32)(y);
return V;
}
inline VectorI2 MkVectorI2(Int32 A)
{
VectorI2 V;
V.x = (Int32)(A);
V.y = (Int32)(A);
return V;
}
inline VectorI2 MkVectorI2B(Byte x, Byte y)
{
VectorI2 V;
V.x = (Int32)(x);
V.y = (Int32)(y);
return V;
}
inline VectorI2 MkVectorI2B(Byte A)
{
VectorI2 V;
V.x = (Int32)(A);
V.y = (Int32)(A);
return V;
}
inline VectorI2 MkVectorI2D(Double x, Double y)
{
VectorI2 V;
V.x = FloorID(x);
V.y = FloorID(y);
return V;
}
inline VectorI2 MkVectorI2D(Double A)
{
VectorI2 V;
V.x = FloorID(A);
V.y = FloorID(A);
return V;
}
inline VectorI2 MkVectorI2F(Single x, Single y)
{
VectorI2 V;
V.x = FloorIF(x);
V.y = FloorIF(y);
return V;
}
inline VectorI2 MkVectorI2F(Single A)
{
VectorI2 V;
V.x = FloorIF(A);
V.y = FloorIF(A);
return V;
}
inline VectorI3 MkVectorI3(Int32 x, Int32 y, Int32 z)
{
VectorI3 V;
V.x = (Int32)(x);
V.y = (Int32)(y);
V.z = (Int32)(z);
return V;
}
inline VectorI3 MkVectorI3(Int32 A)
{
VectorI3 V;
V.x = (Int32)(A);
V.y = (Int32)(A);
V.z = (Int32)(A);
return V;
}
inline VectorI3 MkVectorI3B(Byte x, Byte y, Byte z)
{
VectorI3 V;
V.x = (Int32)(x);
V.y = (Int32)(y);
V.z = (Int32)(z);
return V;
}
inline VectorI3 MkVectorI3B(Byte A)
{
VectorI3 V;
V.x = (Int32)(A);
V.y = (Int32)(A);
V.z = (Int32)(A);
return V;
}
inline VectorI3 MkVectorI3D(Double x, Double y, Double z)
{
VectorI3 V;
V.x = FloorID(x);
V.y = FloorID(y);
V.z = FloorID(z);
return V;
}
inline VectorI3 MkVectorI3D(Double A)
{
VectorI3 V;
V.x = FloorID(A);
V.y = FloorID(A);
V.z = FloorID(A);
return V;
}
inline VectorI3 MkVectorI3F(Single x, Single y, Single z)
{
VectorI3 V;
V.x = FloorIF(x);
V.y = FloorIF(y);
V.z = FloorIF(z);
return V;
}
inline VectorI3 MkVectorI3F(Single A)
{
VectorI3 V;
V.x = FloorIF(A);
V.y = FloorIF(A);
V.z = FloorIF(A);
return V;
}
inline VectorI4 MkVectorI4(Int32 x, Int32 y, Int32 z, Int32 w)
{
VectorI4 V;
V.x = (Int32)(x);
V.y = (Int32)(y);
V.z = (Int32)(z);
V.w = (Int32)(w);
return V;
}
inline VectorI4 MkVectorI4(Int32 A)
{
VectorI4 V;
V.x = (Int32)(A);
V.y = (Int32)(A);
V.z = (Int32)(A);
V.w = (Int32)(A);
return V;
}
inline VectorI4 MkVectorI4B(Byte x, Byte y, Byte z, Byte w)
{
VectorI4 V;
V.x = (Int32)(x);
V.y = (Int32)(y);
V.z = (Int32)(z);
V.w = (Int32)(w);
return V;
}
inline VectorI4 MkVectorI4B(Byte A)
{
VectorI4 V;
V.x = (Int32)(A);
V.y = (Int32)(A);
V.z = (Int32)(A);
V.w = (Int32)(A);
return V;
}
inline VectorI4 MkVectorI4D(Double x, Double y, Double z, Double w)
{
VectorI4 V;
V.x = FloorID(x);
V.y = FloorID(y);
V.z = FloorID(z);
V.w = FloorID(w);
return V;
}
inline VectorI4 MkVectorI4D(Double A)
{
VectorI4 V;
V.x = FloorID(A);
V.y = FloorID(A);
V.z = FloorID(A);
V.w = FloorID(A);
return V;
}
inline VectorI4 MkVectorI4F(Single x, Single y, Single z, Single w)
{
VectorI4 V;
V.x = FloorIF(x);
V.y = FloorIF(y);
V.z = FloorIF(z);
V.w = FloorIF(w);
return V;
}
inline VectorI4 MkVectorI4F(Single A)
{
VectorI4 V;
V.x = FloorIF(A);
V.y = FloorIF(A);
V.z = FloorIF(A);
V.w = FloorIF(A);
return V;
}
inline VectorB2 MkVectorB2I(Int32 x, Int32 y)
{
VectorB2 V;
V.x = (Byte)(x);
V.y = (Byte)(y);
return V;
}
inline VectorB2 MkVectorB2I(Int32 A)
{
VectorB2 V;
V.x = (Byte)(A);
V.y = (Byte)(A);
return V;
}
inline VectorB2 MkVectorB2(Byte x, Byte y)
{
VectorB2 V;
V.x = (Byte)(x);
V.y = (Byte)(y);
return V;
}
inline VectorB2 MkVectorB2(Byte A)
{
VectorB2 V;
V.x = (Byte)(A);
V.y = (Byte)(A);
return V;
}
inline VectorB2 MkVectorB2D(Double x, Double y)
{
VectorB2 V;
V.x = FloorBD(x);
V.y = FloorBD(y);
return V;
}
inline VectorB2 MkVectorB2D(Double A)
{
VectorB2 V;
V.x = FloorBD(A);
V.y = FloorBD(A);
return V;
}
inline VectorB2 MkVectorB2F(Single x, Single y)
{
VectorB2 V;
V.x = FloorBF(x);
V.y = FloorBF(y);
return V;
}
inline VectorB2 MkVectorB2F(Single A)
{
VectorB2 V;
V.x = FloorBF(A);
V.y = FloorBF(A);
return V;
}
inline VectorB3 MkVectorB3I(Int32 x, Int32 y, Int32 z)
{
VectorB3 V;
V.x = (Byte)(x);
V.y = (Byte)(y);
V.z = (Byte)(z);
return V;
}
inline VectorB3 MkVectorB3I(Int32 A)
{
VectorB3 V;
V.x = (Byte)(A);
V.y = (Byte)(A);
V.z = (Byte)(A);
return V;
}
inline VectorB3 MkVectorB3(Byte x, Byte y, Byte z)
{
VectorB3 V;
V.x = (Byte)(x);
V.y = (Byte)(y);
V.z = (Byte)(z);
return V;
}
inline VectorB3 MkVectorB3(Byte A)
{
VectorB3 V;
V.x = (Byte)(A);
V.y = (Byte)(A);
V.z = (Byte)(A);
return V;
}
inline VectorB3 MkVectorB3D(Double x, Double y, Double z)
{
VectorB3 V;
V.x = FloorBD(x);
V.y = FloorBD(y);
V.z = FloorBD(z);
return V;
}
inline VectorB3 MkVectorB3D(Double A)
{
VectorB3 V;
V.x = FloorBD(A);
V.y = FloorBD(A);
V.z = FloorBD(A);
return V;
}
inline VectorB3 MkVectorB3F(Single x, Single y, Single z)
{
VectorB3 V;
V.x = FloorBF(x);
V.y = FloorBF(y);
V.z = FloorBF(z);
return V;
}
inline VectorB3 MkVectorB3F(Single A)
{
VectorB3 V;
V.x = FloorBF(A);
V.y = FloorBF(A);
V.z = FloorBF(A);
return V;
}
inline VectorB4 MkVectorB4I(Int32 x, Int32 y, Int32 z, Int32 w)
{
VectorB4 V;
V.x = (Byte)(x);
V.y = (Byte)(y);
V.z = (Byte)(z);
V.w = (Byte)(w);
return V;
}
inline VectorB4 MkVectorB4I(Int32 A)
{
VectorB4 V;
V.x = (Byte)(A);
V.y = (Byte)(A);
V.z = (Byte)(A);
V.w = (Byte)(A);
return V;
}
inline VectorB4 MkVectorB4(Byte x, Byte y, Byte z, Byte w)
{
VectorB4 V;
V.x = (Byte)(x);
V.y = (Byte)(y);
V.z = (Byte)(z);
V.w = (Byte)(w);
return V;
}
inline VectorB4 MkVectorB4(Byte A)
{
VectorB4 V;
V.x = (Byte)(A);
V.y = (Byte)(A);
V.z = (Byte)(A);
V.w = (Byte)(A);
return V;
}
inline VectorB4 MkVectorB4D(Double x, Double y, Double z, Double w)
{
VectorB4 V;
V.x = FloorBD(x);
V.y = FloorBD(y);
V.z = FloorBD(z);
V.w = FloorBD(w);
return V;
}
inline VectorB4 MkVectorB4D(Double A)
{
VectorB4 V;
V.x = FloorBD(A);
V.y = FloorBD(A);
V.z = FloorBD(A);
V.w = FloorBD(A);
return V;
}
inline VectorB4 MkVectorB4F(Single x, Single y, Single z, Single w)
{
VectorB4 V;
V.x = FloorBF(x);
V.y = FloorBF(y);
V.z = FloorBF(z);
V.w = FloorBF(w);
return V;
}
inline VectorB4 MkVectorB4F(Single A)
{
VectorB4 V;
V.x = FloorBF(A);
V.y = FloorBF(A);
V.z = FloorBF(A);
V.w = FloorBF(A);
return V;
}
inline VectorD2 MkVectorD2I(Int32 x, Int32 y)
{
VectorD2 V;
V.x = (Double)(x);
V.y = (Double)(y);
return V;
}
inline VectorD2 MkVectorD2I(Int32 A)
{
VectorD2 V;
V.x = (Double)(A);
V.y = (Double)(A);
return V;
}
inline VectorD2 MkVectorD2B(Byte x, Byte y)
{
VectorD2 V;
V.x = (Double)(x);
V.y = (Double)(y);
return V;
}
inline VectorD2 MkVectorD2B(Byte A)
{
VectorD2 V;
V.x = (Double)(A);
V.y = (Double)(A);
return V;
}
inline VectorD2 MkVectorD2(Double x, Double y)
{
VectorD2 V;
V.x = (Double)(x);
V.y = (Double)(y);
return V;
}
inline VectorD2 MkVectorD2(Double A)
{
VectorD2 V;
V.x = (Double)(A);
V.y = (Double)(A);
return V;
}
inline VectorD2 MkVectorD2F(Single x, Single y)
{
VectorD2 V;
V.x = (Double)(x);
V.y = (Double)(y);
return V;
}
inline VectorD2 MkVectorD2F(Single A)
{
VectorD2 V;
V.x = (Double)(A);
V.y = (Double)(A);
return V;
}
inline VectorD3 MkVectorD3I(Int32 x, Int32 y, Int32 z)
{
VectorD3 V;
V.x = (Double)(x);
V.y = (Double)(y);
V.z = (Double)(z);
return V;
}
inline VectorD3 MkVectorD3I(Int32 A)
{
VectorD3 V;
V.x = (Double)(A);
V.y = (Double)(A);
V.z = (Double)(A);
return V;
}
inline VectorD3 MkVectorD3B(Byte x, Byte y, Byte z)
{
VectorD3 V;
V.x = (Double)(x);
V.y = (Double)(y);
V.z = (Double)(z);
return V;
}
inline VectorD3 MkVectorD3B(Byte A)
{
VectorD3 V;
V.x = (Double)(A);
V.y = (Double)(A);
V.z = (Double)(A);
return V;
}
inline VectorD3 MkVectorD3(Double x, Double y, Double z)
{
VectorD3 V;
V.x = (Double)(x);
V.y = (Double)(y);
V.z = (Double)(z);
return V;
}
inline VectorD3 MkVectorD3(Double A)
{
VectorD3 V;
V.x = (Double)(A);
V.y = (Double)(A);
V.z = (Double)(A);
return V;
}
inline VectorD3 MkVectorD3F(Single x, Single y, Single z)
{
VectorD3 V;
V.x = (Double)(x);
V.y = (Double)(y);
V.z = (Double)(z);
return V;
}
inline VectorD3 MkVectorD3F(Single A)
{
VectorD3 V;
V.x = (Double)(A);
V.y = (Double)(A);
V.z = (Double)(A);
return V;
}
inline VectorD4 MkVectorD4I(Int32 x, Int32 y, Int32 z, Int32 w)
{
VectorD4 V;
V.x = (Double)(x);
V.y = (Double)(y);
V.z = (Double)(z);
V.w = (Double)(w);
return V;
}
inline VectorD4 MkVectorD4I(Int32 A)
{
VectorD4 V;
V.x = (Double)(A);
V.y = (Double)(A);
V.z = (Double)(A);
V.w = (Double)(A);
return V;
}
inline VectorD4 MkVectorD4B(Byte x, Byte y, Byte z, Byte w)
{
VectorD4 V;
V.x = (Double)(x);
V.y = (Double)(y);
V.z = (Double)(z);
V.w = (Double)(w);
return V;
}
inline VectorD4 MkVectorD4B(Byte A)
{
VectorD4 V;
V.x = (Double)(A);
V.y = (Double)(A);
V.z = (Double)(A);
V.w = (Double)(A);
return V;
}
inline VectorD4 MkVectorD4(Double x, Double y, Double z, Double w)
{
VectorD4 V;
V.x = (Double)(x);
V.y = (Double)(y);
V.z = (Double)(z);
V.w = (Double)(w);
return V;
}
inline VectorD4 MkVectorD4(Double A)
{
VectorD4 V;
V.x = (Double)(A);
V.y = (Double)(A);
V.z = (Double)(A);
V.w = (Double)(A);
return V;
}
inline VectorD4 MkVectorD4F(Single x, Single y, Single z, Single w)
{
VectorD4 V;
V.x = (Double)(x);
V.y = (Double)(y);
V.z = (Double)(z);
V.w = (Double)(w);
return V;
}
inline VectorD4 MkVectorD4F(Single A)
{
VectorD4 V;
V.x = (Double)(A);
V.y = (Double)(A);
V.z = (Double)(A);
V.w = (Double)(A);
return V;
}
inline Vector2 MkVector2I(Int32 x, Int32 y)
{
Vector2 V;
V.x = (Single)(x);
V.y = (Single)(y);
return V;
}
inline Vector2 MkVector2I(Int32 A)
{
Vector2 V;
V.x = (Single)(A);
V.y = (Single)(A);
return V;
}
inline Vector2 MkVector2B(Byte x, Byte y)
{
Vector2 V;
V.x = (Single)(x);
V.y = (Single)(y);
return V;
}
inline Vector2 MkVector2B(Byte A)
{
Vector2 V;
V.x = (Single)(A);
V.y = (Single)(A);
return V;
}
inline Vector2 MkVector2D(Double x, Double y)
{
Vector2 V;
V.x = (Single)(x);
V.y = (Single)(y);
return V;
}
inline Vector2 MkVector2D(Double A)
{
Vector2 V;
V.x = (Single)(A);
V.y = (Single)(A);
return V;
}
inline Vector2 MkVector2(Single x, Single y)
{
Vector2 V;
V.x = (Single)(x);
V.y = (Single)(y);
return V;
}
inline Vector2 MkVector2(Single A)
{
Vector2 V;
V.x = (Single)(A);
V.y = (Single)(A);
return V;
}
inline Vector3 MkVector3I(Int32 x, Int32 y, Int32 z)
{
Vector3 V;
V.x = (Single)(x);
V.y = (Single)(y);
V.z = (Single)(z);
return V;
}
inline Vector3 MkVector3I(Int32 A)
{
Vector3 V;
V.x = (Single)(A);
V.y = (Single)(A);
V.z = (Single)(A);
return V;
}
inline Vector3 MkVector3B(Byte x, Byte y, Byte z)
{
Vector3 V;
V.x = (Single)(x);
V.y = (Single)(y);
V.z = (Single)(z);
return V;
}
inline Vector3 MkVector3B(Byte A)
{
Vector3 V;
V.x = (Single)(A);
V.y = (Single)(A);
V.z = (Single)(A);
return V;
}
inline Vector3 MkVector3D(Double x, Double y, Double z)
{
Vector3 V;
V.x = (Single)(x);
V.y = (Single)(y);
V.z = (Single)(z);
return V;
}
inline Vector3 MkVector3D(Double A)
{
Vector3 V;
V.x = (Single)(A);
V.y = (Single)(A);
V.z = (Single)(A);
return V;
}
inline Vector3 MkVector3(Single x, Single y, Single z)
{
Vector3 V;
V.x = (Single)(x);
V.y = (Single)(y);
V.z = (Single)(z);
return V;
}
inline Vector3 MkVector3(Single A)
{
Vector3 V;
V.x = (Single)(A);
V.y = (Single)(A);
V.z = (Single)(A);
return V;
}
inline Vector4 MkVector4I(Int32 x, Int32 y, Int32 z, Int32 w)
{
Vector4 V;
V.x = (Single)(x);
V.y = (Single)(y);
V.z = (Single)(z);
V.w = (Single)(w);
return V;
}
inline Vector4 MkVector4I(Int32 A)
{
Vector4 V;
V.x = (Single)(A);
V.y = (Single)(A);
V.z = (Single)(A);
V.w = (Single)(A);
return V;
}
inline Vector4 MkVector4B(Byte x, Byte y, Byte z, Byte w)
{
Vector4 V;
V.x = (Single)(x);
V.y = (Single)(y);
V.z = (Single)(z);
V.w = (Single)(w);
return V;
}
inline Vector4 MkVector4B(Byte A)
{
Vector4 V;
V.x = (Single)(A);
V.y = (Single)(A);
V.z = (Single)(A);
V.w = (Single)(A);
return V;
}
inline Vector4 MkVector4D(Double x, Double y, Double z, Double w)
{
Vector4 V;
V.x = (Single)(x);
V.y = (Single)(y);
V.z = (Single)(z);
V.w = (Single)(w);
return V;
}
inline Vector4 MkVector4D(Double A)
{
Vector4 V;
V.x = (Single)(A);
V.y = (Single)(A);
V.z = (Single)(A);
V.w = (Single)(A);
return V;
}
inline Vector4 MkVector4(Single x, Single y, Single z, Single w)
{
Vector4 V;
V.x = (Single)(x);
V.y = (Single)(y);
V.z = (Single)(z);
V.w = (Single)(w);
return V;
}
inline Vector4 MkVector4(Single A)
{
Vector4 V;
V.x = (Single)(A);
V.y = (Single)(A);
V.z = (Single)(A);
V.w = (Single)(A);
return V;
}
// Constructors from other vectors. Float converts to int using floor
inline VectorI2 MkVectorI2B(VectorB2 V)
{
return MkVectorI2B(V.x, V.y);
}
inline VectorI2 MkVectorI2D(VectorD2 V)
{
return MkVectorI2D(V.x, V.y);
}
inline VectorI2 MkVectorI2F(Vector2 V)
{
return MkVectorI2F(V.x, V.y);
}
inline VectorI3 MkVectorI3B(VectorB3 V)
{
return MkVectorI3B(V.x, V.y, V.z);
}
inline VectorI3 MkVectorI3D(VectorD3 V)
{
return MkVectorI3D(V.x, V.y, V.z);
}
inline VectorI3 MkVectorI3F(Vector3 V)
{
return MkVectorI3F(V.x, V.y, V.z);
}
inline VectorI4 MkVectorI4B(VectorB4 V)
{
return MkVectorI4B(V.x, V.y, V.z, V.w);
}
inline VectorI4 MkVectorI4D(VectorD4 V)
{
return MkVectorI4D(V.x, V.y, V.z, V.w);
}
inline VectorI4 MkVectorI4F(Vector4 V)
{
return MkVectorI4F(V.x, V.y, V.z, V.w);
}
inline VectorB2 MkVectorB2I(VectorI2 V)
{
return MkVectorB2I(V.x, V.y);
}
inline VectorB2 MkVectorB2D(VectorD2 V)
{
return MkVectorB2D(V.x, V.y);
}
inline VectorB2 MkVectorB2F(Vector2 V)
{
return MkVectorB2F(V.x, V.y);
}
inline VectorB3 MkVectorB3I(VectorI3 V)
{
return MkVectorB3I(V.x, V.y, V.z);
}
inline VectorB3 MkVectorB3D(VectorD3 V)
{
return MkVectorB3D(V.x, V.y, V.z);
}
inline VectorB3 MkVectorB3F(Vector3 V)
{
return MkVectorB3F(V.x, V.y, V.z);
}
inline VectorB4 MkVectorB4I(VectorI4 V)
{
return MkVectorB4I(V.x, V.y, V.z, V.w);
}
inline VectorB4 MkVectorB4D(VectorD4 V)
{
return MkVectorB4D(V.x, V.y, V.z, V.w);
}
inline VectorB4 MkVectorB4F(Vector4 V)
{
return MkVectorB4F(V.x, V.y, V.z, V.w);
}
inline VectorD2 MkVectorD2I(VectorI2 V)
{
return MkVectorD2I(V.x, V.y);
}
inline VectorD2 MkVectorD2B(VectorB2 V)
{
return MkVectorD2B(V.x, V.y);
}
inline VectorD2 MkVectorD2F(Vector2 V)
{
return MkVectorD2F(V.x, V.y);
}
inline VectorD3 MkVectorD3I(VectorI3 V)
{
return MkVectorD3I(V.x, V.y, V.z);
}
inline VectorD3 MkVectorD3B(VectorB3 V)
{
return MkVectorD3B(V.x, V.y, V.z);
}
inline VectorD3 MkVectorD3F(Vector3 V)
{
return MkVectorD3F(V.x, V.y, V.z);
}
inline VectorD4 MkVectorD4I(VectorI4 V)
{
return MkVectorD4I(V.x, V.y, V.z, V.w);
}
inline VectorD4 MkVectorD4B(VectorB4 V)
{
return MkVectorD4B(V.x, V.y, V.z, V.w);
}
inline VectorD4 MkVectorD4F(Vector4 V)
{
return MkVectorD4F(V.x, V.y, V.z, V.w);
}
inline Vector2 MkVector2I(VectorI2 V)
{
return MkVector2I(V.x, V.y);
}
inline Vector2 MkVector2B(VectorB2 V)
{
return MkVector2B(V.x, V.y);
}
inline Vector2 MkVector2D(VectorD2 V)
{
return MkVector2D(V.x, V.y);
}
inline Vector3 MkVector3I(VectorI3 V)
{
return MkVector3I(V.x, V.y, V.z);
}
inline Vector3 MkVector3B(VectorB3 V)
{
return MkVector3B(V.x, V.y, V.z);
}
inline Vector3 MkVector3D(VectorD3 V)
{
return MkVector3D(V.x, V.y, V.z);
}
inline Vector4 MkVector4I(VectorI4 V)
{
return MkVector4I(V.x, V.y, V.z, V.w);
}
inline Vector4 MkVector4B(VectorB4 V)
{
return MkVector4B(V.x, V.y, V.z, V.w);
}
inline Vector4 MkVector4D(VectorD4 V)
{
return MkVector4D(V.x, V.y, V.z, V.w);
}
// Constructors from ceiling rather than floor
inline VectorI2 CeilVectorI2D(VectorD2 V)
{
return MkVectorI2D(CeilID(V.x), CeilID(V.y));
}
inline VectorI2 CeilVectorI2F(Vector2 V)
{
return MkVectorI2F(CeilIF(V.x), CeilIF(V.y));
}
inline VectorI3 CeilVectorI3D(VectorD3 V)
{
return MkVectorI3D(CeilID(V.x), CeilID(V.y), CeilID(V.z));
}
inline VectorI3 CeilVectorI3F(Vector3 V)
{
return MkVectorI3F(CeilIF(V.x), CeilIF(V.y), CeilIF(V.z));
}
inline VectorI4 CeilVectorI4D(VectorD4 V)
{
return MkVectorI4D(CeilID(V.x), CeilID(V.y), CeilID(V.z), CeilID(V.w));
}
inline VectorI4 CeilVectorI4F(Vector4 V)
{
return MkVectorI4F(CeilIF(V.x), CeilIF(V.y), CeilIF(V.z), CeilIF(V.w));
}
inline VectorB2 CeilVectorB2D(VectorD2 V)
{
return MkVectorB2D(CeilBD(V.x), CeilBD(V.y));
}
inline VectorB2 CeilVectorB2F(Vector2 V)
{
return MkVectorB2F(CeilBF(V.x), CeilBF(V.y));
}
inline VectorB3 CeilVectorB3D(VectorD3 V)
{
return MkVectorB3D(CeilBD(V.x), CeilBD(V.y), CeilBD(V.z));
}
inline VectorB3 CeilVectorB3F(Vector3 V)
{
return MkVectorB3F(CeilBF(V.x), CeilBF(V.y), CeilBF(V.z));
}
inline VectorB4 CeilVectorB4D(VectorD4 V)
{
return MkVectorB4D(CeilBD(V.x), CeilBD(V.y), CeilBD(V.z), CeilBD(V.w));
}
inline VectorB4 CeilVectorB4F(Vector4 V)
{
return MkVectorB4F(CeilBF(V.x), CeilBF(V.y), CeilBF(V.z), CeilBF(V.w));
}
// Equality operator
inline Boolean operator==(VectorI2 A, VectorI2 B)
{
return (A.x == B.x)
&& (A.y == B.y);
}
inline Boolean operator==(VectorI3 A, VectorI3 B)
{
return (A.x == B.x)
&& (A.y == B.y)
&& (A.z == B.z);
}
inline Boolean operator==(VectorI4 A, VectorI4 B)
{
return (A.x == B.x)
&& (A.y == B.y)
&& (A.z == B.z)
&& (A.w == B.w);
}
inline Boolean operator==(VectorB2 A, VectorB2 B)
{
return (A.x == B.x)
&& (A.y == B.y);
}
inline Boolean operator==(VectorB3 A, VectorB3 B)
{
return (A.x == B.x)
&& (A.y == B.y)
&& (A.z == B.z);
}
inline Boolean operator==(VectorB4 A, VectorB4 B)
{
return (A.x == B.x)
&& (A.y == B.y)
&& (A.z == B.z)
&& (A.w == B.w);
}
inline Boolean operator==(VectorD2 A, VectorD2 B)
{
return (A.x == B.x)
&& (A.y == B.y);
}
inline Boolean operator==(VectorD3 A, VectorD3 B)
{
return (A.x == B.x)
&& (A.y == B.y)
&& (A.z == B.z);
}
inline Boolean operator==(VectorD4 A, VectorD4 B)
{
return (A.x == B.x)
&& (A.y == B.y)
&& (A.z == B.z)
&& (A.w == B.w);
}
inline Boolean operator==(Vector2 A, Vector2 B)
{
return (A.x == B.x)
&& (A.y == B.y);
}
inline Boolean operator==(Vector3 A, Vector3 B)
{
return (A.x == B.x)
&& (A.y == B.y)
&& (A.z == B.z);
}
inline Boolean operator==(Vector4 A, Vector4 B)
{
return (A.x == B.x)
&& (A.y == B.y)
&& (A.z == B.z)
&& (A.w == B.w);
}
// Inequality operator
inline Boolean operator!=(VectorI2 A, VectorI2 B)
{
return (A.x != B.x)
|| (A.y != B.y);
}
inline Boolean operator!=(VectorI3 A, VectorI3 B)
{
return (A.x != B.x)
|| (A.y != B.y)
|| (A.z != B.z);
}
inline Boolean operator!=(VectorI4 A, VectorI4 B)
{
return (A.x != B.x)
|| (A.y != B.y)
|| (A.z != B.z)
|| (A.w != B.w);
}
inline Boolean operator!=(VectorB2 A, VectorB2 B)
{
return (A.x != B.x)
|| (A.y != B.y);
}
inline Boolean operator!=(VectorB3 A, VectorB3 B)
{
return (A.x != B.x)
|| (A.y != B.y)
|| (A.z != B.z);
}
inline Boolean operator!=(VectorB4 A, VectorB4 B)
{
return (A.x != B.x)
|| (A.y != B.y)
|| (A.z != B.z)
|| (A.w != B.w);
}
inline Boolean operator!=(VectorD2 A, VectorD2 B)
{
return (A.x != B.x)
|| (A.y != B.y);
}
inline Boolean operator!=(VectorD3 A, VectorD3 B)
{
return (A.x != B.x)
|| (A.y != B.y)
|| (A.z != B.z);
}
inline Boolean operator!=(VectorD4 A, VectorD4 B)
{
return (A.x != B.x)
|| (A.y != B.y)
|| (A.z != B.z)
|| (A.w != B.w);
}
inline Boolean operator!=(Vector2 A, Vector2 B)
{
return (A.x != B.x)
|| (A.y != B.y);
}
inline Boolean operator!=(Vector3 A, Vector3 B)
{
return (A.x != B.x)
|| (A.y != B.y)
|| (A.z != B.z);
}
inline Boolean operator!=(Vector4 A, Vector4 B)
{
return (A.x != B.x)
|| (A.y != B.y)
|| (A.z != B.z)
|| (A.w != B.w);
}
// Evaluate whether all terms are greater than, less than, greater than or equal, less than or equal
inline Boolean StrictGt(VectorI2 A, VectorI2 B)
{
return (A.x > B.x)
&& (A.y > B.y);
}
inline Boolean StrictGt(VectorI3 A, VectorI3 B)
{
return (A.x > B.x)
&& (A.y > B.y)
&& (A.z > B.z);
}
inline Boolean StrictGt(VectorI4 A, VectorI4 B)
{
return (A.x > B.x)
&& (A.y > B.y)
&& (A.z > B.z)
&& (A.w > B.w);
}
inline Boolean StrictGt(VectorB2 A, VectorB2 B)
{
return (A.x > B.x)
&& (A.y > B.y);
}
inline Boolean StrictGt(VectorB3 A, VectorB3 B)
{
return (A.x > B.x)
&& (A.y > B.y)
&& (A.z > B.z);
}
inline Boolean StrictGt(VectorB4 A, VectorB4 B)
{
return (A.x > B.x)
&& (A.y > B.y)
&& (A.z > B.z)
&& (A.w > B.w);
}
inline Boolean StrictGt(VectorD2 A, VectorD2 B)
{
return (A.x > B.x)
&& (A.y > B.y);
}
inline Boolean StrictGt(VectorD3 A, VectorD3 B)
{
return (A.x > B.x)
&& (A.y > B.y)
&& (A.z > B.z);
}
inline Boolean StrictGt(VectorD4 A, VectorD4 B)
{
return (A.x > B.x)
&& (A.y > B.y)
&& (A.z > B.z)
&& (A.w > B.w);
}
inline Boolean StrictGt(Vector2 A, Vector2 B)
{
return (A.x > B.x)
&& (A.y > B.y);
}
inline Boolean StrictGt(Vector3 A, Vector3 B)
{
return (A.x > B.x)
&& (A.y > B.y)
&& (A.z > B.z);
}
inline Boolean StrictGt(Vector4 A, Vector4 B)
{
return (A.x > B.x)
&& (A.y > B.y)
&& (A.z > B.z)
&& (A.w > B.w);
}
inline Boolean StrictLt(VectorI2 A, VectorI2 B)
{
return (A.x < B.x)
&& (A.y < B.y);
}
inline Boolean StrictLt(VectorI3 A, VectorI3 B)
{
return (A.x < B.x)
&& (A.y < B.y)
&& (A.z < B.z);
}
inline Boolean StrictLt(VectorI4 A, VectorI4 B)
{
return (A.x < B.x)
&& (A.y < B.y)
&& (A.z < B.z)
&& (A.w < B.w);
}
inline Boolean StrictLt(VectorB2 A, VectorB2 B)
{
return (A.x < B.x)
&& (A.y < B.y);
}
inline Boolean StrictLt(VectorB3 A, VectorB3 B)
{
return (A.x < B.x)
&& (A.y < B.y)
&& (A.z < B.z);
}
inline Boolean StrictLt(VectorB4 A, VectorB4 B)
{
return (A.x < B.x)
&& (A.y < B.y)
&& (A.z < B.z)
&& (A.w < B.w);
}
inline Boolean StrictLt(VectorD2 A, VectorD2 B)
{
return (A.x < B.x)
&& (A.y < B.y);
}
inline Boolean StrictLt(VectorD3 A, VectorD3 B)
{
return (A.x < B.x)
&& (A.y < B.y)
&& (A.z < B.z);
}
inline Boolean StrictLt(VectorD4 A, VectorD4 B)
{
return (A.x < B.x)
&& (A.y < B.y)
&& (A.z < B.z)
&& (A.w < B.w);
}
inline Boolean StrictLt(Vector2 A, Vector2 B)
{
return (A.x < B.x)
&& (A.y < B.y);
}
inline Boolean StrictLt(Vector3 A, Vector3 B)
{
return (A.x < B.x)
&& (A.y < B.y)
&& (A.z < B.z);
}
inline Boolean StrictLt(Vector4 A, Vector4 B)
{
return (A.x < B.x)
&& (A.y < B.y)
&& (A.z < B.z)
&& (A.w < B.w);
}
inline Boolean StrictGte(VectorI2 A, VectorI2 B)
{
return (A.x >= B.x)
&& (A.y >= B.y);
}
inline Boolean StrictGte(VectorI3 A, VectorI3 B)
{
return (A.x >= B.x)
&& (A.y >= B.y)
&& (A.z >= B.z);
}
inline Boolean StrictGte(VectorI4 A, VectorI4 B)
{
return (A.x >= B.x)
&& (A.y >= B.y)
&& (A.z >= B.z)
&& (A.w >= B.w);
}
inline Boolean StrictGte(VectorB2 A, VectorB2 B)
{
return (A.x >= B.x)
&& (A.y >= B.y);
}
inline Boolean StrictGte(VectorB3 A, VectorB3 B)
{
return (A.x >= B.x)
&& (A.y >= B.y)
&& (A.z >= B.z);
}
inline Boolean StrictGte(VectorB4 A, VectorB4 B)
{
return (A.x >= B.x)
&& (A.y >= B.y)
&& (A.z >= B.z)
&& (A.w >= B.w);
}
inline Boolean StrictGte(VectorD2 A, VectorD2 B)
{
return (A.x >= B.x)
&& (A.y >= B.y);
}
inline Boolean StrictGte(VectorD3 A, VectorD3 B)
{
return (A.x >= B.x)
&& (A.y >= B.y)
&& (A.z >= B.z);
}
inline Boolean StrictGte(VectorD4 A, VectorD4 B)
{
return (A.x >= B.x)
&& (A.y >= B.y)
&& (A.z >= B.z)
&& (A.w >= B.w);
}
inline Boolean StrictGte(Vector2 A, Vector2 B)
{
return (A.x >= B.x)
&& (A.y >= B.y);
}
inline Boolean StrictGte(Vector3 A, Vector3 B)
{
return (A.x >= B.x)
&& (A.y >= B.y)
&& (A.z >= B.z);
}
inline Boolean StrictGte(Vector4 A, Vector4 B)
{
return (A.x >= B.x)
&& (A.y >= B.y)
&& (A.z >= B.z)
&& (A.w >= B.w);
}
inline Boolean StrictLte(VectorI2 A, VectorI2 B)
{
return (A.x <= B.x)
&& (A.y <= B.y);
}
inline Boolean StrictLte(VectorI3 A, VectorI3 B)
{
return (A.x <= B.x)
&& (A.y <= B.y)
&& (A.z <= B.z);
}
inline Boolean StrictLte(VectorI4 A, VectorI4 B)
{
return (A.x <= B.x)
&& (A.y <= B.y)
&& (A.z <= B.z)
&& (A.w <= B.w);
}
inline Boolean StrictLte(VectorB2 A, VectorB2 B)
{
return (A.x <= B.x)
&& (A.y <= B.y);
}
inline Boolean StrictLte(VectorB3 A, VectorB3 B)
{
return (A.x <= B.x)
&& (A.y <= B.y)
&& (A.z <= B.z);
}
inline Boolean StrictLte(VectorB4 A, VectorB4 B)
{
return (A.x <= B.x)
&& (A.y <= B.y)
&& (A.z <= B.z)
&& (A.w <= B.w);
}
inline Boolean StrictLte(VectorD2 A, VectorD2 B)
{
return (A.x <= B.x)
&& (A.y <= B.y);
}
inline Boolean StrictLte(VectorD3 A, VectorD3 B)
{
return (A.x <= B.x)
&& (A.y <= B.y)
&& (A.z <= B.z);
}
inline Boolean StrictLte(VectorD4 A, VectorD4 B)
{
return (A.x <= B.x)
&& (A.y <= B.y)
&& (A.z <= B.z)
&& (A.w <= B.w);
}
inline Boolean StrictLte(Vector2 A, Vector2 B)
{
return (A.x <= B.x)
&& (A.y <= B.y);
}
inline Boolean StrictLte(Vector3 A, Vector3 B)
{
return (A.x <= B.x)
&& (A.y <= B.y)
&& (A.z <= B.z);
}
inline Boolean StrictLte(Vector4 A, Vector4 B)
{
return (A.x <= B.x)
&& (A.y <= B.y)
&& (A.z <= B.z)
&& (A.w <= B.w);
}
// Addition operator
inline VectorI2 operator+(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(A.x + B.x),
(Int32)(A.y + B.y));
}
inline VectorI3 operator+(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(A.x + B.x),
(Int32)(A.y + B.y),
(Int32)(A.z + B.z));
}
inline VectorI4 operator+(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(A.x + B.x),
(Int32)(A.y + B.y),
(Int32)(A.z + B.z),
(Int32)(A.w + B.w));
}
inline VectorB2 operator+(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(A.x + B.x),
(Byte)(A.y + B.y));
}
inline VectorB3 operator+(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(A.x + B.x),
(Byte)(A.y + B.y),
(Byte)(A.z + B.z));
}
inline VectorB4 operator+(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(A.x + B.x),
(Byte)(A.y + B.y),
(Byte)(A.z + B.z),
(Byte)(A.w + B.w));
}
inline VectorD2 operator+(VectorD2 A, VectorD2 B)
{
return MkVectorD2(
(Double)(A.x + B.x),
(Double)(A.y + B.y));
}
inline VectorD3 operator+(VectorD3 A, VectorD3 B)
{
return MkVectorD3(
(Double)(A.x + B.x),
(Double)(A.y + B.y),
(Double)(A.z + B.z));
}
inline VectorD4 operator+(VectorD4 A, VectorD4 B)
{
return MkVectorD4(
(Double)(A.x + B.x),
(Double)(A.y + B.y),
(Double)(A.z + B.z),
(Double)(A.w + B.w));
}
inline Vector2 operator+(Vector2 A, Vector2 B)
{
return MkVector2(
(Single)(A.x + B.x),
(Single)(A.y + B.y));
}
inline Vector3 operator+(Vector3 A, Vector3 B)
{
return MkVector3(
(Single)(A.x + B.x),
(Single)(A.y + B.y),
(Single)(A.z + B.z));
}
inline Vector4 operator+(Vector4 A, Vector4 B)
{
return MkVector4(
(Single)(A.x + B.x),
(Single)(A.y + B.y),
(Single)(A.z + B.z),
(Single)(A.w + B.w));
}
// Subtraction operator
inline VectorI2 operator-(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(A.x - B.x),
(Int32)(A.y - B.y));
}
inline VectorI3 operator-(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(A.x - B.x),
(Int32)(A.y - B.y),
(Int32)(A.z - B.z));
}
inline VectorI4 operator-(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(A.x - B.x),
(Int32)(A.y - B.y),
(Int32)(A.z - B.z),
(Int32)(A.w - B.w));
}
inline VectorB2 operator-(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(A.x - B.x),
(Byte)(A.y - B.y));
}
inline VectorB3 operator-(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(A.x - B.x),
(Byte)(A.y - B.y),
(Byte)(A.z - B.z));
}
inline VectorB4 operator-(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(A.x - B.x),
(Byte)(A.y - B.y),
(Byte)(A.z - B.z),
(Byte)(A.w - B.w));
}
inline VectorD2 operator-(VectorD2 A, VectorD2 B)
{
return MkVectorD2(
(Double)(A.x - B.x),
(Double)(A.y - B.y));
}
inline VectorD3 operator-(VectorD3 A, VectorD3 B)
{
return MkVectorD3(
(Double)(A.x - B.x),
(Double)(A.y - B.y),
(Double)(A.z - B.z));
}
inline VectorD4 operator-(VectorD4 A, VectorD4 B)
{
return MkVectorD4(
(Double)(A.x - B.x),
(Double)(A.y - B.y),
(Double)(A.z - B.z),
(Double)(A.w - B.w));
}
inline Vector2 operator-(Vector2 A, Vector2 B)
{
return MkVector2(
(Single)(A.x - B.x),
(Single)(A.y - B.y));
}
inline Vector3 operator-(Vector3 A, Vector3 B)
{
return MkVector3(
(Single)(A.x - B.x),
(Single)(A.y - B.y),
(Single)(A.z - B.z));
}
inline Vector4 operator-(Vector4 A, Vector4 B)
{
return MkVector4(
(Single)(A.x - B.x),
(Single)(A.y - B.y),
(Single)(A.z - B.z),
(Single)(A.w - B.w));
}
// Elementwise multiplication (equivalent to Scale() in Unity)
inline VectorI2 ElMult(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(A.x * B.x),
(Int32)(A.y * B.y));
}
inline VectorI3 ElMult(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(A.x * B.x),
(Int32)(A.y * B.y),
(Int32)(A.z * B.z));
}
inline VectorI4 ElMult(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(A.x * B.x),
(Int32)(A.y * B.y),
(Int32)(A.z * B.z),
(Int32)(A.w * B.w));
}
inline VectorB2 ElMult(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(A.x * B.x),
(Byte)(A.y * B.y));
}
inline VectorB3 ElMult(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(A.x * B.x),
(Byte)(A.y * B.y),
(Byte)(A.z * B.z));
}
inline VectorB4 ElMult(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(A.x * B.x),
(Byte)(A.y * B.y),
(Byte)(A.z * B.z),
(Byte)(A.w * B.w));
}
inline VectorD2 ElMult(VectorD2 A, VectorD2 B)
{
return MkVectorD2(
(Double)(A.x * B.x),
(Double)(A.y * B.y));
}
inline VectorD3 ElMult(VectorD3 A, VectorD3 B)
{
return MkVectorD3(
(Double)(A.x * B.x),
(Double)(A.y * B.y),
(Double)(A.z * B.z));
}
inline VectorD4 ElMult(VectorD4 A, VectorD4 B)
{
return MkVectorD4(
(Double)(A.x * B.x),
(Double)(A.y * B.y),
(Double)(A.z * B.z),
(Double)(A.w * B.w));
}
inline Vector2 ElMult(Vector2 A, Vector2 B)
{
return MkVector2(
(Single)(A.x * B.x),
(Single)(A.y * B.y));
}
inline Vector3 ElMult(Vector3 A, Vector3 B)
{
return MkVector3(
(Single)(A.x * B.x),
(Single)(A.y * B.y),
(Single)(A.z * B.z));
}
inline Vector4 ElMult(Vector4 A, Vector4 B)
{
return MkVector4(
(Single)(A.x * B.x),
(Single)(A.y * B.y),
(Single)(A.z * B.z),
(Single)(A.w * B.w));
}
// Elementwise division. Uses floor.
inline VectorI2 ElDiv(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(Div(A.x, B.x)),
(Int32)(Div(A.y, B.y)));
}
inline VectorI3 ElDiv(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(Div(A.x, B.x)),
(Int32)(Div(A.y, B.y)),
(Int32)(Div(A.z, B.z)));
}
inline VectorI4 ElDiv(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(Div(A.x, B.x)),
(Int32)(Div(A.y, B.y)),
(Int32)(Div(A.z, B.z)),
(Int32)(Div(A.w, B.w)));
}
inline VectorB2 ElDiv(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(Div(A.x, B.x)),
(Byte)(Div(A.y, B.y)));
}
inline VectorB3 ElDiv(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(Div(A.x, B.x)),
(Byte)(Div(A.y, B.y)),
(Byte)(Div(A.z, B.z)));
}
inline VectorB4 ElDiv(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(Div(A.x, B.x)),
(Byte)(Div(A.y, B.y)),
(Byte)(Div(A.z, B.z)),
(Byte)(Div(A.w, B.w)));
}
inline VectorD2 ElDiv(VectorD2 A, VectorD2 B)
{
return MkVectorD2(
(Double)(Div(A.x, B.x)),
(Double)(Div(A.y, B.y)));
}
inline VectorD3 ElDiv(VectorD3 A, VectorD3 B)
{
return MkVectorD3(
(Double)(Div(A.x, B.x)),
(Double)(Div(A.y, B.y)),
(Double)(Div(A.z, B.z)));
}
inline VectorD4 ElDiv(VectorD4 A, VectorD4 B)
{
return MkVectorD4(
(Double)(Div(A.x, B.x)),
(Double)(Div(A.y, B.y)),
(Double)(Div(A.z, B.z)),
(Double)(Div(A.w, B.w)));
}
inline Vector2 ElDiv(Vector2 A, Vector2 B)
{
return MkVector2(
(Single)(Div(A.x, B.x)),
(Single)(Div(A.y, B.y)));
}
inline Vector3 ElDiv(Vector3 A, Vector3 B)
{
return MkVector3(
(Single)(Div(A.x, B.x)),
(Single)(Div(A.y, B.y)),
(Single)(Div(A.z, B.z)));
}
inline Vector4 ElDiv(Vector4 A, Vector4 B)
{
return MkVector4(
(Single)(Div(A.x, B.x)),
(Single)(Div(A.y, B.y)),
(Single)(Div(A.z, B.z)),
(Single)(Div(A.w, B.w)));
}
// Elementwise division that uses ceiling instead of floor
inline VectorI2 ElCeilDiv(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(CeilDiv(A.x, B.x)),
(Int32)(CeilDiv(A.y, B.y)));
}
inline VectorI3 ElCeilDiv(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(CeilDiv(A.x, B.x)),
(Int32)(CeilDiv(A.y, B.y)),
(Int32)(CeilDiv(A.z, B.z)));
}
inline VectorI4 ElCeilDiv(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(CeilDiv(A.x, B.x)),
(Int32)(CeilDiv(A.y, B.y)),
(Int32)(CeilDiv(A.z, B.z)),
(Int32)(CeilDiv(A.w, B.w)));
}
inline VectorB2 ElCeilDiv(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(CeilDiv(A.x, B.x)),
(Byte)(CeilDiv(A.y, B.y)));
}
inline VectorB3 ElCeilDiv(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(CeilDiv(A.x, B.x)),
(Byte)(CeilDiv(A.y, B.y)),
(Byte)(CeilDiv(A.z, B.z)));
}
inline VectorB4 ElCeilDiv(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(CeilDiv(A.x, B.x)),
(Byte)(CeilDiv(A.y, B.y)),
(Byte)(CeilDiv(A.z, B.z)),
(Byte)(CeilDiv(A.w, B.w)));
}
// Elementwise min/max
inline VectorI2 ElMin(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(Min(A.x, B.x)),
(Int32)(Min(A.y, B.y)));
}
inline VectorI3 ElMin(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(Min(A.x, B.x)),
(Int32)(Min(A.y, B.y)),
(Int32)(Min(A.z, B.z)));
}
inline VectorI4 ElMin(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(Min(A.x, B.x)),
(Int32)(Min(A.y, B.y)),
(Int32)(Min(A.z, B.z)),
(Int32)(Min(A.w, B.w)));
}
inline VectorB2 ElMin(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(Min(A.x, B.x)),
(Byte)(Min(A.y, B.y)));
}
inline VectorB3 ElMin(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(Min(A.x, B.x)),
(Byte)(Min(A.y, B.y)),
(Byte)(Min(A.z, B.z)));
}
inline VectorB4 ElMin(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(Min(A.x, B.x)),
(Byte)(Min(A.y, B.y)),
(Byte)(Min(A.z, B.z)),
(Byte)(Min(A.w, B.w)));
}
inline VectorD2 ElMin(VectorD2 A, VectorD2 B)
{
return MkVectorD2(
(Double)(Min(A.x, B.x)),
(Double)(Min(A.y, B.y)));
}
inline VectorD3 ElMin(VectorD3 A, VectorD3 B)
{
return MkVectorD3(
(Double)(Min(A.x, B.x)),
(Double)(Min(A.y, B.y)),
(Double)(Min(A.z, B.z)));
}
inline VectorD4 ElMin(VectorD4 A, VectorD4 B)
{
return MkVectorD4(
(Double)(Min(A.x, B.x)),
(Double)(Min(A.y, B.y)),
(Double)(Min(A.z, B.z)),
(Double)(Min(A.w, B.w)));
}
inline Vector2 ElMin(Vector2 A, Vector2 B)
{
return MkVector2(
(Single)(Min(A.x, B.x)),
(Single)(Min(A.y, B.y)));
}
inline Vector3 ElMin(Vector3 A, Vector3 B)
{
return MkVector3(
(Single)(Min(A.x, B.x)),
(Single)(Min(A.y, B.y)),
(Single)(Min(A.z, B.z)));
}
inline Vector4 ElMin(Vector4 A, Vector4 B)
{
return MkVector4(
(Single)(Min(A.x, B.x)),
(Single)(Min(A.y, B.y)),
(Single)(Min(A.z, B.z)),
(Single)(Min(A.w, B.w)));
}
inline VectorI2 ElMax(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(Max(A.x, B.x)),
(Int32)(Max(A.y, B.y)));
}
inline VectorI3 ElMax(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(Max(A.x, B.x)),
(Int32)(Max(A.y, B.y)),
(Int32)(Max(A.z, B.z)));
}
inline VectorI4 ElMax(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(Max(A.x, B.x)),
(Int32)(Max(A.y, B.y)),
(Int32)(Max(A.z, B.z)),
(Int32)(Max(A.w, B.w)));
}
inline VectorB2 ElMax(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(Max(A.x, B.x)),
(Byte)(Max(A.y, B.y)));
}
inline VectorB3 ElMax(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(Max(A.x, B.x)),
(Byte)(Max(A.y, B.y)),
(Byte)(Max(A.z, B.z)));
}
inline VectorB4 ElMax(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(Max(A.x, B.x)),
(Byte)(Max(A.y, B.y)),
(Byte)(Max(A.z, B.z)),
(Byte)(Max(A.w, B.w)));
}
inline VectorD2 ElMax(VectorD2 A, VectorD2 B)
{
return MkVectorD2(
(Double)(Max(A.x, B.x)),
(Double)(Max(A.y, B.y)));
}
inline VectorD3 ElMax(VectorD3 A, VectorD3 B)
{
return MkVectorD3(
(Double)(Max(A.x, B.x)),
(Double)(Max(A.y, B.y)),
(Double)(Max(A.z, B.z)));
}
inline VectorD4 ElMax(VectorD4 A, VectorD4 B)
{
return MkVectorD4(
(Double)(Max(A.x, B.x)),
(Double)(Max(A.y, B.y)),
(Double)(Max(A.z, B.z)),
(Double)(Max(A.w, B.w)));
}
inline Vector2 ElMax(Vector2 A, Vector2 B)
{
return MkVector2(
(Single)(Max(A.x, B.x)),
(Single)(Max(A.y, B.y)));
}
inline Vector3 ElMax(Vector3 A, Vector3 B)
{
return MkVector3(
(Single)(Max(A.x, B.x)),
(Single)(Max(A.y, B.y)),
(Single)(Max(A.z, B.z)));
}
inline Vector4 ElMax(Vector4 A, Vector4 B)
{
return MkVector4(
(Single)(Max(A.x, B.x)),
(Single)(Max(A.y, B.y)),
(Single)(Max(A.z, B.z)),
(Single)(Max(A.w, B.w)));
}
// Elementwise remainder. Uses floor.
inline VectorI2 ElRem(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(Rem(A.x, B.x)),
(Int32)(Rem(A.y, B.y)));
}
inline VectorI3 ElRem(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(Rem(A.x, B.x)),
(Int32)(Rem(A.y, B.y)),
(Int32)(Rem(A.z, B.z)));
}
inline VectorI4 ElRem(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(Rem(A.x, B.x)),
(Int32)(Rem(A.y, B.y)),
(Int32)(Rem(A.z, B.z)),
(Int32)(Rem(A.w, B.w)));
}
inline VectorB2 ElRem(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(Rem(A.x, B.x)),
(Byte)(Rem(A.y, B.y)));
}
inline VectorB3 ElRem(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(Rem(A.x, B.x)),
(Byte)(Rem(A.y, B.y)),
(Byte)(Rem(A.z, B.z)));
}
inline VectorB4 ElRem(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(Rem(A.x, B.x)),
(Byte)(Rem(A.y, B.y)),
(Byte)(Rem(A.z, B.z)),
(Byte)(Rem(A.w, B.w)));
}
// Elementwise multiplication/division/remainder by 2^B_i
inline VectorI2 ElPow2Div(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(Pow2Div(A.x, B.x)),
(Int32)(Pow2Div(A.y, B.y)));
}
inline VectorI3 ElPow2Div(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(Pow2Div(A.x, B.x)),
(Int32)(Pow2Div(A.y, B.y)),
(Int32)(Pow2Div(A.z, B.z)));
}
inline VectorI4 ElPow2Div(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(Pow2Div(A.x, B.x)),
(Int32)(Pow2Div(A.y, B.y)),
(Int32)(Pow2Div(A.z, B.z)),
(Int32)(Pow2Div(A.w, B.w)));
}
inline VectorB2 ElPow2Div(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(Pow2Div(A.x, B.x)),
(Byte)(Pow2Div(A.y, B.y)));
}
inline VectorB3 ElPow2Div(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(Pow2Div(A.x, B.x)),
(Byte)(Pow2Div(A.y, B.y)),
(Byte)(Pow2Div(A.z, B.z)));
}
inline VectorB4 ElPow2Div(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(Pow2Div(A.x, B.x)),
(Byte)(Pow2Div(A.y, B.y)),
(Byte)(Pow2Div(A.z, B.z)),
(Byte)(Pow2Div(A.w, B.w)));
}
inline VectorI2 ElPow2Mult(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(Pow2Mult(A.x, B.x)),
(Int32)(Pow2Mult(A.y, B.y)));
}
inline VectorI3 ElPow2Mult(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(Pow2Mult(A.x, B.x)),
(Int32)(Pow2Mult(A.y, B.y)),
(Int32)(Pow2Mult(A.z, B.z)));
}
inline VectorI4 ElPow2Mult(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(Pow2Mult(A.x, B.x)),
(Int32)(Pow2Mult(A.y, B.y)),
(Int32)(Pow2Mult(A.z, B.z)),
(Int32)(Pow2Mult(A.w, B.w)));
}
inline VectorB2 ElPow2Mult(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(Pow2Mult(A.x, B.x)),
(Byte)(Pow2Mult(A.y, B.y)));
}
inline VectorB3 ElPow2Mult(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(Pow2Mult(A.x, B.x)),
(Byte)(Pow2Mult(A.y, B.y)),
(Byte)(Pow2Mult(A.z, B.z)));
}
inline VectorB4 ElPow2Mult(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(Pow2Mult(A.x, B.x)),
(Byte)(Pow2Mult(A.y, B.y)),
(Byte)(Pow2Mult(A.z, B.z)),
(Byte)(Pow2Mult(A.w, B.w)));
}
inline VectorI2 ElPow2Rem(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(Pow2Rem(A.x, B.x)),
(Int32)(Pow2Rem(A.y, B.y)));
}
inline VectorI3 ElPow2Rem(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(Pow2Rem(A.x, B.x)),
(Int32)(Pow2Rem(A.y, B.y)),
(Int32)(Pow2Rem(A.z, B.z)));
}
inline VectorI4 ElPow2Rem(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(Pow2Rem(A.x, B.x)),
(Int32)(Pow2Rem(A.y, B.y)),
(Int32)(Pow2Rem(A.z, B.z)),
(Int32)(Pow2Rem(A.w, B.w)));
}
inline VectorB2 ElPow2Rem(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(Pow2Rem(A.x, B.x)),
(Byte)(Pow2Rem(A.y, B.y)));
}
inline VectorB3 ElPow2Rem(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(Pow2Rem(A.x, B.x)),
(Byte)(Pow2Rem(A.y, B.y)),
(Byte)(Pow2Rem(A.z, B.z)));
}
inline VectorB4 ElPow2Rem(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(Pow2Rem(A.x, B.x)),
(Byte)(Pow2Rem(A.y, B.y)),
(Byte)(Pow2Rem(A.z, B.z)),
(Byte)(Pow2Rem(A.w, B.w)));
}
inline VectorI2 ElPow2CeilDiv(VectorI2 A, VectorI2 B)
{
return MkVectorI2(
(Int32)(Pow2CeilDiv(A.x, B.x)),
(Int32)(Pow2CeilDiv(A.y, B.y)));
}
inline VectorI3 ElPow2CeilDiv(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(Int32)(Pow2CeilDiv(A.x, B.x)),
(Int32)(Pow2CeilDiv(A.y, B.y)),
(Int32)(Pow2CeilDiv(A.z, B.z)));
}
inline VectorI4 ElPow2CeilDiv(VectorI4 A, VectorI4 B)
{
return MkVectorI4(
(Int32)(Pow2CeilDiv(A.x, B.x)),
(Int32)(Pow2CeilDiv(A.y, B.y)),
(Int32)(Pow2CeilDiv(A.z, B.z)),
(Int32)(Pow2CeilDiv(A.w, B.w)));
}
inline VectorB2 ElPow2CeilDiv(VectorB2 A, VectorB2 B)
{
return MkVectorB2(
(Byte)(Pow2CeilDiv(A.x, B.x)),
(Byte)(Pow2CeilDiv(A.y, B.y)));
}
inline VectorB3 ElPow2CeilDiv(VectorB3 A, VectorB3 B)
{
return MkVectorB3(
(Byte)(Pow2CeilDiv(A.x, B.x)),
(Byte)(Pow2CeilDiv(A.y, B.y)),
(Byte)(Pow2CeilDiv(A.z, B.z)));
}
inline VectorB4 ElPow2CeilDiv(VectorB4 A, VectorB4 B)
{
return MkVectorB4(
(Byte)(Pow2CeilDiv(A.x, B.x)),
(Byte)(Pow2CeilDiv(A.y, B.y)),
(Byte)(Pow2CeilDiv(A.z, B.z)),
(Byte)(Pow2CeilDiv(A.w, B.w)));
}
// Negation (as in Additive Inverse) operator
inline VectorI2 operator-(VectorI2 V)
{
return MkVectorI2(-V.x, -V.y);
}
inline VectorI3 operator-(VectorI3 V)
{
return MkVectorI3(-V.x, -V.y, -V.z);
}
inline VectorI4 operator-(VectorI4 V)
{
return MkVectorI4(-V.x, -V.y, -V.z, -V.w);
}
inline VectorD2 operator-(VectorD2 V)
{
return MkVectorD2(-V.x, -V.y);
}
inline VectorD3 operator-(VectorD3 V)
{
return MkVectorD3(-V.x, -V.y, -V.z);
}
inline VectorD4 operator-(VectorD4 V)
{
return MkVectorD4(-V.x, -V.y, -V.z, -V.w);
}
inline Vector2 operator-(Vector2 V)
{
return MkVector2(-V.x, -V.y);
}
inline Vector3 operator-(Vector3 V)
{
return MkVector3(-V.x, -V.y, -V.z);
}
inline Vector4 operator-(Vector4 V)
{
return MkVector4(-V.x, -V.y, -V.z, -V.w);
}
// Scalar multiplication/division operators
inline VectorI2 operator*(Int32 A, VectorI2 V)
{
return MkVectorI2(
(Int32)((A * V.x)),
(Int32)((A * V.y)));
}
inline VectorI3 operator*(Int32 A, VectorI3 V)
{
return MkVectorI3(
(Int32)((A * V.x)),
(Int32)((A * V.y)),
(Int32)((A * V.z)));
}
inline VectorI4 operator*(Int32 A, VectorI4 V)
{
return MkVectorI4(
(Int32)((A * V.x)),
(Int32)((A * V.y)),
(Int32)((A * V.z)),
(Int32)((A * V.w)));
}
inline VectorB2 operator*(Byte A, VectorB2 V)
{
return MkVectorB2(
(Byte)((A * V.x)),
(Byte)((A * V.y)));
}
inline VectorB3 operator*(Byte A, VectorB3 V)
{
return MkVectorB3(
(Byte)((A * V.x)),
(Byte)((A * V.y)),
(Byte)((A * V.z)));
}
inline VectorB4 operator*(Byte A, VectorB4 V)
{
return MkVectorB4(
(Byte)((A * V.x)),
(Byte)((A * V.y)),
(Byte)((A * V.z)),
(Byte)((A * V.w)));
}
inline VectorD2 operator*(Double A, VectorD2 V)
{
return MkVectorD2(
(Double)((A * V.x)),
(Double)((A * V.y)));
}
inline VectorD3 operator*(Double A, VectorD3 V)
{
return MkVectorD3(
(Double)((A * V.x)),
(Double)((A * V.y)),
(Double)((A * V.z)));
}
inline VectorD4 operator*(Double A, VectorD4 V)
{
return MkVectorD4(
(Double)((A * V.x)),
(Double)((A * V.y)),
(Double)((A * V.z)),
(Double)((A * V.w)));
}
inline Vector2 operator*(Single A, Vector2 V)
{
return MkVector2(
(Single)((A * V.x)),
(Single)((A * V.y)));
}
inline Vector3 operator*(Single A, Vector3 V)
{
return MkVector3(
(Single)((A * V.x)),
(Single)((A * V.y)),
(Single)((A * V.z)));
}
inline Vector4 operator*(Single A, Vector4 V)
{
return MkVector4(
(Single)((A * V.x)),
(Single)((A * V.y)),
(Single)((A * V.z)),
(Single)((A * V.w)));
}
inline VectorI2 operator/(Int32 A, VectorI2 V)
{
return MkVectorI2(
(Int32)((Div(A, V.x))),
(Int32)((Div(A, V.y))));
}
inline VectorI3 operator/(Int32 A, VectorI3 V)
{
return MkVectorI3(
(Int32)((Div(A, V.x))),
(Int32)((Div(A, V.y))),
(Int32)((Div(A, V.z))));
}
inline VectorI4 operator/(Int32 A, VectorI4 V)
{
return MkVectorI4(
(Int32)((Div(A, V.x))),
(Int32)((Div(A, V.y))),
(Int32)((Div(A, V.z))),
(Int32)((Div(A, V.w))));
}
inline VectorB2 operator/(Byte A, VectorB2 V)
{
return MkVectorB2(
(Byte)((Div(A, V.x))),
(Byte)((Div(A, V.y))));
}
inline VectorB3 operator/(Byte A, VectorB3 V)
{
return MkVectorB3(
(Byte)((Div(A, V.x))),
(Byte)((Div(A, V.y))),
(Byte)((Div(A, V.z))));
}
inline VectorB4 operator/(Byte A, VectorB4 V)
{
return MkVectorB4(
(Byte)((Div(A, V.x))),
(Byte)((Div(A, V.y))),
(Byte)((Div(A, V.z))),
(Byte)((Div(A, V.w))));
}
inline VectorD2 operator/(Double A, VectorD2 V)
{
return MkVectorD2(
(Double)((Div(A, V.x))),
(Double)((Div(A, V.y))));
}
inline VectorD3 operator/(Double A, VectorD3 V)
{
return MkVectorD3(
(Double)((Div(A, V.x))),
(Double)((Div(A, V.y))),
(Double)((Div(A, V.z))));
}
inline VectorD4 operator/(Double A, VectorD4 V)
{
return MkVectorD4(
(Double)((Div(A, V.x))),
(Double)((Div(A, V.y))),
(Double)((Div(A, V.z))),
(Double)((Div(A, V.w))));
}
inline Vector2 operator/(Single A, Vector2 V)
{
return MkVector2(
(Single)((Div(A, V.x))),
(Single)((Div(A, V.y))));
}
inline Vector3 operator/(Single A, Vector3 V)
{
return MkVector3(
(Single)((Div(A, V.x))),
(Single)((Div(A, V.y))),
(Single)((Div(A, V.z))));
}
inline Vector4 operator/(Single A, Vector4 V)
{
return MkVector4(
(Single)((Div(A, V.x))),
(Single)((Div(A, V.y))),
(Single)((Div(A, V.z))),
(Single)((Div(A, V.w))));
}
inline VectorI2 operator*(VectorI2 V, Int32 A)
{
return MkVectorI2(
(Int32)((V.x * A)),
(Int32)((V.y * A)));
}
inline VectorI3 operator*(VectorI3 V, Int32 A)
{
return MkVectorI3(
(Int32)((V.x * A)),
(Int32)((V.y * A)),
(Int32)((V.z * A)));
}
inline VectorI4 operator*(VectorI4 V, Int32 A)
{
return MkVectorI4(
(Int32)((V.x * A)),
(Int32)((V.y * A)),
(Int32)((V.z * A)),
(Int32)((V.w * A)));
}
inline VectorB2 operator*(VectorB2 V, Byte A)
{
return MkVectorB2(
(Byte)((V.x * A)),
(Byte)((V.y * A)));
}
inline VectorB3 operator*(VectorB3 V, Byte A)
{
return MkVectorB3(
(Byte)((V.x * A)),
(Byte)((V.y * A)),
(Byte)((V.z * A)));
}
inline VectorB4 operator*(VectorB4 V, Byte A)
{
return MkVectorB4(
(Byte)((V.x * A)),
(Byte)((V.y * A)),
(Byte)((V.z * A)),
(Byte)((V.w * A)));
}
inline VectorD2 operator*(VectorD2 V, Double A)
{
return MkVectorD2(
(Double)((V.x * A)),
(Double)((V.y * A)));
}
inline VectorD3 operator*(VectorD3 V, Double A)
{
return MkVectorD3(
(Double)((V.x * A)),
(Double)((V.y * A)),
(Double)((V.z * A)));
}
inline VectorD4 operator*(VectorD4 V, Double A)
{
return MkVectorD4(
(Double)((V.x * A)),
(Double)((V.y * A)),
(Double)((V.z * A)),
(Double)((V.w * A)));
}
inline Vector2 operator*(Vector2 V, Single A)
{
return MkVector2(
(Single)((V.x * A)),
(Single)((V.y * A)));
}
inline Vector3 operator*(Vector3 V, Single A)
{
return MkVector3(
(Single)((V.x * A)),
(Single)((V.y * A)),
(Single)((V.z * A)));
}
inline Vector4 operator*(Vector4 V, Single A)
{
return MkVector4(
(Single)((V.x * A)),
(Single)((V.y * A)),
(Single)((V.z * A)),
(Single)((V.w * A)));
}
inline VectorI2 operator/(VectorI2 V, Int32 A)
{
return MkVectorI2(
(Int32)((Div(V.x, A))),
(Int32)((Div(V.y, A))));
}
inline VectorI3 operator/(VectorI3 V, Int32 A)
{
return MkVectorI3(
(Int32)((Div(V.x, A))),
(Int32)((Div(V.y, A))),
(Int32)((Div(V.z, A))));
}
inline VectorI4 operator/(VectorI4 V, Int32 A)
{
return MkVectorI4(
(Int32)((Div(V.x, A))),
(Int32)((Div(V.y, A))),
(Int32)((Div(V.z, A))),
(Int32)((Div(V.w, A))));
}
inline VectorB2 operator/(VectorB2 V, Byte A)
{
return MkVectorB2(
(Byte)((Div(V.x, A))),
(Byte)((Div(V.y, A))));
}
inline VectorB3 operator/(VectorB3 V, Byte A)
{
return MkVectorB3(
(Byte)((Div(V.x, A))),
(Byte)((Div(V.y, A))),
(Byte)((Div(V.z, A))));
}
inline VectorB4 operator/(VectorB4 V, Byte A)
{
return MkVectorB4(
(Byte)((Div(V.x, A))),
(Byte)((Div(V.y, A))),
(Byte)((Div(V.z, A))),
(Byte)((Div(V.w, A))));
}
inline VectorD2 operator/(VectorD2 V, Double A)
{
return MkVectorD2(
(Double)((Div(V.x, A))),
(Double)((Div(V.y, A))));
}
inline VectorD3 operator/(VectorD3 V, Double A)
{
return MkVectorD3(
(Double)((Div(V.x, A))),
(Double)((Div(V.y, A))),
(Double)((Div(V.z, A))));
}
inline VectorD4 operator/(VectorD4 V, Double A)
{
return MkVectorD4(
(Double)((Div(V.x, A))),
(Double)((Div(V.y, A))),
(Double)((Div(V.z, A))),
(Double)((Div(V.w, A))));
}
inline Vector2 operator/(Vector2 V, Single A)
{
return MkVector2(
(Single)((Div(V.x, A))),
(Single)((Div(V.y, A))));
}
inline Vector3 operator/(Vector3 V, Single A)
{
return MkVector3(
(Single)((Div(V.x, A))),
(Single)((Div(V.y, A))),
(Single)((Div(V.z, A))));
}
inline Vector4 operator/(Vector4 V, Single A)
{
return MkVector4(
(Single)((Div(V.x, A))),
(Single)((Div(V.y, A))),
(Single)((Div(V.z, A))),
(Single)((Div(V.w, A))));
}
// Compound assignment operators
inline VectorI2& operator+=(VectorI2& A, VectorI2 B)
{
A = A + B;
return A;
}
inline VectorI3& operator+=(VectorI3& A, VectorI3 B)
{
A = A + B;
return A;
}
inline VectorI4& operator+=(VectorI4& A, VectorI4 B)
{
A = A + B;
return A;
}
inline VectorB2& operator+=(VectorB2& A, VectorB2 B)
{
A = A + B;
return A;
}
inline VectorB3& operator+=(VectorB3& A, VectorB3 B)
{
A = A + B;
return A;
}
inline VectorB4& operator+=(VectorB4& A, VectorB4 B)
{
A = A + B;
return A;
}
inline VectorD2& operator+=(VectorD2& A, VectorD2 B)
{
A = A + B;
return A;
}
inline VectorD3& operator+=(VectorD3& A, VectorD3 B)
{
A = A + B;
return A;
}
inline VectorD4& operator+=(VectorD4& A, VectorD4 B)
{
A = A + B;
return A;
}
inline Vector2& operator+=(Vector2& A, Vector2 B)
{
A = A + B;
return A;
}
inline Vector3& operator+=(Vector3& A, Vector3 B)
{
A = A + B;
return A;
}
inline Vector4& operator+=(Vector4& A, Vector4 B)
{
A = A + B;
return A;
}
inline VectorI2& operator-=(VectorI2& A, VectorI2 B)
{
A = A - B;
return A;
}
inline VectorI3& operator-=(VectorI3& A, VectorI3 B)
{
A = A - B;
return A;
}
inline VectorI4& operator-=(VectorI4& A, VectorI4 B)
{
A = A - B;
return A;
}
inline VectorB2& operator-=(VectorB2& A, VectorB2 B)
{
A = A - B;
return A;
}
inline VectorB3& operator-=(VectorB3& A, VectorB3 B)
{
A = A - B;
return A;
}
inline VectorB4& operator-=(VectorB4& A, VectorB4 B)
{
A = A - B;
return A;
}
inline VectorD2& operator-=(VectorD2& A, VectorD2 B)
{
A = A - B;
return A;
}
inline VectorD3& operator-=(VectorD3& A, VectorD3 B)
{
A = A - B;
return A;
}
inline VectorD4& operator-=(VectorD4& A, VectorD4 B)
{
A = A - B;
return A;
}
inline Vector2& operator-=(Vector2& A, Vector2 B)
{
A = A - B;
return A;
}
inline Vector3& operator-=(Vector3& A, Vector3 B)
{
A = A - B;
return A;
}
inline Vector4& operator-=(Vector4& A, Vector4 B)
{
A = A - B;
return A;
}
inline VectorI2& operator*=(VectorI2& V, Int32 A)
{
V = V * A;
return V;
}
inline VectorI3& operator*=(VectorI3& V, Int32 A)
{
V = V * A;
return V;
}
inline VectorI4& operator*=(VectorI4& V, Int32 A)
{
V = V * A;
return V;
}
inline VectorB2& operator*=(VectorB2& V, Byte A)
{
V = V * A;
return V;
}
inline VectorB3& operator*=(VectorB3& V, Byte A)
{
V = V * A;
return V;
}
inline VectorB4& operator*=(VectorB4& V, Byte A)
{
V = V * A;
return V;
}
inline VectorD2& operator*=(VectorD2& V, Double A)
{
V = V * A;
return V;
}
inline VectorD3& operator*=(VectorD3& V, Double A)
{
V = V * A;
return V;
}
inline VectorD4& operator*=(VectorD4& V, Double A)
{
V = V * A;
return V;
}
inline Vector2& operator*=(Vector2& V, Single A)
{
V = V * A;
return V;
}
inline Vector3& operator*=(Vector3& V, Single A)
{
V = V * A;
return V;
}
inline Vector4& operator*=(Vector4& V, Single A)
{
V = V * A;
return V;
}
inline VectorI2& operator/=(VectorI2& V, Int32 A)
{
V = V / A;
return V;
}
inline VectorI3& operator/=(VectorI3& V, Int32 A)
{
V = V / A;
return V;
}
inline VectorI4& operator/=(VectorI4& V, Int32 A)
{
V = V / A;
return V;
}
inline VectorB2& operator/=(VectorB2& V, Byte A)
{
V = V / A;
return V;
}
inline VectorB3& operator/=(VectorB3& V, Byte A)
{
V = V / A;
return V;
}
inline VectorB4& operator/=(VectorB4& V, Byte A)
{
V = V / A;
return V;
}
inline VectorD2& operator/=(VectorD2& V, Double A)
{
V = V / A;
return V;
}
inline VectorD3& operator/=(VectorD3& V, Double A)
{
V = V / A;
return V;
}
inline VectorD4& operator/=(VectorD4& V, Double A)
{
V = V / A;
return V;
}
inline Vector2& operator/=(Vector2& V, Single A)
{
V = V / A;
return V;
}
inline Vector3& operator/=(Vector3& V, Single A)
{
V = V / A;
return V;
}
inline Vector4& operator/=(Vector4& V, Single A)
{
V = V / A;
return V;
}
// Dot product
inline Int32 DotP(VectorI2 A, VectorI2 B)
{
return (Int32)((A.x * B.x)
+ (A.y * B.y));
}
inline Int32 DotP(VectorI3 A, VectorI3 B)
{
return (Int32)((A.x * B.x)
+ (A.y * B.y)
+ (A.z * B.z));
}
inline Int32 DotP(VectorI4 A, VectorI4 B)
{
return (Int32)((A.x * B.x)
+ (A.y * B.y)
+ (A.z * B.z)
+ (A.w * B.w));
}
inline Byte DotP(VectorB2 A, VectorB2 B)
{
return (Byte)((A.x * B.x)
+ (A.y * B.y));
}
inline Int32 DotPI(VectorB2 A, VectorB2 B)
{
return (Int32)((Int32)(A.x * B.x)
+ (Int32)(A.y * B.y));
}
inline Byte DotP(VectorB3 A, VectorB3 B)
{
return (Byte)((A.x * B.x)
+ (A.y * B.y)
+ (A.z * B.z));
}
inline Int32 DotPI(VectorB3 A, VectorB3 B)
{
return (Int32)((Int32)(A.x * B.x)
+ (Int32)(A.y * B.y)
+ (Int32)(A.z * B.z));
}
inline Byte DotP(VectorB4 A, VectorB4 B)
{
return (Byte)((A.x * B.x)
+ (A.y * B.y)
+ (A.z * B.z)
+ (A.w * B.w));
}
inline Int32 DotPI(VectorB4 A, VectorB4 B)
{
return (Int32)((Int32)(A.x * B.x)
+ (Int32)(A.y * B.y)
+ (Int32)(A.z * B.z)
+ (Int32)(A.w * B.w));
}
inline Double DotP(VectorD2 A, VectorD2 B)
{
return (Double)((A.x * B.x)
+ (A.y * B.y));
}
inline Double DotP(VectorD3 A, VectorD3 B)
{
return (Double)((A.x * B.x)
+ (A.y * B.y)
+ (A.z * B.z));
}
inline Double DotP(VectorD4 A, VectorD4 B)
{
return (Double)((A.x * B.x)
+ (A.y * B.y)
+ (A.z * B.z)
+ (A.w * B.w));
}
inline Single DotP(Vector2 A, Vector2 B)
{
return (Single)((A.x * B.x)
+ (A.y * B.y));
}
inline Double DotPD(Vector2 A, Vector2 B)
{
return (Double)((Double)(A.x * B.x)
+ (Double)(A.y * B.y));
}
inline Single DotP(Vector3 A, Vector3 B)
{
return (Single)((A.x * B.x)
+ (A.y * B.y)
+ (A.z * B.z));
}
inline Double DotPD(Vector3 A, Vector3 B)
{
return (Double)((Double)(A.x * B.x)
+ (Double)(A.y * B.y)
+ (Double)(A.z * B.z));
}
inline Single DotP(Vector4 A, Vector4 B)
{
return (Single)((A.x * B.x)
+ (A.y * B.y)
+ (A.z * B.z)
+ (A.w * B.w));
}
inline Double DotPD(Vector4 A, Vector4 B)
{
return (Double)((Double)(A.x * B.x)
+ (Double)(A.y * B.y)
+ (Double)(A.z * B.z)
+ (Double)(A.w * B.w));
}
// Square length
inline Int32 SqLen(VectorI2 V)
{
return DotP(V,V);
}
inline Int32 SqLen(VectorI3 V)
{
return DotP(V,V);
}
inline Int32 SqLen(VectorI4 V)
{
return DotP(V,V);
}
inline Byte SqLen(VectorB2 V)
{
return DotP(V,V);
}
inline Int32 SqLenI(VectorB2 V)
{
return DotPI(V,V);
}
inline Byte SqLen(VectorB3 V)
{
return DotP(V,V);
}
inline Int32 SqLenI(VectorB3 V)
{
return DotPI(V,V);
}
inline Byte SqLen(VectorB4 V)
{
return DotP(V,V);
}
inline Int32 SqLenI(VectorB4 V)
{
return DotPI(V,V);
}
inline Double SqLen(VectorD2 V)
{
return DotP(V,V);
}
inline Double SqLen(VectorD3 V)
{
return DotP(V,V);
}
inline Double SqLen(VectorD4 V)
{
return DotP(V,V);
}
inline Single SqLen(Vector2 V)
{
return DotP(V,V);
}
inline Double SqLenD(Vector2 V)
{
return DotPD(V,V);
}
inline Single SqLen(Vector3 V)
{
return DotP(V,V);
}
inline Double SqLenD(Vector3 V)
{
return DotPD(V,V);
}
inline Single SqLen(Vector4 V)
{
return DotP(V,V);
}
inline Double SqLenD(Vector4 V)
{
return DotPD(V,V);
}
// Manhattan length operators (ie sum of components)
inline Int32 ManhatLength(VectorI2 V)
{
return (Int32)(V.x + V.y);
}
inline Int32 ManhatLength(VectorI3 V)
{
return (Int32)(V.x + V.y + V.z);
}
inline Int32 ManhatLength(VectorI4 V)
{
return (Int32)(V.x + V.y + V.z + V.w);
}
inline Byte ManhatLength(VectorB2 V)
{
return (Byte)(V.x + V.y);
}
inline Byte ManhatLength(VectorB3 V)
{
return (Byte)(V.x + V.y + V.z);
}
inline Byte ManhatLength(VectorB4 V)
{
return (Byte)(V.x + V.y + V.z + V.w);
}
inline Double ManhatLength(VectorD2 V)
{
return (Double)(V.x + V.y);
}
inline Double ManhatLength(VectorD3 V)
{
return (Double)(V.x + V.y + V.z);
}
inline Double ManhatLength(VectorD4 V)
{
return (Double)(V.x + V.y + V.z + V.w);
}
inline Single ManhatLength(Vector2 V)
{
return (Single)(V.x + V.y);
}
inline Single ManhatLength(Vector3 V)
{
return (Single)(V.x + V.y + V.z);
}
inline Single ManhatLength(Vector4 V)
{
return (Single)(V.x + V.y + V.z + V.w);
}
// Vector length (as in, euclidean)
inline Double Len(VectorD2 V)
{
return Sqrt(SqLen(V));
}
inline Double Len(VectorD3 V)
{
return Sqrt(SqLen(V));
}
inline Double Len(VectorD4 V)
{
return Sqrt(SqLen(V));
}
inline Single Len(Vector2 V)
{
return Sqrt(SqLen(V));
}
inline Single Len(Vector3 V)
{
return Sqrt(SqLen(V));
}
inline Single Len(Vector4 V)
{
return Sqrt(SqLen(V));
}
// Normalized vector
inline VectorD2 Norm(VectorD2 V)
{
return V/Len(V);
}
inline VectorD3 Norm(VectorD3 V)
{
return V/Len(V);
}
inline VectorD4 Norm(VectorD4 V)
{
return V/Len(V);
}
inline Vector2 Norm(Vector2 V)
{
return V/Len(V);
}
inline Vector3 Norm(Vector3 V)
{
return V/Len(V);
}
inline Vector4 Norm(Vector4 V)
{
return V/Len(V);
}
// Product of components of vector
inline Int32 Volume(VectorI2 V)
{
return (Int32)(V.x * V.y);
}
inline Int32 Volume(VectorI3 V)
{
return (Int32)(V.x * V.y * V.z);
}
inline Int32 Volume(VectorI4 V)
{
return (Int32)(V.x * V.y * V.z * V.w);
}
inline Byte Volume(VectorB2 V)
{
return (Byte)(V.x * V.y);
}
inline Int32 VolumeI(VectorB2 V)
{
return (Int32)(V.x * V.y);
}
inline Byte Volume(VectorB3 V)
{
return (Byte)(V.x * V.y * V.z);
}
inline Int32 VolumeI(VectorB3 V)
{
return (Int32)(V.x * V.y * V.z);
}
inline Byte Volume(VectorB4 V)
{
return (Byte)(V.x * V.y * V.z * V.w);
}
inline Int32 VolumeI(VectorB4 V)
{
return (Int32)(V.x * V.y * V.z * V.w);
}
inline Double Volume(VectorD2 V)
{
return (Double)(V.x * V.y);
}
inline Double Volume(VectorD3 V)
{
return (Double)(V.x * V.y * V.z);
}
inline Double Volume(VectorD4 V)
{
return (Double)(V.x * V.y * V.z * V.w);
}
inline Single Volume(Vector2 V)
{
return (Single)(V.x * V.y);
}
inline Double VolumeD(Vector2 V)
{
return (Double)(V.x * V.y);
}
inline Single Volume(Vector3 V)
{
return (Single)(V.x * V.y * V.z);
}
inline Double VolumeD(Vector3 V)
{
return (Double)(V.x * V.y * V.z);
}
inline Single Volume(Vector4 V)
{
return (Single)(V.x * V.y * V.z * V.w);
}
inline Double VolumeD(Vector4 V)
{
return (Double)(V.x * V.y * V.z * V.w);
}
inline Int32 Pow2Volume(VectorI2 V)
{
return Pow2Mult((Int32)1, (Int32)(V.x + V.y));
}
inline Int32 Pow2Volume(VectorI3 V)
{
return Pow2Mult((Int32)1, (Int32)(V.x + V.y + V.z));
}
inline Int32 Pow2Volume(VectorI4 V)
{
return Pow2Mult((Int32)1, (Int32)(V.x + V.y + V.z + V.w));
}
inline Byte Pow2Volume(VectorB2 V)
{
return Pow2Mult((Byte)1, (Byte)(V.x + V.y));
}
inline Int32 Pow2VolumeI(VectorB2 V)
{
return Pow2Mult((Int32)1, (Int32)(V.x + V.y));
}
inline Byte Pow2Volume(VectorB3 V)
{
return Pow2Mult((Byte)1, (Byte)(V.x + V.y + V.z));
}
inline Int32 Pow2VolumeI(VectorB3 V)
{
return Pow2Mult((Int32)1, (Int32)(V.x + V.y + V.z));
}
inline Byte Pow2Volume(VectorB4 V)
{
return Pow2Mult((Byte)1, (Byte)(V.x + V.y + V.z + V.w));
}
inline Int32 Pow2VolumeI(VectorB4 V)
{
return Pow2Mult((Int32)1, (Int32)(V.x + V.y + V.z + V.w));
}
// Cross product
inline VectorI3 CrossP(VectorI3 A, VectorI3 B)
{
return MkVectorI3(
(A.y * B.z) - (A.z * B.y),
-(A.x * B.z) + (A.z * B.x),
(A.x * B.y) - (A.y * B.x));
}
inline VectorD3 CrossP(VectorD3 A, VectorD3 B)
{
return MkVectorD3(
(A.y * B.z) - (A.z * B.y),
-(A.x * B.z) + (A.z * B.x),
(A.x * B.y) - (A.y * B.x));
}
inline Vector3 CrossP(Vector3 A, Vector3 B)
{
return MkVector3(
(A.y * B.z) - (A.z * B.y),
-(A.x * B.z) + (A.z * B.x),
(A.x * B.y) - (A.y * B.x));
}
// Swizzles
inline VectorI2 SwizzXX(VectorI2 V){ return MkVectorI2(V.x, V.x); }
inline VectorI2 SwizzXY(VectorI2 V){ return MkVectorI2(V.x, V.y); }
inline VectorI2 SwizzX_(VectorI2 V){ return MkVectorI2(V.x, 0); }
inline VectorI2 SwizzYX(VectorI2 V){ return MkVectorI2(V.y, V.x); }
inline VectorI2 SwizzYY(VectorI2 V){ return MkVectorI2(V.y, V.y); }
inline VectorI2 SwizzY_(VectorI2 V){ return MkVectorI2(V.y, 0); }
inline VectorI2 Swizz_X(VectorI2 V){ return MkVectorI2(0, V.x); }
inline VectorI2 Swizz_Y(VectorI2 V){ return MkVectorI2(0, V.y); }
inline VectorI3 SwizzXXX(VectorI2 V){ return MkVectorI3(V.x, V.x, V.x); }
inline VectorI3 SwizzXXY(VectorI2 V){ return MkVectorI3(V.x, V.x, V.y); }
inline VectorI3 SwizzXX_(VectorI2 V){ return MkVectorI3(V.x, V.x, 0); }
inline VectorI3 SwizzXYX(VectorI2 V){ return MkVectorI3(V.x, V.y, V.x); }
inline VectorI3 SwizzXYY(VectorI2 V){ return MkVectorI3(V.x, V.y, V.y); }
inline VectorI3 SwizzXY_(VectorI2 V){ return MkVectorI3(V.x, V.y, 0); }
inline VectorI3 SwizzX_X(VectorI2 V){ return MkVectorI3(V.x, 0, V.x); }
inline VectorI3 SwizzX_Y(VectorI2 V){ return MkVectorI3(V.x, 0, V.y); }
inline VectorI3 SwizzX__(VectorI2 V){ return MkVectorI3(V.x, 0, 0); }
inline VectorI3 SwizzYXX(VectorI2 V){ return MkVectorI3(V.y, V.x, V.x); }
inline VectorI3 SwizzYXY(VectorI2 V){ return MkVectorI3(V.y, V.x, V.y); }
inline VectorI3 SwizzYX_(VectorI2 V){ return MkVectorI3(V.y, V.x, 0); }
inline VectorI3 SwizzYYX(VectorI2 V){ return MkVectorI3(V.y, V.y, V.x); }
inline VectorI3 SwizzYYY(VectorI2 V){ return MkVectorI3(V.y, V.y, V.y); }
inline VectorI3 SwizzYY_(VectorI2 V){ return MkVectorI3(V.y, V.y, 0); }
inline VectorI3 SwizzY_X(VectorI2 V){ return MkVectorI3(V.y, 0, V.x); }
inline VectorI3 SwizzY_Y(VectorI2 V){ return MkVectorI3(V.y, 0, V.y); }
inline VectorI3 SwizzY__(VectorI2 V){ return MkVectorI3(V.y, 0, 0); }
inline VectorI3 Swizz_XX(VectorI2 V){ return MkVectorI3(0, V.x, V.x); }
inline VectorI3 Swizz_XY(VectorI2 V){ return MkVectorI3(0, V.x, V.y); }
inline VectorI3 Swizz_X_(VectorI2 V){ return MkVectorI3(0, V.x, 0); }
inline VectorI3 Swizz_YX(VectorI2 V){ return MkVectorI3(0, V.y, V.x); }
inline VectorI3 Swizz_YY(VectorI2 V){ return MkVectorI3(0, V.y, V.y); }
inline VectorI3 Swizz_Y_(VectorI2 V){ return MkVectorI3(0, V.y, 0); }
inline VectorI3 Swizz__X(VectorI2 V){ return MkVectorI3(0, 0, V.x); }
inline VectorI3 Swizz__Y(VectorI2 V){ return MkVectorI3(0, 0, V.y); }
inline VectorI4 SwizzXXXX(VectorI2 V){ return MkVectorI4(V.x, V.x, V.x, V.x); }
inline VectorI4 SwizzXXXY(VectorI2 V){ return MkVectorI4(V.x, V.x, V.x, V.y); }
inline VectorI4 SwizzXXX_(VectorI2 V){ return MkVectorI4(V.x, V.x, V.x, 0); }
inline VectorI4 SwizzXXYX(VectorI2 V){ return MkVectorI4(V.x, V.x, V.y, V.x); }
inline VectorI4 SwizzXXYY(VectorI2 V){ return MkVectorI4(V.x, V.x, V.y, V.y); }
inline VectorI4 SwizzXXY_(VectorI2 V){ return MkVectorI4(V.x, V.x, V.y, 0); }
inline VectorI4 SwizzXX_X(VectorI2 V){ return MkVectorI4(V.x, V.x, 0, V.x); }
inline VectorI4 SwizzXX_Y(VectorI2 V){ return MkVectorI4(V.x, V.x, 0, V.y); }
inline VectorI4 SwizzXX__(VectorI2 V){ return MkVectorI4(V.x, V.x, 0, 0); }
inline VectorI4 SwizzXYXX(VectorI2 V){ return MkVectorI4(V.x, V.y, V.x, V.x); }
inline VectorI4 SwizzXYXY(VectorI2 V){ return MkVectorI4(V.x, V.y, V.x, V.y); }
inline VectorI4 SwizzXYX_(VectorI2 V){ return MkVectorI4(V.x, V.y, V.x, 0); }
inline VectorI4 SwizzXYYX(VectorI2 V){ return MkVectorI4(V.x, V.y, V.y, V.x); }
inline VectorI4 SwizzXYYY(VectorI2 V){ return MkVectorI4(V.x, V.y, V.y, V.y); }
inline VectorI4 SwizzXYY_(VectorI2 V){ return MkVectorI4(V.x, V.y, V.y, 0); }
inline VectorI4 SwizzXY_X(VectorI2 V){ return MkVectorI4(V.x, V.y, 0, V.x); }
inline VectorI4 SwizzXY_Y(VectorI2 V){ return MkVectorI4(V.x, V.y, 0, V.y); }
inline VectorI4 SwizzXY__(VectorI2 V){ return MkVectorI4(V.x, V.y, 0, 0); }
inline VectorI4 SwizzX_XX(VectorI2 V){ return MkVectorI4(V.x, 0, V.x, V.x); }
inline VectorI4 SwizzX_XY(VectorI2 V){ return MkVectorI4(V.x, 0, V.x, V.y); }
inline VectorI4 SwizzX_X_(VectorI2 V){ return MkVectorI4(V.x, 0, V.x, 0); }
inline VectorI4 SwizzX_YX(VectorI2 V){ return MkVectorI4(V.x, 0, V.y, V.x); }
inline VectorI4 SwizzX_YY(VectorI2 V){ return MkVectorI4(V.x, 0, V.y, V.y); }
inline VectorI4 SwizzX_Y_(VectorI2 V){ return MkVectorI4(V.x, 0, V.y, 0); }
inline VectorI4 SwizzX__X(VectorI2 V){ return MkVectorI4(V.x, 0, 0, V.x); }
inline VectorI4 SwizzX__Y(VectorI2 V){ return MkVectorI4(V.x, 0, 0, V.y); }
inline VectorI4 SwizzX___(VectorI2 V){ return MkVectorI4(V.x, 0, 0, 0); }
inline VectorI4 SwizzYXXX(VectorI2 V){ return MkVectorI4(V.y, V.x, V.x, V.x); }
inline VectorI4 SwizzYXXY(VectorI2 V){ return MkVectorI4(V.y, V.x, V.x, V.y); }
inline VectorI4 SwizzYXX_(VectorI2 V){ return MkVectorI4(V.y, V.x, V.x, 0); }
inline VectorI4 SwizzYXYX(VectorI2 V){ return MkVectorI4(V.y, V.x, V.y, V.x); }
inline VectorI4 SwizzYXYY(VectorI2 V){ return MkVectorI4(V.y, V.x, V.y, V.y); }
inline VectorI4 SwizzYXY_(VectorI2 V){ return MkVectorI4(V.y, V.x, V.y, 0); }
inline VectorI4 SwizzYX_X(VectorI2 V){ return MkVectorI4(V.y, V.x, 0, V.x); }
inline VectorI4 SwizzYX_Y(VectorI2 V){ return MkVectorI4(V.y, V.x, 0, V.y); }
inline VectorI4 SwizzYX__(VectorI2 V){ return MkVectorI4(V.y, V.x, 0, 0); }
inline VectorI4 SwizzYYXX(VectorI2 V){ return MkVectorI4(V.y, V.y, V.x, V.x); }
inline VectorI4 SwizzYYXY(VectorI2 V){ return MkVectorI4(V.y, V.y, V.x, V.y); }
inline VectorI4 SwizzYYX_(VectorI2 V){ return MkVectorI4(V.y, V.y, V.x, 0); }
inline VectorI4 SwizzYYYX(VectorI2 V){ return MkVectorI4(V.y, V.y, V.y, V.x); }
inline VectorI4 SwizzYYYY(VectorI2 V){ return MkVectorI4(V.y, V.y, V.y, V.y); }
inline VectorI4 SwizzYYY_(VectorI2 V){ return MkVectorI4(V.y, V.y, V.y, 0); }
inline VectorI4 SwizzYY_X(VectorI2 V){ return MkVectorI4(V.y, V.y, 0, V.x); }
inline VectorI4 SwizzYY_Y(VectorI2 V){ return MkVectorI4(V.y, V.y, 0, V.y); }
inline VectorI4 SwizzYY__(VectorI2 V){ return MkVectorI4(V.y, V.y, 0, 0); }
inline VectorI4 SwizzY_XX(VectorI2 V){ return MkVectorI4(V.y, 0, V.x, V.x); }
inline VectorI4 SwizzY_XY(VectorI2 V){ return MkVectorI4(V.y, 0, V.x, V.y); }
inline VectorI4 SwizzY_X_(VectorI2 V){ return MkVectorI4(V.y, 0, V.x, 0); }
inline VectorI4 SwizzY_YX(VectorI2 V){ return MkVectorI4(V.y, 0, V.y, V.x); }
inline VectorI4 SwizzY_YY(VectorI2 V){ return MkVectorI4(V.y, 0, V.y, V.y); }
inline VectorI4 SwizzY_Y_(VectorI2 V){ return MkVectorI4(V.y, 0, V.y, 0); }
inline VectorI4 SwizzY__X(VectorI2 V){ return MkVectorI4(V.y, 0, 0, V.x); }
inline VectorI4 SwizzY__Y(VectorI2 V){ return MkVectorI4(V.y, 0, 0, V.y); }
inline VectorI4 SwizzY___(VectorI2 V){ return MkVectorI4(V.y, 0, 0, 0); }
inline VectorI4 Swizz_XXX(VectorI2 V){ return MkVectorI4(0, V.x, V.x, V.x); }
inline VectorI4 Swizz_XXY(VectorI2 V){ return MkVectorI4(0, V.x, V.x, V.y); }
inline VectorI4 Swizz_XX_(VectorI2 V){ return MkVectorI4(0, V.x, V.x, 0); }
inline VectorI4 Swizz_XYX(VectorI2 V){ return MkVectorI4(0, V.x, V.y, V.x); }
inline VectorI4 Swizz_XYY(VectorI2 V){ return MkVectorI4(0, V.x, V.y, V.y); }
inline VectorI4 Swizz_XY_(VectorI2 V){ return MkVectorI4(0, V.x, V.y, 0); }
inline VectorI4 Swizz_X_X(VectorI2 V){ return MkVectorI4(0, V.x, 0, V.x); }
inline VectorI4 Swizz_X_Y(VectorI2 V){ return MkVectorI4(0, V.x, 0, V.y); }
inline VectorI4 Swizz_X__(VectorI2 V){ return MkVectorI4(0, V.x, 0, 0); }
inline VectorI4 Swizz_YXX(VectorI2 V){ return MkVectorI4(0, V.y, V.x, V.x); }
inline VectorI4 Swizz_YXY(VectorI2 V){ return MkVectorI4(0, V.y, V.x, V.y); }
inline VectorI4 Swizz_YX_(VectorI2 V){ return MkVectorI4(0, V.y, V.x, 0); }
inline VectorI4 Swizz_YYX(VectorI2 V){ return MkVectorI4(0, V.y, V.y, V.x); }
inline VectorI4 Swizz_YYY(VectorI2 V){ return MkVectorI4(0, V.y, V.y, V.y); }
inline VectorI4 Swizz_YY_(VectorI2 V){ return MkVectorI4(0, V.y, V.y, 0); }
inline VectorI4 Swizz_Y_X(VectorI2 V){ return MkVectorI4(0, V.y, 0, V.x); }
inline VectorI4 Swizz_Y_Y(VectorI2 V){ return MkVectorI4(0, V.y, 0, V.y); }
inline VectorI4 Swizz_Y__(VectorI2 V){ return MkVectorI4(0, V.y, 0, 0); }
inline VectorI4 Swizz__XX(VectorI2 V){ return MkVectorI4(0, 0, V.x, V.x); }
inline VectorI4 Swizz__XY(VectorI2 V){ return MkVectorI4(0, 0, V.x, V.y); }
inline VectorI4 Swizz__X_(VectorI2 V){ return MkVectorI4(0, 0, V.x, 0); }
inline VectorI4 Swizz__YX(VectorI2 V){ return MkVectorI4(0, 0, V.y, V.x); }
inline VectorI4 Swizz__YY(VectorI2 V){ return MkVectorI4(0, 0, V.y, V.y); }
inline VectorI4 Swizz__Y_(VectorI2 V){ return MkVectorI4(0, 0, V.y, 0); }
inline VectorI4 Swizz___X(VectorI2 V){ return MkVectorI4(0, 0, 0, V.x); }
inline VectorI4 Swizz___Y(VectorI2 V){ return MkVectorI4(0, 0, 0, V.y); }
inline VectorI2 SwizzXX(VectorI3 V){ return MkVectorI2(V.x, V.x); }
inline VectorI2 SwizzXY(VectorI3 V){ return MkVectorI2(V.x, V.y); }
inline VectorI2 SwizzXZ(VectorI3 V){ return MkVectorI2(V.x, V.z); }
inline VectorI2 SwizzX_(VectorI3 V){ return MkVectorI2(V.x, 0); }
inline VectorI2 SwizzYX(VectorI3 V){ return MkVectorI2(V.y, V.x); }
inline VectorI2 SwizzYY(VectorI3 V){ return MkVectorI2(V.y, V.y); }
inline VectorI2 SwizzYZ(VectorI3 V){ return MkVectorI2(V.y, V.z); }
inline VectorI2 SwizzY_(VectorI3 V){ return MkVectorI2(V.y, 0); }
inline VectorI2 SwizzZX(VectorI3 V){ return MkVectorI2(V.z, V.x); }
inline VectorI2 SwizzZY(VectorI3 V){ return MkVectorI2(V.z, V.y); }
inline VectorI2 SwizzZZ(VectorI3 V){ return MkVectorI2(V.z, V.z); }
inline VectorI2 SwizzZ_(VectorI3 V){ return MkVectorI2(V.z, 0); }
inline VectorI2 Swizz_X(VectorI3 V){ return MkVectorI2(0, V.x); }
inline VectorI2 Swizz_Y(VectorI3 V){ return MkVectorI2(0, V.y); }
inline VectorI2 Swizz_Z(VectorI3 V){ return MkVectorI2(0, V.z); }
inline VectorI3 SwizzXXX(VectorI3 V){ return MkVectorI3(V.x, V.x, V.x); }
inline VectorI3 SwizzXXY(VectorI3 V){ return MkVectorI3(V.x, V.x, V.y); }
inline VectorI3 SwizzXXZ(VectorI3 V){ return MkVectorI3(V.x, V.x, V.z); }
inline VectorI3 SwizzXX_(VectorI3 V){ return MkVectorI3(V.x, V.x, 0); }
inline VectorI3 SwizzXYX(VectorI3 V){ return MkVectorI3(V.x, V.y, V.x); }
inline VectorI3 SwizzXYY(VectorI3 V){ return MkVectorI3(V.x, V.y, V.y); }
inline VectorI3 SwizzXYZ(VectorI3 V){ return MkVectorI3(V.x, V.y, V.z); }
inline VectorI3 SwizzXY_(VectorI3 V){ return MkVectorI3(V.x, V.y, 0); }
inline VectorI3 SwizzXZX(VectorI3 V){ return MkVectorI3(V.x, V.z, V.x); }
inline VectorI3 SwizzXZY(VectorI3 V){ return MkVectorI3(V.x, V.z, V.y); }
inline VectorI3 SwizzXZZ(VectorI3 V){ return MkVectorI3(V.x, V.z, V.z); }
inline VectorI3 SwizzXZ_(VectorI3 V){ return MkVectorI3(V.x, V.z, 0); }
inline VectorI3 SwizzX_X(VectorI3 V){ return MkVectorI3(V.x, 0, V.x); }
inline VectorI3 SwizzX_Y(VectorI3 V){ return MkVectorI3(V.x, 0, V.y); }
inline VectorI3 SwizzX_Z(VectorI3 V){ return MkVectorI3(V.x, 0, V.z); }
inline VectorI3 SwizzX__(VectorI3 V){ return MkVectorI3(V.x, 0, 0); }
inline VectorI3 SwizzYXX(VectorI3 V){ return MkVectorI3(V.y, V.x, V.x); }
inline VectorI3 SwizzYXY(VectorI3 V){ return MkVectorI3(V.y, V.x, V.y); }
inline VectorI3 SwizzYXZ(VectorI3 V){ return MkVectorI3(V.y, V.x, V.z); }
inline VectorI3 SwizzYX_(VectorI3 V){ return MkVectorI3(V.y, V.x, 0); }
inline VectorI3 SwizzYYX(VectorI3 V){ return MkVectorI3(V.y, V.y, V.x); }
inline VectorI3 SwizzYYY(VectorI3 V){ return MkVectorI3(V.y, V.y, V.y); }
inline VectorI3 SwizzYYZ(VectorI3 V){ return MkVectorI3(V.y, V.y, V.z); }
inline VectorI3 SwizzYY_(VectorI3 V){ return MkVectorI3(V.y, V.y, 0); }
inline VectorI3 SwizzYZX(VectorI3 V){ return MkVectorI3(V.y, V.z, V.x); }
inline VectorI3 SwizzYZY(VectorI3 V){ return MkVectorI3(V.y, V.z, V.y); }
inline VectorI3 SwizzYZZ(VectorI3 V){ return MkVectorI3(V.y, V.z, V.z); }
inline VectorI3 SwizzYZ_(VectorI3 V){ return MkVectorI3(V.y, V.z, 0); }
inline VectorI3 SwizzY_X(VectorI3 V){ return MkVectorI3(V.y, 0, V.x); }
inline VectorI3 SwizzY_Y(VectorI3 V){ return MkVectorI3(V.y, 0, V.y); }
inline VectorI3 SwizzY_Z(VectorI3 V){ return MkVectorI3(V.y, 0, V.z); }
inline VectorI3 SwizzY__(VectorI3 V){ return MkVectorI3(V.y, 0, 0); }
inline VectorI3 SwizzZXX(VectorI3 V){ return MkVectorI3(V.z, V.x, V.x); }
inline VectorI3 SwizzZXY(VectorI3 V){ return MkVectorI3(V.z, V.x, V.y); }
inline VectorI3 SwizzZXZ(VectorI3 V){ return MkVectorI3(V.z, V.x, V.z); }
inline VectorI3 SwizzZX_(VectorI3 V){ return MkVectorI3(V.z, V.x, 0); }
inline VectorI3 SwizzZYX(VectorI3 V){ return MkVectorI3(V.z, V.y, V.x); }
inline VectorI3 SwizzZYY(VectorI3 V){ return MkVectorI3(V.z, V.y, V.y); }
inline VectorI3 SwizzZYZ(VectorI3 V){ return MkVectorI3(V.z, V.y, V.z); }
inline VectorI3 SwizzZY_(VectorI3 V){ return MkVectorI3(V.z, V.y, 0); }
inline VectorI3 SwizzZZX(VectorI3 V){ return MkVectorI3(V.z, V.z, V.x); }
inline VectorI3 SwizzZZY(VectorI3 V){ return MkVectorI3(V.z, V.z, V.y); }
inline VectorI3 SwizzZZZ(VectorI3 V){ return MkVectorI3(V.z, V.z, V.z); }
inline VectorI3 SwizzZZ_(VectorI3 V){ return MkVectorI3(V.z, V.z, 0); }
inline VectorI3 SwizzZ_X(VectorI3 V){ return MkVectorI3(V.z, 0, V.x); }
inline VectorI3 SwizzZ_Y(VectorI3 V){ return MkVectorI3(V.z, 0, V.y); }
inline VectorI3 SwizzZ_Z(VectorI3 V){ return MkVectorI3(V.z, 0, V.z); }
inline VectorI3 SwizzZ__(VectorI3 V){ return MkVectorI3(V.z, 0, 0); }
inline VectorI3 Swizz_XX(VectorI3 V){ return MkVectorI3(0, V.x, V.x); }
inline VectorI3 Swizz_XY(VectorI3 V){ return MkVectorI3(0, V.x, V.y); }
inline VectorI3 Swizz_XZ(VectorI3 V){ return MkVectorI3(0, V.x, V.z); }
inline VectorI3 Swizz_X_(VectorI3 V){ return MkVectorI3(0, V.x, 0); }
inline VectorI3 Swizz_YX(VectorI3 V){ return MkVectorI3(0, V.y, V.x); }
inline VectorI3 Swizz_YY(VectorI3 V){ return MkVectorI3(0, V.y, V.y); }
inline VectorI3 Swizz_YZ(VectorI3 V){ return MkVectorI3(0, V.y, V.z); }
inline VectorI3 Swizz_Y_(VectorI3 V){ return MkVectorI3(0, V.y, 0); }
inline VectorI3 Swizz_ZX(VectorI3 V){ return MkVectorI3(0, V.z, V.x); }
inline VectorI3 Swizz_ZY(VectorI3 V){ return MkVectorI3(0, V.z, V.y); }
inline VectorI3 Swizz_ZZ(VectorI3 V){ return MkVectorI3(0, V.z, V.z); }
inline VectorI3 Swizz_Z_(VectorI3 V){ return MkVectorI3(0, V.z, 0); }
inline VectorI3 Swizz__X(VectorI3 V){ return MkVectorI3(0, 0, V.x); }
inline VectorI3 Swizz__Y(VectorI3 V){ return MkVectorI3(0, 0, V.y); }
inline VectorI3 Swizz__Z(VectorI3 V){ return MkVectorI3(0, 0, V.z); }
inline VectorI4 SwizzXXXX(VectorI3 V){ return MkVectorI4(V.x, V.x, V.x, V.x); }
inline VectorI4 SwizzXXXY(VectorI3 V){ return MkVectorI4(V.x, V.x, V.x, V.y); }
inline VectorI4 SwizzXXXZ(VectorI3 V){ return MkVectorI4(V.x, V.x, V.x, V.z); }
inline VectorI4 SwizzXXX_(VectorI3 V){ return MkVectorI4(V.x, V.x, V.x, 0); }
inline VectorI4 SwizzXXYX(VectorI3 V){ return MkVectorI4(V.x, V.x, V.y, V.x); }
inline VectorI4 SwizzXXYY(VectorI3 V){ return MkVectorI4(V.x, V.x, V.y, V.y); }
inline VectorI4 SwizzXXYZ(VectorI3 V){ return MkVectorI4(V.x, V.x, V.y, V.z); }
inline VectorI4 SwizzXXY_(VectorI3 V){ return MkVectorI4(V.x, V.x, V.y, 0); }
inline VectorI4 SwizzXXZX(VectorI3 V){ return MkVectorI4(V.x, V.x, V.z, V.x); }
inline VectorI4 SwizzXXZY(VectorI3 V){ return MkVectorI4(V.x, V.x, V.z, V.y); }
inline VectorI4 SwizzXXZZ(VectorI3 V){ return MkVectorI4(V.x, V.x, V.z, V.z); }
inline VectorI4 SwizzXXZ_(VectorI3 V){ return MkVectorI4(V.x, V.x, V.z, 0); }
inline VectorI4 SwizzXX_X(VectorI3 V){ return MkVectorI4(V.x, V.x, 0, V.x); }
inline VectorI4 SwizzXX_Y(VectorI3 V){ return MkVectorI4(V.x, V.x, 0, V.y); }
inline VectorI4 SwizzXX_Z(VectorI3 V){ return MkVectorI4(V.x, V.x, 0, V.z); }
inline VectorI4 SwizzXX__(VectorI3 V){ return MkVectorI4(V.x, V.x, 0, 0); }
inline VectorI4 SwizzXYXX(VectorI3 V){ return MkVectorI4(V.x, V.y, V.x, V.x); }
inline VectorI4 SwizzXYXY(VectorI3 V){ return MkVectorI4(V.x, V.y, V.x, V.y); }
inline VectorI4 SwizzXYXZ(VectorI3 V){ return MkVectorI4(V.x, V.y, V.x, V.z); }
inline VectorI4 SwizzXYX_(VectorI3 V){ return MkVectorI4(V.x, V.y, V.x, 0); }
inline VectorI4 SwizzXYYX(VectorI3 V){ return MkVectorI4(V.x, V.y, V.y, V.x); }
inline VectorI4 SwizzXYYY(VectorI3 V){ return MkVectorI4(V.x, V.y, V.y, V.y); }
inline VectorI4 SwizzXYYZ(VectorI3 V){ return MkVectorI4(V.x, V.y, V.y, V.z); }
inline VectorI4 SwizzXYY_(VectorI3 V){ return MkVectorI4(V.x, V.y, V.y, 0); }
inline VectorI4 SwizzXYZX(VectorI3 V){ return MkVectorI4(V.x, V.y, V.z, V.x); }
inline VectorI4 SwizzXYZY(VectorI3 V){ return MkVectorI4(V.x, V.y, V.z, V.y); }