algorithm for check point is inside shape