public Position PositionOf(Point2D coord) { Position pos = Position.Inside; if (coord.x < this.x0) { pos |= Position.Left; } if (coord.x > this.x1) { pos |= Position.Right; } if (coord.y < this.y0) { pos |= Position.Top; } if (coord.y > this.y1) { pos |= Position.Bottom; } return pos; }
public bool IsInside(Point2D coord) { return PositionOf(coord) == (Position)0; }