I have a set S of points (2D : defined by x and y) and I want to find P, the smallest (meaning : with the smallest number of points) polygon enclosing all the points of the
There are many algorithms for this problem. It is called "minimum bounding box". You will find solutions too searching for "convex hull", especially here.
One way is to find the leftmost point and then repeat to search for a point where all other points are to the right of the line p(n-1)p(n).