New algorithm containsPoint