algorithm find points