private static bool PointInPad(Pad pad, Point p) { return pad.X1 <= p.X && pad.X2 >= p.X && pad.Y1 <= p.Y && p.Y <= pad.Y2; }