Ejemplo n.º 1
0
        public static PointInt[] GenerateNeighbors(long x, long y)
        {
            var result = new PointInt[4];

            for (int i = 0; i < 4; i++)
            {
                result[i] = new PointInt(x + sx[i], y + sy[i]);
            }
            return(result);
        }
Ejemplo n.º 2
0
 public bool Equals(PointInt other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other.X == this.X && other.Y == this.Y);
 }
Ejemplo n.º 3
0
 public PointInt(PointInt head)
     : this(head.X, head.Y)
 {
 }
Ejemplo n.º 4
0
 public static long VectInt(PointInt a, PointInt b, PointInt c)
 {
     return((b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X));
 }
Ejemplo n.º 5
0
 public static long VectInt(PointInt a, PointInt b)
 {
     return(a.X * b.Y - a.Y * b.X);
 }
Ejemplo n.º 6
0
 public int Sign(PointInt p)
 {
     return(Math.Sign(A * p.X + B * p.Y + C));
 }
Ejemplo n.º 7
0
 public bool ContainsPoint(PointInt p)
 {
     return(A * p.X + B * p.Y + C == 0);
 }
Ejemplo n.º 8
0
 public static List <PointInt> GenerateNeighborsWithBounds(this PointInt p, int n, int m)
 {
     return(GenerateNeighborsWithBounds(p.X, p.Y, n, m));
 }
Ejemplo n.º 9
0
 public static PointInt[] GenerateNeighbors(this PointInt p)
 {
     return(GenerateNeighbors(p.X, p.Y));
 }
Ejemplo n.º 10
0
 public LineInt(PointInt a, PointInt b)
 {
     A = a.Y - b.Y;
     B = b.X - a.X;
     C = a.X * b.Y - a.Y * b.X;
 }