Example #1
0
 public static ColorF operator +(ColorF a, ColorF b)
 {
     return(new ColorF
     {
         R = (byte)FlaiMath.Min(255, a.R + b.R),
         G = (byte)FlaiMath.Min(255, a.G + b.G),
         B = (byte)FlaiMath.Min(255, a.B + b.B),
         A = (byte)FlaiMath.Min(255, a.A + b.A),
     });
 }
Example #2
0
        // yeah... umm, this isn't accurate. and its very slow/brute-force. but whatever, at least it somehow works
        public static float MinimumDistance(Segment2D segment, RectangleF rectangle)
        {
            if (Segment2D.Intersects(segment, rectangle))
            {
                return(0);
            }

            return(FlaiMath.Min(
                       Segment2D.MinimumDistance(segment, rectangle.TopLeft), Segment2D.MinimumDistance(segment, rectangle.TopRight),
                       Segment2D.MinimumDistance(segment, rectangle.BottomLeft), Segment2D.MinimumDistance(segment, rectangle.BottomRight)));
        }
Example #3
0
 public static Vector2f Min(Vector2f value1, Vector2f value2, Vector2f value3, Vector2f value4)
 {
     return(new Vector2f(FlaiMath.Min(value1.X, value2.X, value3.X, value4.X), FlaiMath.Min(value1.Y, value2.Y, value3.Y, value4.Y)));
 }
Example #4
0
 // radians
 public static float AbsAngleDistance(float angle1, float angle2)
 {
     return(FlaiMath.Min((2 * FlaiMath.Pi) - FlaiMath.Abs(angle1 - angle2), FlaiMath.Abs(angle1 - angle2)));
 }
Example #5
0
 public static Vector2i Min(Vector2i value1, Vector2i value2)
 {
     return(new Vector2i(FlaiMath.Min(value1.X, value2.X), FlaiMath.Min(value1.Y, value2.Y)));
 }