コード例 #1
0
ファイル: Rect.cs プロジェクト: wcatykid/GeoShader
 public Rect(Rect r)
 {
     Location = new Point(r.Location);
     Size = new Point(r.Size);
 }
コード例 #2
0
ファイル: Rect.cs プロジェクト: wcatykid/GeoShader
 public void Set(Rect R)
 {
     this.Location.Set(R.Location);
     this.Size.Set(R.Size);
 }
コード例 #3
0
ファイル: Rect.cs プロジェクト: wcatykid/GeoShader
        public void Unite(Rect ToContain)
        {
            int x1 = ToContain.mLocation.X;
            int y1 = ToContain.mLocation.Y;
            int x2 = ToContain.Right;
            int y2 = ToContain.Bottom;

            if (x1 < this.Location.X)
            {
                this.Size.X += this.Location.X - x1;
                this.Location.X = x1;
            }

            if (y1 < this.Location.Y)
            {
                this.Size.Y += this.Location.Y - y1;
                this.Location.Y = y1;
            }

            if (x2 > this.Right)
            {
                this.Size.X = x2 - this.Location.X;
            }

            if (y2 > this.Bottom)
            {
                this.Size.Y = y2 - this.Location.Y;
            }
        }
コード例 #4
0
ファイル: Rect.cs プロジェクト: wcatykid/GeoShader
        public bool IntersectsRectY(Rect Reference)
        {
            int y1 = Reference.Location.Y;
            int y2 = Reference.Bottom;
            int top = this.Location.Y;
            int bottom = this.Bottom;

            return (bottom > y1 && top < y2);
        }
コード例 #5
0
ファイル: Rect.cs プロジェクト: wcatykid/GeoShader
        public int RelativeToRectY(Rect Reference)
        {
            int y1 = Reference.Location.Y;
            int y2 = Reference.Bottom;
            int top = this.Location.Y;
            int bottom = this.Bottom;

            if (top >= y2) return 5;

            if (bottom <= y1) return 1;

            if (top < y1)
            {
                if (bottom <= y2) return 2;
                return 0;
            }

            if (bottom > y2) return 4;

            return 3;
        }
コード例 #6
0
ファイル: Rect.cs プロジェクト: wcatykid/GeoShader
        public bool IntersectsRectX(Rect Reference)
        {
            int x1 = Reference.Location.X;
            int x2 = Reference.Right;
            int left = this.Location.X;
            int right = this.Right;

            return (right > x1 && left < x2);
        }
コード例 #7
0
ファイル: Rect.cs プロジェクト: wcatykid/GeoShader
 public bool IntersectsRect(Rect Reference)
 {
     return IntersectsRectX(Reference) && IntersectsRectY(Reference);
 }
コード例 #8
0
ファイル: Rect.cs プロジェクト: wcatykid/GeoShader
 public bool Contains(Rect inner)
 {
     return
         inner.Location.X >= this.Location.X
         && inner.Location.Y >= this.Location.Y
         && inner.Right <= this.Right
         && inner.Bottom <= this.Bottom;
 }
コード例 #9
0
ファイル: Point.cs プロジェクト: Ju2ender/csharp-e
 public PointClassification ClassifyVertically(Rect r)
 {
     if (Y < r.Top)
     {
         return PointClassification.Before;
     }
     else if (Y <= r.Bottom)
     {
         return PointClassification.Inside;
     }
     else
     {
         return PointClassification.After;
     }
 }
コード例 #10
0
ファイル: Point.cs プロジェクト: Ju2ender/csharp-e
 public PointClassification ClassifyHorizontally(Rect r)
 {
     if (X < r.Left)
     {
         return PointClassification.Before;
     }
     else if (X <= r.Right)
     {
         return PointClassification.Inside;
     }
     else
     {
         return PointClassification.After;
     }
 }