コード例 #1
0
ファイル: Utils.cs プロジェクト: sardap/VFVGAVFAF
        public static Postion2D RandomPostionInBounds(Paultangle rectangle)
        {
            double x = Random.NextDouble() * (rectangle.Right - rectangle.Left) + rectangle.Left;
            double y = Random.NextDouble() * (rectangle.Bottom - rectangle.Top) + rectangle.Top;

            return(new Postion2D(x, y));
        }
コード例 #2
0
ファイル: Utils.cs プロジェクト: sardap/VFVGAVFAF
        public static bool Check(Paultangle a, Paultangle b, CheckType type, bool inside)
        {
            CheckCon d;

            switch (type)
            {
            case CheckType.Contains:
                d = new CheckCon(Utils.AInsideB);
                break;

            case CheckType.Overlapping:
                d = new CheckCon(Utils.AOverlapB);
                break;

            default:
                throw new NotImplementedException();
            }

            bool result;

            if (inside)
            {
                result = d(a, b);
            }
            else
            {
                result = !d(a, b);
            }

            return(result);
        }
コード例 #3
0
ファイル: Utils.cs プロジェクト: sardap/VFVGAVFAF
        public static Paultangle RandomPostionInBounds(Paultangle bounds, Paultangle paultangle)
        {
            do
            {
                paultangle.Postion2D = RandomPostionInBounds(bounds);
            } while (!AInsideB(paultangle, bounds));

            return(paultangle);
        }
コード例 #4
0
ファイル: Paultangle.cs プロジェクト: sardap/VFVGAVFAF
        public bool Intersects(Paultangle other)
        {
            Paultangle RectA = this;
            Paultangle RectB = other;

            return(RectA.X1 < RectB.X2 &&
                   RectA.X2 > RectB.X1 &&
                   RectA.Y1 < RectB.Y2 &&
                   RectA.Y2 > RectB.Y1);
        }
コード例 #5
0
ファイル: Utils.cs プロジェクト: sardap/VFVGAVFAF
 public static bool AOverlapB(Paultangle a, Paultangle b)
 {
     return(a.Intersects(b));
 }
コード例 #6
0
ファイル: Utils.cs プロジェクト: sardap/VFVGAVFAF
        public static bool AInsideB(Paultangle a, Paultangle b)
        {
            bool result = a.Right <b.Right && a.Left> b.Left && a.Top >= b.Top && a.Bottom < b.Bottom;

            return(result);
        }
コード例 #7
0
ファイル: Paultangle.cs プロジェクト: sardap/VFVGAVFAF
 public Paultangle(Paultangle paultangle) : this(paultangle.Postion2D, paultangle.Width, paultangle.Height)
 {
 }
コード例 #8
0
 public Postion2D Calcaute(Paultangle bounds, Postion2D size)
 {
     return new Postion2D(0, Math.Floor(bounds.Height / 2) - Math.Floor(size.Y / 2));
 }
コード例 #9
0
ファイル: Centerhorizontal.cs プロジェクト: sardap/VFVGAVFAF
 public Postion2D Calcaute(Paultangle bounds, Postion2D size)
 {
     return(new Postion2D((bounds.Width / 2) - (size.X / 2), 0));
 }