Add Mod for vectors
This commit is contained in:
@@ -157,6 +157,11 @@ namespace Math
|
||||
return value < 0 ? -value : value;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32 Mod(const int32 a, const int32 b)
|
||||
{
|
||||
return (int32)fmodf((float)a, (float)b);
|
||||
}
|
||||
|
||||
static FORCE_INLINE float Mod(const float a, const float b)
|
||||
{
|
||||
return fmodf(a, b);
|
||||
|
||||
@@ -457,6 +457,11 @@ public:
|
||||
return Vector2Base(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y);
|
||||
}
|
||||
|
||||
static Vector2Base Mod(const Vector2Base& a, const Vector2Base& b)
|
||||
{
|
||||
return Vector2Base(Math::Mod(a.X, b.X), Math::Mod(a.Y, b.Y));
|
||||
}
|
||||
|
||||
static Vector2Base Floor(const Vector2Base& v)
|
||||
{
|
||||
return Vector2Base(Math::Floor(v.X), Math::Floor(v.Y));
|
||||
|
||||
@@ -512,6 +512,11 @@ public:
|
||||
return Vector3Base(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y, a.Z > b.Z ? a.Z : b.Z);
|
||||
}
|
||||
|
||||
static Vector3Base Mod(const Vector3Base& a, const Vector3Base& b)
|
||||
{
|
||||
return Vector3Base(Math::Mod(a.X, b.X), Math::Mod(a.Y, b.Y), Math::Mod(a.Z, b.Z));
|
||||
}
|
||||
|
||||
static Vector3Base Floor(const Vector3Base& v)
|
||||
{
|
||||
return Vector3Base(Math::Floor(v.X), Math::Floor(v.Y), Math::Floor(v.Z));
|
||||
|
||||
@@ -423,6 +423,11 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
static Vector4Base Mod(const Vector4Base& a, const Vector4Base& b)
|
||||
{
|
||||
return Vector4Base(Math::Mod(a.X, b.X), Math::Mod(a.Y, b.Y), Math::Mod(a.Z, b.Z), Math::Mod(a.W, b.W));
|
||||
}
|
||||
|
||||
static Vector4Base Floor(const Vector4Base& v)
|
||||
{
|
||||
return Vector4Base(Math::Floor(v.X), Math::Floor(v.Y), Math::Floor(v.Z), Math::Floor(v.W));
|
||||
|
||||
Reference in New Issue
Block a user