Much like Rectangle, but stored as two Vector2s
コード例 #1
0
ファイル: BoundingRect.cs プロジェクト: i-e-b/Krypton
 public bool Equals(BoundingRect other)
 {
     return
         (Min.X == other.Min.X) &&
         (Min.Y == other.Min.Y) &&
         (Max.X == other.Max.X) &&
         (Max.Y == other.Max.Y);
 }
コード例 #2
0
        public static BoundingRect Union(BoundingRect rect1, BoundingRect rect2)
        {
            BoundingRect result;

            float num6 = rect1.Max.X;
            float num5 = rect2.Max.X;
            float num4 = rect1.Max.Y;
            float num3 = rect2.Max.Y;
            float num2 = (rect1.Min.X < rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num  = (rect1.Min.Y < rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num8 = (num6 > num5) ? num6 : num5;
            float num7 = (num4 > num3) ? num4 : num3;

            result.Min.X = num2;
            result.Min.Y = num;
            result.Max.X = num8;
            result.Max.Y = num7;

            return(result);
        }
コード例 #3
0
        public void BufferAddBoundOutline(Common.BoundingRect boundingRect)
        {
            var vertexCount = this.mShadowHullVertices.Count;

            this.mShadowHullVertices.Add(new ShadowHullVertex()
            {
                Color    = Color.Black,
                Normal   = Vector2.Zero,
                Position = new Vector2(boundingRect.Left, boundingRect.Top)
            });

            this.mShadowHullVertices.Add(new ShadowHullVertex()
            {
                Color    = Color.Black,
                Normal   = Vector2.Zero,
                Position = new Vector2(boundingRect.Right, boundingRect.Top)
            });

            this.mShadowHullVertices.Add(new ShadowHullVertex()
            {
                Color    = Color.Black,
                Normal   = Vector2.Zero,
                Position = new Vector2(boundingRect.Right, boundingRect.Bottom)
            });

            this.mShadowHullVertices.Add(new ShadowHullVertex()
            {
                Color    = Color.Black,
                Normal   = Vector2.Zero,
                Position = new Vector2(boundingRect.Left, boundingRect.Bottom)
            });

            this.mShadowHullIndicies.Add(vertexCount + 0);
            this.mShadowHullIndicies.Add(vertexCount + 1);
            this.mShadowHullIndicies.Add(vertexCount + 2);

            this.mShadowHullIndicies.Add(vertexCount + 0);
            this.mShadowHullIndicies.Add(vertexCount + 2);
            this.mShadowHullIndicies.Add(vertexCount + 3);
        }
コード例 #4
0
        public static BoundingRect Union(
            BoundingRect rect1,
            BoundingRect rect2)
        {
            BoundingRect result;

            var num6 = rect1.Max.X;
            var num5 = rect2.Max.X;
            var num4 = rect1.Max.Y;
            var num3 = rect2.Max.Y;
            var num2 = rect1.Min.X < rect2.Min.X ? rect1.Min.X : rect2.Min.X;
            var num  = rect1.Min.Y < rect2.Min.Y ? rect1.Min.Y : rect2.Min.Y;
            var num8 = num6 > num5 ? num6 : num5;
            var num7 = num4 > num3 ? num4 : num3;

            result.Min.X = num2;
            result.Min.Y = num;
            result.Max.X = num8;
            result.Max.Y = num7;

            return(result);
        }
コード例 #5
0
ファイル: BoundingRect.cs プロジェクト: PhoenixWright/Mystery
        public static void Intersect(ref BoundingRect rect1, ref BoundingRect rect2, out BoundingRect result)
        {
            float num8 = rect1.Max.X;
            float num7 = rect2.Max.X;
            float num6 = rect1.Max.Y;
            float num5 = rect2.Max.Y;
            float num2 = (rect1.Min.X > rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num  = (rect1.Min.Y > rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num4 = (num8 < num7) ? num8 : num7;
            float num3 = (num6 < num5) ? num6 : num5;

            if ((num4 > num2) && (num3 > num))
            {
                result.Min = new Vector2(num2, num);
                result.Max = new Vector2(num4, num3);

                return;
            }

            result.Min = Vector2.Zero;
            result.Max = Vector2.Zero;
        }
コード例 #6
0
        public static void Intersect(ref BoundingRect rect1, ref BoundingRect rect2, out BoundingRect result)
        {
            float num8 = rect1.Max.X;
            float num7 = rect2.Max.X;
            float num6 = rect1.Max.Y;
            float num5 = rect2.Max.Y;
            float num2 = (rect1.Min.X > rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num  = (rect1.Min.Y > rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num4 = (num8 < num7) ? num8 : num7;
            float num3 = (num6 < num5) ? num6 : num5;

            if ((num4 > num2) && (num3 > num))
            {
                result.Min.X = num2;
                result.Min.Y = num;
                result.Max.X = num4;
                result.Max.Y = num3;
            }

            result.Min.X = 0;
            result.Min.Y = 0;
            result.Max.X = 0;
            result.Max.Y = 0;
        }
コード例 #7
0
        public static BoundingRect Union(BoundingRect rect1, BoundingRect rect2)
        {
            BoundingRect result = new BoundingRect();

            float num6 = rect1.Max.X;
            float num5 = rect2.Max.X;
            float num4 = rect1.Max.Y;
            float num3 = rect2.Max.Y;
            float num2 = (rect1.Min.X < rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num = (rect1.Min.Y < rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num8 = (num6 > num5) ? num6 : num5;
            float num7 = (num4 > num3) ? num4 : num3;

            result.Min.X = num2;
            result.Min.Y = num;
            result.Max.X = num8;
            result.Max.Y = num7;

            return result;
        }
コード例 #8
0
ファイル: KryptonEngine.cs プロジェクト: i-e-b/Krypton
        void UpdateWorldSpace(Matrix value)
        {
            var inverse = Matrix.Invert(value);

            var v1 = Vector2.Transform(new Vector2(1, 1), inverse);
            var v2 = Vector2.Transform(new Vector2(1, -1), inverse);
            var v3 = Vector2.Transform(new Vector2(-1, -1), inverse);
            var v4 = Vector2.Transform(new Vector2(-1, 1), inverse);

            bounds.Min = v1;
            bounds.Min = Vector2.Min(bounds.Min, v2);
            bounds.Min = Vector2.Min(bounds.Min, v3);
            bounds.Min = Vector2.Min(bounds.Min, v4);

            bounds.Max = v1;
            bounds.Max = Vector2.Max(bounds.Max, v2);
            bounds.Max = Vector2.Max(bounds.Max, v3);
            bounds.Max = Vector2.Max(bounds.Max, v4);

            bounds = BoundingRect.MinMax;
        }
コード例 #9
0
 static BoundingRect()
 {
     BoundingRect.mEmpty  = new BoundingRect();
     BoundingRect.mMinMax = new BoundingRect(Vector2.One * float.MinValue, Vector2.One * float.MaxValue);
 }
コード例 #10
0
 public void Intersects(ref BoundingRect rect, out bool result)
 {
     result =
         (this.Min.X < rect.Max.X) &&
         (this.Min.Y < rect.Max.Y) &&
         (this.Max.X > rect.Min.X) &&
         (this.Max.Y > rect.Min.Y);
 }
コード例 #11
0
 static BoundingRect()
 {
     BoundingRect.mEmpty = new BoundingRect();
     BoundingRect.mMinMax = new BoundingRect(Vector2.One * float.MinValue, Vector2.One * float.MaxValue);
 }
コード例 #12
0
 public bool Intersects(BoundingRect rect)
 {
     return
         (this.Min.X < rect.Max.X) &&
         (this.Min.Y < rect.Max.Y) &&
         (this.Max.X > rect.Min.X) &&
         (this.Max.Y > rect.Min.Y);
 }
コード例 #13
0
 public bool Contains(BoundingRect rect)
 {
     return
         (this.Min.X <= rect.Min.X) &&
         (this.Min.Y <= rect.Min.Y) &&
         (this.Max.X >= rect.Max.X) &&
         (this.Max.Y >= rect.Max.Y);
 }
コード例 #14
0
 public void Contains(ref BoundingRect rect, out bool result)
 {
     result =
         (this.Min.X <= rect.Min.X) &&
         (this.Min.Y <= rect.Min.Y) &&
         (this.Max.X >= rect.Max.X) &&
         (this.Max.Y >= rect.Max.Y) ;
 }
コード例 #15
0
ファイル: KryptonRenderHelper.cs プロジェクト: i-e-b/Krypton
        public void BufferAddBoundOutline(BoundingRect boundingRect)
        {
            int vertexCount = shadowHullVertices.Count;

            shadowHullVertices.Add(new ShadowHullVertex {
                Color = Color.Black,
                Normal = Vector2.Zero,
                Position = new Vector2(boundingRect.Left, boundingRect.Top)
            });

            shadowHullVertices.Add(new ShadowHullVertex {
                Color = Color.Black,
                Normal = Vector2.Zero,
                Position = new Vector2(boundingRect.Right, boundingRect.Top)
            });

            shadowHullVertices.Add(new ShadowHullVertex {
                Color = Color.Black,
                Normal = Vector2.Zero,
                Position = new Vector2(boundingRect.Right, boundingRect.Bottom)
            });

            shadowHullVertices.Add(new ShadowHullVertex {
                Color = Color.Black,
                Normal = Vector2.Zero,
                Position = new Vector2(boundingRect.Left, boundingRect.Bottom)
            });

            shadowHullIndicies.Add(vertexCount + 0);
            shadowHullIndicies.Add(vertexCount + 1);
            shadowHullIndicies.Add(vertexCount + 2);

            shadowHullIndicies.Add(vertexCount + 0);
            shadowHullIndicies.Add(vertexCount + 2);
            shadowHullIndicies.Add(vertexCount + 3);
        }
コード例 #16
0
        public static void Union(ref BoundingRect rect1, ref BoundingRect rect2, out BoundingRect result)
        {
            float num6 = rect1.Max.X;
            float num5 = rect2.Max.X;
            float num4 = rect1.Max.Y;
            float num3 = rect2.Max.Y;
            float num2 = (rect1.Min.X < rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num = (rect1.Min.Y < rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num8 = (num6 > num5) ? num6 : num5;
            float num7 = (num4 > num3) ? num4 : num3;

            result = new BoundingRect();

            result.Min.X = num2;
            result.Min.Y = num;
            result.Max.X = num8;
            result.Max.Y = num7;
        }
コード例 #17
0
        public static void Intersect(ref BoundingRect rect1, ref BoundingRect rect2, out BoundingRect result)
        {
            float num8 = rect1.Max.X;
            float num7 = rect2.Max.X;
            float num6 = rect1.Max.Y;
            float num5 = rect2.Max.Y;
            float num2 = (rect1.Min.X > rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num = (rect1.Min.Y > rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num4 = (num8 < num7) ? num8 : num7;
            float num3 = (num6 < num5) ? num6 : num5;

            result = new BoundingRect();

            if ((num4 > num2) && (num3 > num))
            {
                result.Min.X = num2;
                result.Min.Y = num;
                result.Max.X = num4;
                result.Max.Y = num3;
            }

            result.Min.X = 0;
            result.Min.Y = 0;
            result.Max.X = 0;
            result.Max.Y = 0;
        }
コード例 #18
0
        public static BoundingRect Intersect(BoundingRect rect1, BoundingRect rect2)
        {
            BoundingRect result;

            float num8 = rect1.Max.X;
            float num7 = rect2.Max.X;
            float num6 = rect1.Max.Y;
            float num5 = rect2.Max.Y;
            float num2 = (rect1.Min.X > rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num = (rect1.Min.Y > rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num4 = (num8 < num7) ? num8 : num7;
            float num3 = (num6 < num5) ? num6 : num5;

            result = new BoundingRect();

            if ((num4 > num2) && (num3 > num))
            {
                result.Min.X = num2;
                result.Min.Y = num;
                result.Max.X = num4;
                result.Max.Y = num3;

                return result;
            }

            result.Min.X = 0;
            result.Min.Y = 0;
            result.Max.X = 0;
            result.Max.Y = 0;

            return result;
        }
コード例 #19
0
ファイル: BoundingRect.cs プロジェクト: PhoenixWright/Mystery
        public static void Union(ref BoundingRect rect1, ref BoundingRect rect2, out BoundingRect result)
        {
            float num6 = rect1.Max.X;
            float num5 = rect2.Max.X;
            float num4 = rect1.Max.Y;
            float num3 = rect2.Max.Y;
            float num2 = (rect1.Min.X < rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num = (rect1.Min.Y < rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num8 = (num6 > num5) ? num6 : num5;
            float num7 = (num4 > num3) ? num4 : num3;

            result.Min = new Vector2(num2, num);
            result.Max = new Vector2(num8, num7);
        }
コード例 #20
0
ファイル: BoundingRect.cs プロジェクト: PhoenixWright/Mystery
        public static BoundingRect Union(BoundingRect rect1, BoundingRect rect2)
        {
            BoundingRect result;

            float num6 = rect1.Max.X;
            float num5 = rect2.Max.X;
            float num4 = rect1.Max.Y;
            float num3 = rect2.Max.Y;
            float num2 = (rect1.Min.X < rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num = (rect1.Min.Y < rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num8 = (num6 > num5) ? num6 : num5;
            float num7 = (num4 > num3) ? num4 : num3;

            result.Min = new Vector2(num2, num);
            result.Max = new Vector2(num8, num7);

            return result;
        }
コード例 #21
0
ファイル: BoundingRect.cs プロジェクト: PhoenixWright/Mystery
        public static void Intersect(ref BoundingRect rect1, ref BoundingRect rect2, out BoundingRect result)
        {
            float num8 = rect1.Max.X;
            float num7 = rect2.Max.X;
            float num6 = rect1.Max.Y;
            float num5 = rect2.Max.Y;
            float num2 = (rect1.Min.X > rect2.Min.X) ? rect1.Min.X : rect2.Min.X;
            float num = (rect1.Min.Y > rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y;
            float num4 = (num8 < num7) ? num8 : num7;
            float num3 = (num6 < num5) ? num6 : num5;

            if ((num4 > num2) && (num3 > num))
            {
                result.Min = new Vector2(num2, num);
                result.Max = new Vector2(num4, num3);

                return;
            }

            result.Min = Vector2.Zero;
            result.Max = Vector2.Zero;
        }