prepare IsWithinBounds method

need coords of pattern