Actually it was for point inside the polygon so it explains the problem.
But can I access the elements of the polygon if I declare it as ring?
Then I can use the distance between the point and each segment to finally take the smallest value.