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); }
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); }
public PointInt(PointInt head) : this(head.X, head.Y) { }
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)); }
public static long VectInt(PointInt a, PointInt b) { return(a.X * b.Y - a.Y * b.X); }
public int Sign(PointInt p) { return(Math.Sign(A * p.X + B * p.Y + C)); }
public bool ContainsPoint(PointInt p) { return(A * p.X + B * p.Y + C == 0); }
public static List <PointInt> GenerateNeighborsWithBounds(this PointInt p, int n, int m) { return(GenerateNeighborsWithBounds(p.X, p.Y, n, m)); }
public static PointInt[] GenerateNeighbors(this PointInt p) { return(GenerateNeighbors(p.X, p.Y)); }
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; }