bool contains(num px, num py)

Source

bool contains(num px, num py) {
  return left <= px && top <= py && right > px && bottom > py;
}