示例#1
0
        public static PointInt Neighbor(this MyMath.PointInt p, int direction)
        {
            if (direction < 0 || direction > 5)
            {
                throw new ArgumentException();
            }
            switch (direction)
            {
            case 0:
                return(p + new PointInt(0, -1));

            case 1:
                return(p + new PointInt(1, -1));

            case 2:
                return(p + new PointInt(1, 0));

            case 3:
                return(p + new PointInt(0, 1));

            case 4:
                return(p + new PointInt(-1, 1));

            case 5:
                return(p + new PointInt(-1, 0));

            default:
                return(p);
            }
        }
示例#2
0
 public Hole(MyMath.PointInt p)
 {
     inside = new Vertex(p.x, p.y);
 }
示例#3
0
 public bool Equal(PointInt p)
 {
     return(this.x == p.x && this.y == p.y);
 }
示例#4
0
 public static int Cross(PointInt p1, PointInt p2)
 {
     return(p1.x * p2.y - p1.y * p2.x);
 }
示例#5
0
 public float Cross(PointInt p2)
 {
     return(Cross(this, p2));
 }