public static Direction2D FromRotation(float degrees, Direction2D startDirection = Direction2D.Right) // { degrees = FlaiMath.RealModulus(degrees, 360); int step = (int)FlaiMath.Round(degrees / 90); return((Direction2D)FlaiMath.RealModulus((int)(step + startDirection), 4)); }
public static float Round(this RoundingOptions roundingOptions, float value) { switch (roundingOptions) { case RoundingOptions.Default: return((int)value); case RoundingOptions.Floor: return(FlaiMath.Floor(value)); case RoundingOptions.Ceiling: return(FlaiMath.Ceiling(value)); case RoundingOptions.Round: return(FlaiMath.Round(value)); default: throw new ArgumentException("roundingOptions"); } }
public byte NextByte(byte min, byte max) { return((byte)FlaiMath.Round(min + base.NextDouble() * (max - min))); // 255 or 256? }
public byte NextByte() { return((byte)FlaiMath.Round(base.NextDouble() * 255)); // 255 or 256? }
public static Vector2i Round(Vector2 v) { return(new Vector2i((int)FlaiMath.Round(v.x), (int)FlaiMath.Round(v.y))); }
public static Vector3i Round(Vector3 vec) { return(new Vector3i((int)FlaiMath.Round(vec.x), (int)FlaiMath.Round(vec.y), (int)FlaiMath.Round(vec.z))); }
public static RectangleF GetRounded(RectangleF rectangle) // should this be non-static? { return(new RectangleF(FlaiMath.Round(rectangle.X), FlaiMath.Round(rectangle.Y), rectangle.Width, rectangle.Height)); }