build rectangle and found if a point is inside