1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-04 06:13:36 +02:00
MLEM/MLEM/Extensions/NumberExtensions.cs

32 lines
909 B
C#
Raw Normal View History

2019-08-06 14:20:11 +02:00
using System;
2019-08-07 00:45:40 +02:00
using Microsoft.Xna.Framework;
2019-08-06 14:20:11 +02:00
namespace MLEM.Extensions {
public static class NumberExtensions {
public static int Floor(this float f) {
return (int) Math.Floor(f);
}
public static int Ceil(this float f) {
return (int) Math.Ceiling(f);
}
2019-08-07 00:45:40 +02:00
public static Vector2 Floor(this Vector2 vec) {
return new Vector2(vec.X.Floor(), vec.Y.Floor());
}
public static Vector3 Floor(this Vector3 vec) {
return new Vector3(vec.X.Floor(), vec.Y.Floor(), vec.Z.Floor());
}
public static Vector4 Floor(this Vector4 vec) {
return new Vector4(vec.X.Floor(), vec.Y.Floor(), vec.Z.Floor(), vec.W.Floor());
}
2019-08-06 14:20:11 +02:00
public static Point Multiply(this Point point, float f) {
return new Point((point.X * f).Floor(), (point.Y * f).Floor());
}
2019-08-06 14:20:11 +02:00
}
}