예제 #1
0
 public static ColorF operator -(ColorF a, ColorF b)
 {
     return(new ColorF
     {
         R = (byte)FlaiMath.Max(0, a.R - b.R),
         G = (byte)FlaiMath.Max(0, a.G - b.G),
         B = (byte)FlaiMath.Max(0, a.B - b.B),
         A = (byte)FlaiMath.Max(0, a.A - b.A),
     });
 }
예제 #2
0
        public static float MinimumDistance(Segment2D segment, Circle circle)
        {
            if (Segment2D.Intersects(segment, circle))
            {
                return(0);
            }

            // okay this Max *should be* unnecessary, but lets keep it just for sure
            return(FlaiMath.Max(0, Segment2D.MinimumDistance(segment, circle.Position) - circle.Radius));
        }
예제 #3
0
        // is this accurate? could be...
        public static float MaximumDistance(Segment2D segment, RectangleF rectangle)
        {
            if (Segment2D.Intersects(segment, rectangle))
            {
                return(0);
            }

            return(FlaiMath.Max(
                       Segment2D.MaximumDistance(segment, rectangle.TopLeft), Segment2D.MaximumDistance(segment, rectangle.TopRight),
                       Segment2D.MaximumDistance(segment, rectangle.BottomLeft), Segment2D.MaximumDistance(segment, rectangle.BottomRight)));
        }
예제 #4
0
 public static Vector2f Max(Vector2f value1, Vector2f value2, Vector2f value3, Vector2f value4)
 {
     return(new Vector2f(FlaiMath.Max(value1.X, value2.X, value3.X, value4.X), FlaiMath.Max(value1.Y, value2.Y, value3.Y, value4.Y)));
 }
예제 #5
0
 public static Vector2i Max(Vector2i value1, Vector2i value2)
 {
     return(new Vector2i(FlaiMath.Max(value1.X, value2.X), FlaiMath.Max(value1.Y, value2.Y)));
 }